Skip to content

Commit

Permalink
Fix volume unit test
Browse files Browse the repository at this point in the history
The update to sqlalchemy 1.3.13 revealed a problem with a unit
test that was not using the correct method to access data.

Closes-bug: #1860817

Change-Id: I8f0b25d12046f5d91a0e5bc38ae9eb9c416b1ba3
  • Loading branch information
ostackbrian committed Feb 4, 2020
1 parent 819b4a0 commit fe3b8ff
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cinder/tests/unit/volume/test_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -2781,10 +2781,17 @@ def fake_create_cloned_volume(volume, src_vref):
self.assertEqual('available',
db.volume_get(context.get_admin_context(),
volume_dst['id']).status)
src_glancemeta = db.volume_get(context.get_admin_context(),
volume_src['id']).volume_glance_metadata
dst_glancemeta = db.volume_get(context.get_admin_context(),
volume_dst['id']).volume_glance_metadata

# TODO: review all tests in this file to make sure they are
# using the defined db.api to access stuff rather than taking
# shortcuts like the following (see LP Bug #1860817):
# src_glancemeta = db.volume_get(context.get_admin_context(),
# volume_src['id']).volume_glance_metadata

src_glancemeta = db.volume_glance_metadata_get(
context.get_admin_context(), volume_src['id'])
dst_glancemeta = db.volume_glance_metadata_get(
context.get_admin_context(), volume_dst['id'])
for meta_src in src_glancemeta:
for meta_dst in dst_glancemeta:
if meta_dst.key == meta_src.key:
Expand Down

0 comments on commit fe3b8ff

Please sign in to comment.