From 6c381d8e2018f27b23962df105aad8fccdec4c31 Mon Sep 17 00:00:00 2001 From: Miro Tomaska Date: Fri, 4 Oct 2024 14:13:38 -0400 Subject: [PATCH] Fix passing `section` argument into the `set_service_setting` `_set_rate_limiting_config` was attempting to pass `section` value by position but its position was off and the `service` argument was getting passed instead. This caused bad formatting in the crudini command and subsequent .conf file. This can be see in the tempest log [1] To prevent this from happening in the future. I am passing arguments by their names. I also put the metada_rate_limiting string literal into a constant to keep the code DRY. [1] https://paste.opendev.org/show/btVjyzKuNaiI8UC1NC9M/ Related: https://issues.redhat.com/browse/OSPRH-9569 Change-Id: Ic73def44d03fb28b5975c1d96a471e0463d01740 --- .../tests/scenario/test_metadata_rate_limiting.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/whitebox_neutron_tempest_plugin/tests/scenario/test_metadata_rate_limiting.py b/whitebox_neutron_tempest_plugin/tests/scenario/test_metadata_rate_limiting.py index 6b750d8..7ffc972 100644 --- a/whitebox_neutron_tempest_plugin/tests/scenario/test_metadata_rate_limiting.py +++ b/whitebox_neutron_tempest_plugin/tests/scenario/test_metadata_rate_limiting.py @@ -27,6 +27,7 @@ from whitebox_neutron_tempest_plugin.tests.scenario import base as wb_base CONF = config.CONF WB_CONF = CONF.whitebox_neutron_plugin_options LOG = log.getLogger(__name__) +METADATA_RATE_LIMITING_SECTION = 'metadata_rate_limiting' class TestMetadataRateLimiting(wb_base.BaseTempestWhiteboxTestCase): @@ -93,14 +94,15 @@ class TestMetadataRateLimiting(wb_base.BaseTempestWhiteboxTestCase): LOG.debug( 'Setting metadata rate limiting configuration:\n' f'File - {cls.metadata_conf_file}\n' - 'Section - metadata_rate_limiting\n' + f'Section - {METADATA_RATE_LIMITING_SECTION}\n' f'Parameter - {key}\n' f'Value - {value}\n') cls.set_service_setting( - 'compute', - cls.metadata_conf_file, - 'metadata_rate_limiting', - key, value) + node_type='compute', + file=cls.metadata_conf_file, + section=METADATA_RATE_LIMITING_SECTION, + param=key, + value=value) cls._restart_metadata_agent() def tearDown(self): @@ -121,7 +123,7 @@ class TestMetadataRateLimiting(wb_base.BaseTempestWhiteboxTestCase): cls.run_group_cmd( 'sudo crudini --del {} {} && sudo sync'.format( cls.metadata_conf_file, - 'metadata_rate_limiting'), + METADATA_RATE_LIMITING_SECTION), 'compute') @classmethod