Fix nullable data_plane_status reference in port OVO
data_plane_status is nullable so it might not be present in the primitive. This adjusts the pop call to handle that and adds a somewhat generic test to prevent a regression. Change-Id: I1ffcd91fae2a06611a5b163033319081f96f211d
This commit is contained in:
parent
7f5a9ae22c
commit
5ffd65135d
|
@ -385,4 +385,4 @@ class Port(base.NeutronDbObject):
|
|||
_target_version = versionutils.convert_version_to_tuple(target_version)
|
||||
|
||||
if _target_version < (1, 1):
|
||||
primitive.pop('data_plane_status')
|
||||
primitive.pop('data_plane_status', None)
|
||||
|
|
|
@ -24,6 +24,7 @@ from oslo_db import exception as obj_exc
|
|||
from oslo_db.sqlalchemy import utils as db_utils
|
||||
from oslo_utils import uuidutils
|
||||
from oslo_versionedobjects import base as obj_base
|
||||
from oslo_versionedobjects import exception
|
||||
from oslo_versionedobjects import fields as obj_fields
|
||||
from oslo_versionedobjects import fixture
|
||||
import testtools
|
||||
|
@ -1417,6 +1418,14 @@ class BaseDbObjectTestCase(_BaseObjectTestCase,
|
|||
**remove_timestamps_from_fields(
|
||||
fields, self._test_class.fields))
|
||||
|
||||
def test_downgrade_to_1_0(self):
|
||||
for obj in self.objs:
|
||||
try:
|
||||
obj.obj_to_primitive(target_version='1.0')
|
||||
except exception.IncompatibleObjectVersion:
|
||||
# the only exception we should allow is IncompatibleVersion
|
||||
pass
|
||||
|
||||
def test_get_object_create_update_delete(self):
|
||||
# Timestamps can't be initialized and multiple objects may use standard
|
||||
# attributes so we need to remove timestamps when creating objects
|
||||
|
|
Loading…
Reference in New Issue