From d5e21c17b28cb063d3ab4005bfde973c1321107b Mon Sep 17 00:00:00 2001 From: Frode Nordahl Date: Tue, 19 Mar 2024 16:12:03 +0100 Subject: [PATCH] Fix BFD functional test, avoid comparing status column The status column is updated by OVN so we cannot rely on its contents being stable. The test already attempts to address this by using frozen rows, but that does not fully solve the issue as objects are created at different points in time and then compared, which may give unpredictable results. Filter out the `status` column from the affected tests. Closes-Bug: #2058264 Change-Id: Ibaa54d93109434b445f54de583f534021defccbb Signed-off-by: Frode Nordahl --- .../schema/ovn_northbound/test_impl_idl.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/ovsdbapp/tests/functional/schema/ovn_northbound/test_impl_idl.py b/ovsdbapp/tests/functional/schema/ovn_northbound/test_impl_idl.py index 8d2dcee8..3699d79e 100644 --- a/ovsdbapp/tests/functional/schema/ovn_northbound/test_impl_idl.py +++ b/ovsdbapp/tests/functional/schema/ovn_northbound/test_impl_idl.py @@ -12,6 +12,7 @@ import netaddr import testscenarios +import types import uuid from ovsdbapp.backend.ovs_idl import idlutils @@ -2542,6 +2543,13 @@ class TestBFDOps(OvnNorthboundTest): super(TestBFDOps, self).setUp() self.table = self.api.tables['BFD'] + @staticmethod + def _freeze_and_filter_row(row, filter_columns): + return types.SimpleNamespace( + **{k: v + for k, v in idlutils.frozen_row(row)._asdict().items() + if k not in filter_columns}) + def _bfd_add(self, *args, **kwargs): cmd = self.api.bfd_add(*args, **kwargs) row = cmd.execute(check_error=True) @@ -2555,7 +2563,7 @@ class TestBFDOps(OvnNorthboundTest): 'detect_mult'] else [], row.detect_mult) self.assertEqual(cmd.columns['external_ids'] or {}, row.external_ids) self.assertEqual(cmd.columns['options'] or {}, row.options) - return idlutils.frozen_row(row) + return self._freeze_and_filter_row(row, ('status',)) def test_bfd_add(self): name = utils.get_rand_name() @@ -2633,8 +2641,12 @@ class TestBFDOps(OvnNorthboundTest): def test_bfd_get(self): name = utils.get_rand_name() - b1 = self.api.bfd_add(name, name).execute(check_error=True) - b2 = self.api.bfd_get(b1.uuid).execute(check_error=True) + b1 = self._freeze_and_filter_row( + self.api.bfd_add(name, name).execute(check_error=True), + ('status',)) + b2 = self._freeze_and_filter_row( + self.api.bfd_get(b1.uuid).execute(check_error=True), + ('status',)) self.assertEqual(b1, b2)