Fix warning on {'cell_id': 1} is an invalid UUID
The functional test mock assume args[-1] always be instance_uuid but actually it's not, when _save_db it might contains some changes on the instance_mapping. some test functions were reused in order to avoid display warning. Change-Id: I90afca7f426f5c9fd14051df6fb0a8b45cd0833d Closes-Bug: 1718325
This commit is contained in:
parent
069e5ec67c
commit
8af7765236
@ -298,7 +298,7 @@ class SingleCellSimple(fixtures.Fixture):
|
||||
self._fake_instancemapping_get_uuids))
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
'nova.objects.InstanceMapping._save_in_db',
|
||||
self._fake_instancemapping_get))
|
||||
self._fake_instancemapping_get_save))
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
'nova.context.target_cell',
|
||||
self._fake_target_cell))
|
||||
@ -313,18 +313,24 @@ class SingleCellSimple(fixtures.Fixture):
|
||||
'host': 'host1',
|
||||
'cell_mapping': self._fake_cell_list()[0]}
|
||||
|
||||
def _fake_instancemapping_get(self, *args):
|
||||
def _fake_instancemapping_get_common(self, instance_uuid):
|
||||
return {
|
||||
'id': 1,
|
||||
'updated_at': None,
|
||||
'created_at': None,
|
||||
'instance_uuid': args[-1],
|
||||
'instance_uuid': instance_uuid,
|
||||
'cell_id': (self.instances_created and 1 or None),
|
||||
'project_id': 'project',
|
||||
'cell_mapping': (
|
||||
self.instances_created and self._fake_cell_get() or None),
|
||||
}
|
||||
|
||||
def _fake_instancemapping_get_save(self, *args):
|
||||
return self._fake_instancemapping_get_common(args[-2])
|
||||
|
||||
def _fake_instancemapping_get(self, *args):
|
||||
return self._fake_instancemapping_get_common(args[-1])
|
||||
|
||||
def _fake_instancemapping_get_uuids(self, *args):
|
||||
return [self._fake_instancemapping_get(uuid)
|
||||
for uuid in args[-1]]
|
||||
|
Loading…
x
Reference in New Issue
Block a user