From 0a2384f320a9df97bc397cd5369c59a0eee8bf2d Mon Sep 17 00:00:00 2001 From: Tom Barron Date: Thu, 24 Mar 2016 16:57:28 -0400 Subject: [PATCH] Fix fake uuids in NetApp ESeries unit tests Several values in the ESeries unit test fakes file were invalid uuids, so we see oslo_versioned_objects FutureWarnings[1] when running these tests. This commit uses values from cinder/tests/unit/fake_constants.py to resolve this issue. [1] http://docs.openstack.org/developer/oslo.versionedobjects/api/fields.html#oslo_versionedobjects.fields.UUIDField Change-Id: I3b73408aa7e1bd401dd0222d6e23819fad820e41 --- .../volume/drivers/netapp/eseries/fakes.py | 41 +++++-------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/cinder/tests/unit/volume/drivers/netapp/eseries/fakes.py b/cinder/tests/unit/volume/drivers/netapp/eseries/fakes.py index 7a8ff129d5d..b98635fac16 100644 --- a/cinder/tests/unit/volume/drivers/netapp/eseries/fakes.py +++ b/cinder/tests/unit/volume/drivers/netapp/eseries/fakes.py @@ -21,21 +21,22 @@ import json import mock +from cinder.tests.unit import fake_constants as fake from cinder.volume import configuration as conf from cinder.volume.drivers.netapp.eseries import utils import cinder.volume.drivers.netapp.options as na_opts import cinder.volume.drivers.netapp.utils as na_utils FAKE_CINDER_VOLUME = { - 'id': '114774fb-e15a-4fae-8ee2-c9723e3645ef', + 'id': fake.volume_id, 'size': 1, 'volume_name': 'lun1', 'host': 'hostname@backend#DDP', 'os_type': 'linux', 'provider_location': 'lun1', - 'name_id': '114774fb-e15a-4fae-8ee2-c9723e3645ef', + 'name_id': fake.volume2_id, 'provider_auth': 'provider a b', - 'project_id': 'project', + 'project_id': fake.project_id, 'display_name': None, 'display_description': 'lun1', 'volume_type_id': None, @@ -44,16 +45,17 @@ FAKE_CINDER_VOLUME = { } FAKE_CINDER_SNAPSHOT = { - 'id': '78f95b9d-3f02-4781-a512-1a1c921d48a1', - 'volume': FAKE_CINDER_VOLUME + 'id': fake.snapshot_id, + 'volume': FAKE_CINDER_VOLUME, + 'provider_id': '3400000060080E500023BB3400631F335294A5A8', } FAKE_CINDER_CG = { - 'id': '78f95b9d-3f02-4781-a512-1a1c951d48a2', + 'id': fake.consistency_group_id, } FAKE_CINDER_CG_SNAPSHOT = { - 'id': '78f95b9d-4d13-4781-a512-1a1c951d6a6', + 'id': fake.cgsnapshot_id, 'consistencygroup_id': FAKE_CINDER_CG['id'], } @@ -691,7 +693,7 @@ SNAPSHOT_GROUP = { } SNAPSHOT_IMAGE = { - 'id': '3400000060080E500023BB3400631F335294A5A8', + 'id': fake.snapshot_id, 'baseVol': '0200000060080E500023C734000009825294A534', 'status': 'optimal', 'pitCapacity': '2147483648', @@ -761,29 +763,6 @@ FAKE_BACKEND_STORE = { 'value': '{"3300000060080E50003416400000E90D56B047E5":"2"}' } -FAKE_CINDER_VOLUME = { - 'id': '114774fb-e15a-4fae-8ee2-c9723e3645ef', - 'size': 1, - 'volume_name': 'lun1', - 'host': 'hostname@backend#DDP', - 'os_type': 'linux', - 'provider_location': 'lun1', - 'name_id': '114774fb-e15a-4fae-8ee2-c9723e3645ef', - 'provider_auth': 'provider a b', - 'project_id': 'project', - 'display_name': None, - 'display_description': 'lun1', - 'volume_type_id': None, - 'migration_status': None, - 'attach_status': "detached" -} - -FAKE_CINDER_SNAPSHOT = { - 'id': '78f95b9d-3f02-4781-a512-1a1c921d48a1', - 'volume': FAKE_CINDER_VOLUME, - 'provider_id': '3400000060080E500023BB3400631F335294A5A8' -} - HARDWARE_INVENTORY_SINGLE_CONTROLLER = { 'controllers': [ {