From b259c20115d2126f98ea11354600f0b401423a14 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Mon, 30 Sep 2024 13:21:46 +0000 Subject: [PATCH] Make ``set_service_setting`` resilient to a no config change Added a new parameter to ``set_service_setting``: ``cfg_change``. This flag is True by default. In a podified environment, if the flag is disabled and the config set does not modify the current one, the method won't expected the pod to be replaced. Closes-Bug: #OSPRH-10452 Change-Id: I1361ba4bcd9e755547394e823b134d615a2240b2 --- .../tests/scenario/base.py | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/whitebox_neutron_tempest_plugin/tests/scenario/base.py b/whitebox_neutron_tempest_plugin/tests/scenario/base.py index b73f6e8..3f89b5b 100644 --- a/whitebox_neutron_tempest_plugin/tests/scenario/base.py +++ b/whitebox_neutron_tempest_plugin/tests/scenario/base.py @@ -19,6 +19,7 @@ import os import random import re import time +import typing import yaml import netaddr @@ -397,18 +398,23 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase): # TODO(mblue): next gen computes configuration set should be done too, # 'oc patch' for data plane would need more steps and triggers deployment @classmethod - def set_service_setting(cls, node_type='controller', - file='', service='neutron', - section='DEFAULT', param='', value=''): + def set_service_setting(cls, node_type: str = 'controller', + file: str = '', service: str = 'neutron', + section: str = 'DEFAULT', param: str = '', + value: typing.Union[str, int] = '', + cfg_change: bool = True) -> None: """Set configuration for service - :param node_type(str): Node type for change, ex: controller/compute + :param node_type: Node type for change, ex: controller/compute (currently only controllers). - :param file(str): File for configuration change (except in podified). - :param service(str): Podified service name (only podified). - :param section(str): Section in the config file. - :param param(str): Parameter in section to change. - :param value(str): Value to set. + :param file: File for configuration change (except in podified). + :param service: Podified service name (only podified). + :param section: Section in the config file. + :param param: Parameter in section to change. + :param value: Value to set. + :param cfg_change: by default, it is always expected that the + configuration will change; in a podified environment, that implies a + pod replacement. """ assert param, "'param' must be supplied" if WB_CONF.openstack_type == 'podified' and node_type != 'compute': @@ -444,6 +450,10 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase): LOG.debug("Set configuration command:\n%s", cmd) output = cls.proxy_host_client.exec_command(cmd) LOG.debug("Output:\n%s", output) + if not cfg_change and '(no change)' in output: + # No config change done, no pod replacement. + return + # TODO(mblue): Add another check using network agent list # status with neutron api (as was in downstream code).