Wait for config rollout to complete in test_api_server

test_api_server was not waiting for rollout to finish
and that was causing issues in follow up tests randomly.
This patch adds an option to wait for rollout to finish
when setting service config.
It can be used in other tests wherever needed.

Resolves: https://issues.redhat.com/browse/OSPRH-14166
Change-Id: Iabafe97934ed2b5ed40f1c529d6f2ffddeac2797
This commit is contained in:
yatinkarel 2025-03-20 18:59:19 +05:30
parent 2b7e019fa5
commit 0bbc254c72
2 changed files with 14 additions and 2 deletions

View File

@ -397,6 +397,13 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
cls.OC, pod, os.path.split(
cls.neutron_conf)[0])).split('\n')
@classmethod
def wait_res_rollout(cls, res='deploy/neutron'):
res_wait = "{} rollout status {}".format(cls.OC, res)
rollout_status = cls.run_on_master_controller(res_wait)
LOG.debug("Rollout status:\n%s", rollout_status)
# TODO(mblue): next gen computes configuration set should be done too,
# 'oc patch' for data plane would need more steps and triggers deployment
@classmethod
@ -406,7 +413,8 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
file: str = '',
service: str = 'neutron',
config_list: list[ConfigOption] = None,
cfg_change: bool = True
cfg_change: bool = True,
wait_res: str = ''
) -> None:
"""Set configuration for service
@ -420,6 +428,7 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
:param cfg_change: by default, it is always expected that the
configuration will change; in a podified environment, that implies a
pod replacement.
:param wait_res: Resource to wait for rollout
"""
assert config_list, ("At least one configuration parameter must be "
"supplied")
@ -471,6 +480,8 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
# wait until old service pod is fully replaced
def _service_pod_replaced():
if wait_res:
cls.wait_res_rollout(res=wait_res)
_service_pods = cls.get_pods_of_service(
service=service,
pod_state='')

View File

@ -47,7 +47,8 @@ class NeutronAPIServerTest(wb_base.BaseTempestTestCaseOvn):
_config = wb_base.ConfigOption('ovn', 'fdb_age_threshold',
random.randint(10000, 90000))
self.set_service_setting(file=wb_utils.get_ml2_conf_file(),
config_list=[_config])
config_list=[_config],
wait_res='deploy/neutron')
# 3) Restart Neutron API on all controllers simultaneously.
if not WB_CONF.openstack_type == 'podified':