tests: Replace invalid UUIDs

Fix the warnings that oslo.versionedobjects has been emitting for years
now.

Change-Id: I53bd78d8b70f276d2ea8569f0ab1e7ce04f52fea
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2022-09-07 23:54:10 +01:00
parent 00aadf570b
commit 7083545731
3 changed files with 13 additions and 6 deletions

View File

@ -102,6 +102,11 @@ class WarningsFixture(fixtures.Fixture):
category=UserWarning,
)
# NOTE(gibi): The UUIDFields emits a warning if the value is not a
# valid UUID. Let's escalate that to an exception in the test to
# prevent adding violations.
warnings.filterwarnings('error', message='.* is an invalid UUID.')
# Enable deprecation warnings to capture upcoming SQLAlchemy changes
warnings.filterwarnings(

View File

@ -5089,7 +5089,8 @@ class ManagerDoSyncPowerStateTestCase(db_base.DbTestCase):
self.power = self.driver.power
self.node = obj_utils.create_test_node(
self.context, driver='fake-hardware', maintenance=False,
provision_state=states.AVAILABLE, instance_uuid=uuidutils.uuid)
provision_state=states.AVAILABLE,
instance_uuid=uuidutils.generate_uuid())
self.task = mock.Mock(spec_set=['context', 'driver', 'node',
'upgrade_lock', 'shared'])
self.task.context = self.context

View File

@ -243,11 +243,12 @@ class NodePowerActionTestCase(db_base.DbTestCase):
self.config(host='my-host')
# Required for exception handling
mock_notif.__name__ = 'NodeSetPowerStateNotification'
node = obj_utils.create_test_node(self.context,
uuid=uuidutils.generate_uuid(),
driver='fake-hardware',
instance_uuid=uuidutils.uuid,
power_state=states.POWER_OFF)
node = obj_utils.create_test_node(
self.context,
uuid=uuidutils.generate_uuid(),
driver='fake-hardware',
instance_uuid=uuidutils.generate_uuid(),
power_state=states.POWER_OFF)
task = task_manager.TaskManager(self.context, node.uuid)
get_power_mock.return_value = states.POWER_OFF