diff --git a/manila/tests/db/sqlalchemy/test_api.py b/manila/tests/db/sqlalchemy/test_api.py index 1cb1c7d944..fa990faa30 100644 --- a/manila/tests/db/sqlalchemy/test_api.py +++ b/manila/tests/db/sqlalchemy/test_api.py @@ -1997,13 +1997,37 @@ class ShareSnapshotDatabaseAPITestCase(test.TestCase): def test_share_snapshot_instance_access_get_all(self): access = db_utils.create_snapshot_access( share_snapshot_id=self.snapshot_1['id']) - values = {'share_snapshot_instance_id': self.snapshot_instances[0].id, - 'access_id': access['id']} - rules = db_api.share_snapshot_instance_access_get_all( - self.ctxt, access['id']) + # NOTE(zzzeek) the create_snapshot_access routine iterates through the + # ShareSnapshot.instances collection and creates a new + # ShareSnapshotInstanceAccessMapping for each ShareSnapshotInstance. + # however, this collection is unordered and does not have any guarantee + # that its ordering would match that of our self.snapshot_instances + # collection. Therefore key the fixture values and the resulting + # ShareSnapshotInstanceAccessMapping objects by share_snapshot_id + # and compare individually. - self.assertSubDictMatch(values, rules[0].to_dict()) + values_by_sid = { + snapshot_instance.id: { + 'share_snapshot_instance_id': snapshot_instance.id, + 'access_id': access['id'] + } + for snapshot_instance in self.snapshot_instances + if "fake" not in snapshot_instance.id + } + + rules_by_sid = { + rule.share_snapshot_instance_id: rule + for rule in db_api.share_snapshot_instance_access_get_all( + self.ctxt, access['id'] + ) + } + + for sid in values_by_sid: + self.assertSubDictMatch( + values_by_sid[sid], + rules_by_sid[sid].to_dict() + ) def test_share_snapshot_access_get(self): access = db_utils.create_snapshot_access( diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index ca61ccd2dd..95bd89b37f 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -10,6 +10,7 @@ queue: manila check: jobs: + - manila-tox-py311-with-sqlalchemy-2x - manila-tox-genconfig - openstack-tox-pylint: voting: false @@ -30,9 +31,26 @@ voting: false gate: jobs: + - manila-tox-py311-with-sqlalchemy-2x - manila-tempest-plugin-dummy-no-dhss - manila-tempest-plugin-dummy-dhss +# Temporary job until SQLAlchemy 2.0 is no longer blocked by upper-requirements +- job: + name: manila-tox-py311-with-sqlalchemy-2x + parent: openstack-tox-py311 + description: | + Run unit tests with main branch of SQLAlchemy, alembic and oslo.db. + Takes advantage of the base tox job's install-siblings feature. + # The job only tests the latest and shouldn't be run on the stable branches + branches: master + required-projects: + - name: github.com/sqlalchemy/sqlalchemy + override-checkout: main + - name: github.com/sqlalchemy/alembic + override-checkout: main + - name: openstack/oslo.db + - job: name: manila-tox-genconfig parent: openstack-tox