From 0c20743cb38d71df78feda6847fee9409be218fa Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Mon, 14 May 2018 13:12:44 +0200 Subject: [PATCH] Suppress UUID warning in map_instance unit tests nova-manage cells_v2 map_instances call uses a non canonical UUID serialization to store the instance marker in the DB. The oslo.versionedobjects UUIDField emits a warning. A later patch would like to turn this warning to an error during the unit and functional test to avoid adding new violations. As the underlying DB schema is not violated this patch proposes to suppress the warning in the affected unit tests. Change-Id: I5b11b9df26e4e38516b5674e0e6c1fc79527129b --- nova/tests/unit/test_nova_manage.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nova/tests/unit/test_nova_manage.py b/nova/tests/unit/test_nova_manage.py index 7187a0a33a..a4ce36983f 100644 --- a/nova/tests/unit/test_nova_manage.py +++ b/nova/tests/unit/test_nova_manage.py @@ -15,6 +15,7 @@ import datetime import sys +import warnings import ddt import fixtures @@ -1226,6 +1227,10 @@ class CellV2CommandsTestCase(test.NoDBTestCase): @mock.patch.object(context, 'target_cell') def test_map_instances_max_count(self, mock_target_cell): + # NOTE(gibi): map_instances command uses non canonical UUID + # serialization for the marker instance mapping. The db schema is not + # violated so we suppress the warning here. + warnings.filterwarnings('ignore', message=".*invalid UUID.*") ctxt = context.RequestContext('fake-user', 'fake_project') cell_uuid = uuidutils.generate_uuid() cell_mapping = objects.CellMapping( @@ -1259,6 +1264,10 @@ class CellV2CommandsTestCase(test.NoDBTestCase): @mock.patch.object(context, 'target_cell') def test_map_instances_marker_deleted(self, mock_target_cell): + # NOTE(gibi): map_instances command uses non canonical UUID + # serialization for the marker instance mapping. The db schema is not + # violated so we suppress the warning here. + warnings.filterwarnings('ignore', message=".*invalid UUID.*") ctxt = context.RequestContext('fake-user', 'fake_project') cell_uuid = uuidutils.generate_uuid() cell_mapping = objects.CellMapping( @@ -1297,6 +1306,10 @@ class CellV2CommandsTestCase(test.NoDBTestCase): @mock.patch.object(context, 'target_cell') def test_map_instances_marker_reset(self, mock_target_cell): + # NOTE(gibi): map_instances command uses non canonical UUID + # serialization for the marker instance mapping. The db schema is not + # violated so we suppress the warning here. + warnings.filterwarnings('ignore', message=".*invalid UUID.*") ctxt = context.RequestContext('fake-user', 'fake_project') cell_uuid = uuidutils.generate_uuid() cell_mapping = objects.CellMapping(