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
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user