summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.zuul.yaml17
-rw-r--r--oslo_db/exception.py19
-rw-r--r--oslo_db/sqlalchemy/test_base.py4
-rw-r--r--oslo_db/sqlalchemy/test_fixtures.py2
-rw-r--r--oslo_db/tests/sqlalchemy/test_async_eventlet.py2
-rw-r--r--oslo_db/tests/sqlalchemy/test_exc_filters.py2
-rw-r--r--oslo_db/tests/sqlalchemy/test_fixtures.py4
-rw-r--r--oslo_db/tests/sqlalchemy/test_ndb.py2
-rw-r--r--oslo_db/tests/sqlalchemy/test_provision.py4
-rw-r--r--oslo_db/tests/sqlalchemy/test_utils.py20
-rw-r--r--playbooks/legacy/oslo.db-tox-mysql-python/post.yaml67
-rw-r--r--playbooks/legacy/oslo.db-tox-mysql-python/run.yaml86
-rw-r--r--requirements.txt2
-rw-r--r--setup.cfg2
14 files changed, 195 insertions, 38 deletions
diff --git a/.zuul.yaml b/.zuul.yaml
new file mode 100644
index 0000000..2398cf0
--- /dev/null
+++ b/.zuul.yaml
@@ -0,0 +1,17 @@
+- project:
+ name: openstack/oslo.db
+ check:
+ jobs:
+ - oslo.db-tox-mysql-python
+ gate:
+ jobs:
+ - oslo.db-tox-mysql-python
+
+- job:
+ name: oslo.db-tox-mysql-python
+ parent: legacy-base
+ run: playbooks/legacy/oslo.db-tox-mysql-python/run.yaml
+ post-run: playbooks/legacy/oslo.db-tox-mysql-python/post.yaml
+ timeout: 2400
+ required-projects:
+ - openstack/requirements
diff --git a/oslo_db/exception.py b/oslo_db/exception.py
index c8da996..fcdfd4e 100644
--- a/oslo_db/exception.py
+++ b/oslo_db/exception.py
@@ -43,7 +43,6 @@ with `try/except` statement. This is required for consistent handling of
database errors.
"""
-import debtcollector.removals
import six
from oslo_db._i18n import _
@@ -188,13 +187,6 @@ class DBInvalidUnicodeParameter(Exception):
without encoding directive.
"""
- @debtcollector.removals.removed_property
- def message(self):
- # NOTE(rpodolyaka): provided for compatibility with python 3k, where
- # exceptions do not have .message attribute, while we used to have one
- # in this particular exception class. See LP #1542961 for details.
- return str(self)
-
def __init__(self):
super(DBInvalidUnicodeParameter, self).__init__(
_("Invalid Parameter: Encoding directive wasn't provided."))
@@ -221,10 +213,6 @@ class DBMigrationError(DbMigrationError):
super(DBMigrationError, self).__init__(message)
-debtcollector.removals.removed_class(DbMigrationError,
- replacement=DBMigrationError)
-
-
class DBConnectionError(DBError):
"""Wrapped connection specific exception.
@@ -250,13 +238,6 @@ class DBNotSupportedError(DBError):
class InvalidSortKey(Exception):
"""A sort key destined for database query usage is invalid."""
- @debtcollector.removals.removed_property
- def message(self):
- # NOTE(rpodolyaka): provided for compatibility with python 3k, where
- # exceptions do not have .message attribute, while we used to have one
- # in this particular exception class. See LP #1542961 for details.
- return str(self)
-
def __init__(self, key=None):
super(InvalidSortKey, self).__init__(
_("Sort key supplied is invalid: %s") % key)
diff --git a/oslo_db/sqlalchemy/test_base.py b/oslo_db/sqlalchemy/test_base.py
index 4c9c2c7..14e9d02 100644
--- a/oslo_db/sqlalchemy/test_base.py
+++ b/oslo_db/sqlalchemy/test_base.py
@@ -70,7 +70,7 @@ class DbFixture(fixtures.Fixture):
if not self.test._has_db_resource():
msg = self.test._get_db_resource_not_available_reason()
if self.test.SKIP_ON_UNAVAILABLE_DB:
- self.test.skip(msg)
+ self.test.skipTest(msg)
else:
self.test.fail(msg)
@@ -216,7 +216,7 @@ def backend_specific(*dialects):
'only on %s. Current engine is %s.')
args = (reflection.get_callable_name(f), ', '.join(dialects),
self.engine.name)
- self.skip(msg % args)
+ self.skipTest(msg % args)
else:
return f(self)
return ins_wrap
diff --git a/oslo_db/sqlalchemy/test_fixtures.py b/oslo_db/sqlalchemy/test_fixtures.py
index 57980ff..f3b5c1c 100644
--- a/oslo_db/sqlalchemy/test_fixtures.py
+++ b/oslo_db/sqlalchemy/test_fixtures.py
@@ -533,7 +533,7 @@ class OpportunisticDBTestMixin(object):
if not fixture._has_db_resource():
msg = fixture._get_db_resource_not_available_reason()
if self.SKIP_ON_UNAVAILABLE_DB:
- self.skip(msg)
+ self.skipTest(msg)
else:
self.fail(msg)
diff --git a/oslo_db/tests/sqlalchemy/test_async_eventlet.py b/oslo_db/tests/sqlalchemy/test_async_eventlet.py
index 34d1f32..7eebed4 100644
--- a/oslo_db/tests/sqlalchemy/test_async_eventlet.py
+++ b/oslo_db/tests/sqlalchemy/test_async_eventlet.py
@@ -77,7 +77,7 @@ class EventletTestMixin(object):
eventlet = importutils.try_import('eventlet')
if eventlet is None:
- return self.skip('eventlet is required for this test')
+ return self.skipTest('eventlet is required for this test')
a_ready = eventlet.event.Event()
a_proceed = eventlet.event.Event()
diff --git a/oslo_db/tests/sqlalchemy/test_exc_filters.py b/oslo_db/tests/sqlalchemy/test_exc_filters.py
index 93ad770..9c2b417 100644
--- a/oslo_db/tests/sqlalchemy/test_exc_filters.py
+++ b/oslo_db/tests/sqlalchemy/test_exc_filters.py
@@ -768,7 +768,7 @@ class TestDBDataErrorSQLite(_SQLAExceptionMatcher, test_base.DbTestCase):
super(TestDBDataErrorSQLite, self).setUp()
if six.PY3:
- self.skip("SQLite database supports unicode value for python3")
+ self.skipTest("SQLite database supports unicode value for python3")
meta = sqla.MetaData(bind=self.engine)
diff --git a/oslo_db/tests/sqlalchemy/test_fixtures.py b/oslo_db/tests/sqlalchemy/test_fixtures.py
index b769e20..df905e8 100644
--- a/oslo_db/tests/sqlalchemy/test_fixtures.py
+++ b/oslo_db/tests/sqlalchemy/test_fixtures.py
@@ -219,8 +219,8 @@ class LegacyBaseClassTest(oslo_test_base.BaseTestCase):
try:
provision.DatabaseResource(base_cls.FIXTURE.DRIVER)
except exception.BackendNotAvailable:
- self.skip("Backend %s is not available" %
- base_cls.FIXTURE.DRIVER)
+ self.skipTest("Backend %s is not available" %
+ base_cls.FIXTURE.DRIVER)
class SomeTest(base_cls):
def runTest(self):
diff --git a/oslo_db/tests/sqlalchemy/test_ndb.py b/oslo_db/tests/sqlalchemy/test_ndb.py
index 1d84f41..421befe 100644
--- a/oslo_db/tests/sqlalchemy/test_ndb.py
+++ b/oslo_db/tests/sqlalchemy/test_ndb.py
@@ -176,7 +176,7 @@ class NDBOpportunisticTestCase(
try:
self.test_table.create(self.engine)
except exception.DBNotSupportedError:
- self.skip("MySQL NDB Cluster not available")
+ self.skipTest("MySQL NDB Cluster not available")
def test_ndb_enabled(self):
self.init_db(True)
diff --git a/oslo_db/tests/sqlalchemy/test_provision.py b/oslo_db/tests/sqlalchemy/test_provision.py
index 8f931bd..8f0928f 100644
--- a/oslo_db/tests/sqlalchemy/test_provision.py
+++ b/oslo_db/tests/sqlalchemy/test_provision.py
@@ -176,7 +176,7 @@ class RetainSchemaTest(oslo_test_base.BaseTestCase):
database_resource = provision.DatabaseResource(
self.DRIVER, provision_new_database=True)
except exception.BackendNotAvailable:
- self.skip("database not available")
+ self.skipTest("database not available")
schema_resource = provision.SchemaResource(
database_resource, self._gen_schema)
@@ -244,7 +244,7 @@ class AdHocURLTest(oslo_test_base.BaseTestCase):
mysql_backend = provision.Backend.backend_for_database_type(
"mysql")
except exception.BackendNotAvailable:
- self.skip("mysql backend not available")
+ self.skipTest("mysql backend not available")
mysql_backend.create_named_database("adhoc_test")
self.addCleanup(
diff --git a/oslo_db/tests/sqlalchemy/test_utils.py b/oslo_db/tests/sqlalchemy/test_utils.py
index a380b09..b7f38ed 100644
--- a/oslo_db/tests/sqlalchemy/test_utils.py
+++ b/oslo_db/tests/sqlalchemy/test_utils.py
@@ -205,17 +205,11 @@ class TestPaginateQuery(test_base.BaseTestCase):
str(exception.InvalidSortKey()))
self.assertEqual("Sort key supplied is invalid: lol",
str(exception.InvalidSortKey("lol")))
- self.assertEqual("Sort key supplied is invalid: lol",
- exception.InvalidSortKey("lol").message)
def test_invalid_unicode_paramater_str(self):
self.assertEqual(
"Invalid Parameter: Encoding directive wasn't provided.",
str(exception.DBInvalidUnicodeParameter()))
- self.assertEqual(
- "Invalid Parameter: Encoding directive wasn't provided.",
- exception.DBInvalidUnicodeParameter().message
- )
def test_paginate_query_attribute_error(self):
sqlalchemy.asc(self.model.user_id).AndReturn('asc')
@@ -832,7 +826,19 @@ class TestMigrationUtils(db_test_base.DbTestCase):
table = Table(table_name, self.meta, autoload=True)
# NOTE(I159): if the CHECK constraint has been dropped (expected
# behavior), any integer value can be inserted, otherwise only 1 or 0.
- self.engine.execute(table.insert({'deleted': 10}))
+ # NOTE(zzzeek): SQLAlchemy 1.2 Boolean type will disallow non 1/0
+ # value here, 1.1 also coerces to "1/0" so use raw SQL to test the
+ # constraint
+ with self.engine.connect() as conn:
+ conn.execute(
+ "INSERT INTO abc (deleted) VALUES (?)",
+ (10, )
+ )
+
+ self.assertEqual(
+ 10,
+ conn.scalar("SELECT deleted FROM abc")
+ )
def test_get_foreign_key_constraint_name(self):
table_1 = Table('table_name_1', self.meta,
diff --git a/playbooks/legacy/oslo.db-tox-mysql-python/post.yaml b/playbooks/legacy/oslo.db-tox-mysql-python/post.yaml
new file mode 100644
index 0000000..68fbdf8
--- /dev/null
+++ b/playbooks/legacy/oslo.db-tox-mysql-python/post.yaml
@@ -0,0 +1,67 @@
+- hosts: primary
+ tasks:
+
+ - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
+ synchronize:
+ src: '{{ ansible_user_dir }}/workspace/'
+ dest: '{{ zuul.executor.log_root }}'
+ mode: pull
+ copy_links: true
+ verify_host: true
+ rsync_opts:
+ - --include=**/*nose_results.html
+ - --include=*/
+ - --exclude=*
+ - --prune-empty-dirs
+
+ - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
+ synchronize:
+ src: '{{ ansible_user_dir }}/workspace/'
+ dest: '{{ zuul.executor.log_root }}'
+ mode: pull
+ copy_links: true
+ verify_host: true
+ rsync_opts:
+ - --include=**/*testr_results.html.gz
+ - --include=*/
+ - --exclude=*
+ - --prune-empty-dirs
+
+ - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
+ synchronize:
+ src: '{{ ansible_user_dir }}/workspace/'
+ dest: '{{ zuul.executor.log_root }}'
+ mode: pull
+ copy_links: true
+ verify_host: true
+ rsync_opts:
+ - --include=/.testrepository/tmp*
+ - --include=*/
+ - --exclude=*
+ - --prune-empty-dirs
+
+ - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
+ synchronize:
+ src: '{{ ansible_user_dir }}/workspace/'
+ dest: '{{ zuul.executor.log_root }}'
+ mode: pull
+ copy_links: true
+ verify_host: true
+ rsync_opts:
+ - --include=**/*testrepository.subunit.gz
+ - --include=*/
+ - --exclude=*
+ - --prune-empty-dirs
+
+ - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
+ synchronize:
+ src: '{{ ansible_user_dir }}/workspace/'
+ dest: '{{ zuul.executor.log_root }}/tox'
+ mode: pull
+ copy_links: true
+ verify_host: true
+ rsync_opts:
+ - --include=/.tox/*/log/*
+ - --include=*/
+ - --exclude=*
+ - --prune-empty-dirs
diff --git a/playbooks/legacy/oslo.db-tox-mysql-python/run.yaml b/playbooks/legacy/oslo.db-tox-mysql-python/run.yaml
new file mode 100644
index 0000000..5bdd811
--- /dev/null
+++ b/playbooks/legacy/oslo.db-tox-mysql-python/run.yaml
@@ -0,0 +1,86 @@
+- hosts: all
+ name: Autoconverted job legacy-oslo.db-tox-mysql-python from old job gate-oslo.db-tox-mysql-python-ubuntu-xenial
+ tasks:
+
+ - name: Ensure legacy workspace directory
+ file:
+ path: '{{ ansible_user_dir }}/workspace'
+ state: directory
+
+ - shell:
+ cmd: |
+ set -e
+ set -x
+ CLONEMAP=`mktemp`
+ REQS_DIR=`mktemp -d`
+ function cleanup {
+ mkdir -p $WORKSPACE
+ rm -rf $CLONEMAP $REQS_DIR
+ }
+ trap cleanup EXIT
+ cat > $CLONEMAP << EOF
+ clonemap:
+ - name: $ZUUL_PROJECT
+ dest: .
+ EOF
+ # zuul cloner works poorly if there are 2 names that are the
+ # same in here.
+ if [[ "$ZUUL_PROJECT" != "openstack/requirements" ]]; then
+ cat >> $CLONEMAP << EOF
+ - name: openstack/requirements
+ dest: $REQS_DIR
+ EOF
+ fi
+ /usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \
+ git://git.openstack.org $ZUUL_PROJECT openstack/requirements
+ # REQS_DIR is not set for openstack/requirements and there is also
+ # no need to copy in this case.
+ if [[ "$ZUUL_PROJECT" != "openstack/requirements" ]]; then
+ cp $REQS_DIR/upper-constraints.txt ./
+ fi
+ executable: /bin/bash
+ chdir: '{{ ansible_user_dir }}/workspace'
+ environment: '{{ zuul | zuul_legacy_vars }}'
+
+ - shell:
+ cmd: /usr/local/jenkins/slave_scripts/install-distro-packages.sh
+ chdir: '{{ ansible_user_dir }}/workspace'
+ environment: '{{ zuul | zuul_legacy_vars }}'
+
+ - shell:
+ cmd: |
+ if [ -x tools/test-setup.sh ] ; then
+ tools/test-setup.sh
+ fi
+ chdir: '{{ ansible_user_dir }}/workspace'
+ environment: '{{ zuul | zuul_legacy_vars }}'
+
+ - shell:
+ cmd: |
+ set -x
+ sudo rm -f /etc/sudoers.d/zuul
+ # Prove that general sudo access is actually revoked
+ ! sudo -n true
+ executable: /bin/bash
+ chdir: '{{ ansible_user_dir }}/workspace'
+ environment: '{{ zuul | zuul_legacy_vars }}'
+
+ - shell:
+ cmd: /usr/local/jenkins/slave_scripts/run-tox.sh mysql-python
+ chdir: '{{ ansible_user_dir }}/workspace'
+ environment: '{{ zuul | zuul_legacy_vars }}'
+
+ - shell:
+ cmd: |
+ OUT=`git ls-files --other --exclude-standard --directory`
+ if [ -z "$OUT" ]; then
+ echo "No extra files created during test."
+ exit 0
+ else
+ echo "The following un-ignored files were created during the test:"
+ echo "$OUT"
+ exit 0 # TODO: change to 1 to fail tests.
+ fi
+ executable: /bin/bash
+ chdir: '{{ ansible_user_dir }}/workspace'
+ environment: '{{ zuul | zuul_legacy_vars }}'
diff --git a/requirements.txt b/requirements.txt
index 407b647..b3927c3 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -7,7 +7,7 @@ alembic>=0.8.10 # MIT
debtcollector>=1.2.0 # Apache-2.0
oslo.i18n>=3.15.3 # Apache-2.0
oslo.config>=4.6.0 # Apache-2.0
-oslo.utils>=3.28.0 # Apache-2.0
+oslo.utils>=3.31.0 # Apache-2.0
SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT
sqlalchemy-migrate>=0.11.0 # Apache-2.0
stevedore>=1.20.0 # Apache-2.0
diff --git a/setup.cfg b/setup.cfg
index 7d66101..f31489a 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -37,7 +37,7 @@ test =
sphinx>=1.6.2 # BSD
openstackdocstheme>=1.17.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0
- oslo.context>=2.14.0 # Apache-2.0
+ oslo.context>=2.19.2 # Apache-2.0
testrepository>=0.0.18 # Apache-2.0/BSD
testtools>=1.4.0 # MIT
os-testr>=1.0.0 # Apache-2.0