Tests: Fix RBD invalid UUID warnings

This causes a warning to be issued for every RBD test.

Modify fake_volume_obj() to prevent this.

Change-Id: Ib2fff5af7ae7dc8663b15832e39080fe0a51e71d
This commit is contained in:
Eric Harney 2018-01-25 15:23:18 -05:00
parent 976415fbdd
commit d5a9920ba1
2 changed files with 5 additions and 1 deletions

View File

@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_utils.uuidutils import is_uuid_like
from oslo_versionedobjects import fields
from cinder import objects
@ -102,6 +103,9 @@ def fake_db_volume_attachment(**updates):
def fake_volume_obj(context, **updates):
if updates.get('encryption_key_id'):
assert is_uuid_like(updates['encryption_key_id'])
expected_attrs = updates.pop('expected_attrs',
['metadata', 'admin_metadata'])
vol = objects.Volume._from_db_object(context, objects.Volume(),

View File

@ -197,7 +197,7 @@ class RBDTestCase(test.TestCase):
**{'name': u'volume-0000000a',
'id': '55555555-222f-4b32-b585-9991b3bf0a99',
'size': 12,
'encryption_key_id': 'set_in_test'})
'encryption_key_id': fake.ENCRYPTION_KEY_ID})
self.snapshot = fake_snapshot.fake_snapshot_obj(
self.context, name='snapshot-0000000a')