From 2df01e88450ab99eec204c6e2e8ef8681610c496 Mon Sep 17 00:00:00 2001 From: Sean Mooney Date: Tue, 19 Nov 2024 13:24:30 +0000 Subject: [PATCH] address test stablity under load vif_plug_ovs.tests.functional.ovsdb.test_ovsdb_lib.TestOVSDBLib.test_create_ovs_vif_port_with_default_qos(native) can fail under load as the ovs-db requires the ovsvswitchd to acknowlage the requested configution before the db tansaction is complete. currently os-vif works around this using a wait_until_true retry loop with a hardcoded 2 second timeout. This change bumps the default timeout to 10 seconds and make it configurable via a new env var. OS_VIF_CHECK_PARAMETER_TIMEOUT this should stablise the test under load such as in ci and allow the timeout to be turned via ci jobs if requried. note 10 seconds is already over kill so if we see instablity after this change we likely shoudl reduce concurrency instead. Related-Bug: #2087982 Change-Id: Icd0b69a7f3a121fbe4fe2b754c1fc1d993d2a741 --- tox.ini | 2 ++ vif_plug_ovs/tests/functional/base.py | 9 ++++++++- vif_plug_ovs/tests/functional/ovsdb/test_ovsdb_lib.py | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index d4a209bc..d63a5b63 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,8 @@ envlist = py3,pep8,docs,releasenotes,cover [testenv] usedevelop = True setenv = +passenv = + OS_VIF_CHECK_PARAMETER_TIMEOUT deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/requirements.txt diff --git a/vif_plug_ovs/tests/functional/base.py b/vif_plug_ovs/tests/functional/base.py index 59eb5415..4ad5f360 100644 --- a/vif_plug_ovs/tests/functional/base.py +++ b/vif_plug_ovs/tests/functional/base.py @@ -9,6 +9,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +import functools +import os from os_vif.tests.functional import base as os_vif_base @@ -28,6 +30,10 @@ class VifPlugOvsBaseFunctionalTestCase(os_vif_base.BaseFunctionalTestCase): def _check_port(self, name, bridge): return self.ovs.port_exists(name, bridge) + @functools.cache + def _get_timeout(self): + return int(os.environ.get('OS_VIF_CHECK_PARAMETER_TIMEOUT', '10')) + def _check_parameter(self, table, port, parameter, expected_value): def get_value(): return self._ovsdb.db_get(table, port, parameter).execute() @@ -36,7 +42,8 @@ class VifPlugOvsBaseFunctionalTestCase(os_vif_base.BaseFunctionalTestCase): val = get_value() return val == expected_value self.assertTrue( - wait_until_true(check_value, timeout=2, sleep=0.5), + wait_until_true( + check_value, timeout=self._get_timeout(), sleep=0.5), f"Parameter {parameter} of {table} {port} is {get_value()} " f"not {expected_value}" ) diff --git a/vif_plug_ovs/tests/functional/ovsdb/test_ovsdb_lib.py b/vif_plug_ovs/tests/functional/ovsdb/test_ovsdb_lib.py index 5b8d8b3d..ab10ca5e 100644 --- a/vif_plug_ovs/tests/functional/ovsdb/test_ovsdb_lib.py +++ b/vif_plug_ovs/tests/functional/ovsdb/test_ovsdb_lib.py @@ -183,6 +183,11 @@ class TestOVSDBLib(testscenarios.WithScenarios, 'Interface', port_bridge_port, 'options', port_opts) def test_create_ovs_vif_port_with_default_qos(self): + if self.interface == 'native': + self.skipTest( + 'test_create_ovs_vif_port_with_default_qos is unstable ' + 'when run with the native driver, see: ' + 'https://bugs.launchpad.net/os-vif/+bug/2087982') port_name = 'qos-port-' + self.interface iface_id = 'iface_id' mac = 'ca:fe:ca:fe:ca:fe'