From e562dd19ebb04305428bb3edee3e0841b4d4324f Mon Sep 17 00:00:00 2001 From: Jan Gutter Date: Wed, 16 Jan 2019 11:36:57 +0200 Subject: [PATCH] Apply workaround to host_info serialization test Random failures started appearing in the gate with the following pattern: testtools.matchers._impl.MismatchError: !=: reference = HostInfo(plugin_info=[HostPluginInfo,HostPluginInfo]) actual = HostInfo(plugin_info=[HostPluginInfo,HostPluginInfo]) This change attempts to work around the issue by adopting the same workaround as implemented in the VIF tests. Note that the host_info class is currently largely stub code for an unimplemented negotiation interface. Change-Id: I1fff71ec6793e009cbee9da0656b77915591dec4 Signed-off-by: Jan Gutter --- os_vif/tests/unit/test_host_info.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/os_vif/tests/unit/test_host_info.py b/os_vif/tests/unit/test_host_info.py index b6aa7b0c..b2d45048 100644 --- a/os_vif/tests/unit/test_host_info.py +++ b/os_vif/tests/unit/test_host_info.py @@ -56,11 +56,26 @@ class TestHostInfo(base.TestCase): ), ]) ]) + # https://bugs.launchpad.net/oslo.versionedobjects/+bug/1563787 + self.host_info.obj_reset_changes(recursive=True) def test_serialization(self): json = self.host_info.obj_to_primitive() + self.assertEqual("os_vif", json["versioned_object.namespace"]) host_info = objects.host_info.HostInfo.obj_from_primitive(json) + # Copied from test_vif.py: + # + # The __eq__ function works by using obj_to_primitive() + # and this includes a list of changed fields. Very + # occassionally the ordering of the list of changes + # varies, causing bogus equality failures. This is + # arguably a bug in oslo.versionedobjects since the + # set of changes fields should not affect equality + # comparisons. Remove this hack once this is fixed: + # + # https://bugs.launchpad.net/oslo.versionedobjects/+bug/1563787 + host_info.obj_reset_changes(recursive=True) self.assertEqual(self.host_info, host_info)