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
This commit is contained in:
Sean Mooney 2024-11-19 13:24:30 +00:00
parent 5ff850db2b
commit 2df01e8845
3 changed files with 15 additions and 1 deletions

View File

@ -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

View File

@ -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}"
)

View File

@ -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'