diff options
-rw-r--r-- | oslo_db/sqlalchemy/exc_filters.py | 1 | ||||
-rw-r--r-- | oslo_db/sqlalchemy/utils.py | 2 | ||||
-rw-r--r-- | oslo_db/tests/sqlalchemy/test_exc_filters.py | 8 | ||||
-rw-r--r-- | setup.cfg | 2 | ||||
-rwxr-xr-x | tools/tox_install.sh | 30 | ||||
-rw-r--r-- | tox.ini | 5 |
6 files changed, 45 insertions, 3 deletions
diff --git a/oslo_db/sqlalchemy/exc_filters.py b/oslo_db/sqlalchemy/exc_filters.py index 9fb81c3..3040edc 100644 --- a/oslo_db/sqlalchemy/exc_filters.py +++ b/oslo_db/sqlalchemy/exc_filters.py @@ -387,6 +387,7 @@ def _raise_operational_errors_directly_filter(operational_error, @filters("mysql", sqla_exc.OperationalError, r".*\(.*(?:2002|2003|2006|2013|1047)") # noqa @filters("mysql", sqla_exc.InternalError, r".*\(.*(?:1927)") # noqa +@filters("mysql", sqla_exc.InternalError, r".*Packet sequence number wrong") # noqa @filters("postgresql", sqla_exc.OperationalError, r".*could not connect to server") # noqa @filters("ibm_db_sa", sqla_exc.OperationalError, r".*(?:30081)") def _is_db_connection_error(operational_error, match, engine_name, diff --git a/oslo_db/sqlalchemy/utils.py b/oslo_db/sqlalchemy/utils.py index 1dd9767..5adbd22 100644 --- a/oslo_db/sqlalchemy/utils.py +++ b/oslo_db/sqlalchemy/utils.py @@ -118,7 +118,7 @@ def get_unique_keys(model): def _stable_sorting_order(model, sort_keys): - """Check whetever the sorting order is stable. + """Check whether the sorting order is stable. :return: True if it is stable, False if it's not, None if it's impossible to determine. diff --git a/oslo_db/tests/sqlalchemy/test_exc_filters.py b/oslo_db/tests/sqlalchemy/test_exc_filters.py index 0894c3d..558cca8 100644 --- a/oslo_db/tests/sqlalchemy/test_exc_filters.py +++ b/oslo_db/tests/sqlalchemy/test_exc_filters.py @@ -1195,6 +1195,14 @@ class TestDBDisconnected(TestsExceptionFilter): is_disconnect=False ) + def test_packet_sequence_wrong_error(self): + self._test_ping_listener_disconnected( + "mysql", + self.InternalError( + 'Packet sequence number wrong - got 35 expected 1'), + is_disconnect=False + ) + def test_mysql_ping_listener_disconnected(self): for code in [2006, 2013, 2014, 2045, 2055]: self._test_ping_listener_disconnected( @@ -22,7 +22,7 @@ classifier = [extras] # So e.g. nova can test-depend on oslo.db[mysql] mysql = - PyMySQL!=0.7.7,>=0.7.6 # MIT License + PyMySQL>=0.7.6 # MIT License # or oslo.db[mysql-c] mysql-c = MySQL-python:python_version=='2.7' # GPL with FOSS exception diff --git a/tools/tox_install.sh b/tools/tox_install.sh new file mode 100755 index 0000000..e61b63a --- /dev/null +++ b/tools/tox_install.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +# Client constraint file contains this client version pin that is in conflict +# with installing the client from source. We should remove the version pin in +# the constraints file before applying it for from-source installation. + +CONSTRAINTS_FILE="$1" +shift 1 + +set -e + +# NOTE(tonyb): Place this in the tox enviroment's log dir so it will get +# published to logs.openstack.org for easy debugging. +localfile="$VIRTUAL_ENV/log/upper-constraints.txt" + +if [[ "$CONSTRAINTS_FILE" != http* ]]; then + CONSTRAINTS_FILE="file://$CONSTRAINTS_FILE" +fi +# NOTE(tonyb): need to add curl to bindep.txt if the project supports bindep +curl "$CONSTRAINTS_FILE" --insecure --progress-bar --output "$localfile" + +pip install -c"$localfile" openstack-requirements + +# This is the main purpose of the script: Allow local installation of +# the current repo. It is listed in constraints file and thus any +# install will be constrained and we need to unconstrain it. +edit-constraints "$localfile" -- "$CLIENT_NAME" + +pip install -c"$localfile" -U "$@" +exit $? @@ -1,13 +1,16 @@ [tox] -minversion = 1.8 +minversion = 2.0 envlist = py35,py34,py27,pep8,pip-missing-reqs [testenv] +install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} whitelist_externals = bash env setenv = VIRTUAL_ENV={envdir} BASECOMMAND=bash tools/pretty_tox.sh + BRANCH_NAME=master + CLIENT_NAME=oslo.db {postgresql,all}: PIFPAF_POSTGRESQL=pifpaf -g OS_TEST_DBAPI_ADMIN_CONNECTION run postgresql -- {mysql,all}: PIFPAF_MYSQL=pifpaf -g OS_TEST_DBAPI_ADMIN_CONNECTION run mysql -- |