Fix compute configuration podified, and related tests
This allows metadata rate limiting tests to run fully, yet they will be skipped until feature code will be inserted to RHOSO. The ini filename/location from which configuration pulled and applied changed in RHOSO, now used instead of 'oc patch' for edpm nodes. Also service existence check fixed, pointed to strip method instead of calling it, which mistakenly interpreted as true, so later code included crc node as node to restart metadata service, results in failure of test. In metadata rate limiting tests redundant code removed, and made configuration setting restart service in minimal amounts. Change-Id: I2b44e2dbf97f87b8fd9b5feee49a634300367218
This commit is contained in:
parent
fefb4e1292
commit
161db4c63c
whitebox_neutron_tempest_plugin/tests/scenario
zuul.d
@ -405,11 +405,7 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
|
||||
:param value(str): Value to set.
|
||||
"""
|
||||
assert param, "'param' must be supplied"
|
||||
if WB_CONF.openstack_type == 'podified':
|
||||
if node_type == 'compute':
|
||||
raise cls.skipException(
|
||||
"Setting computes configuration not supported yet on "
|
||||
"podified setups (TODO).")
|
||||
if WB_CONF.openstack_type == 'podified' and node_type != 'compute':
|
||||
service_pod = cls.get_pods_of_service(service)[0]
|
||||
# TODO(mblue): process ini in python instead of crudini command,
|
||||
# without depending on hardcoded conf filenames, crudini bin in pod
|
||||
@ -542,7 +538,7 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
|
||||
service_regex, host_ip)
|
||||
catch = ssh_client.exec_command(
|
||||
"systemctl --type=service | grep '{}'; true".format(
|
||||
service_regex)).strip
|
||||
service_regex)).strip()
|
||||
if catch:
|
||||
LOG.debug("Service found on host '%s':\n%s",
|
||||
host_ip, catch)
|
||||
|
@ -49,7 +49,10 @@ class TestMetadataRateLimiting(wb_base.BaseTempestWhiteboxTestCase):
|
||||
cls.metadata_conf_file = (
|
||||
'/etc/neutron/neutron_ovn_metadata_agent.ini')
|
||||
else:
|
||||
cls.metadata_conf_file = cls.neutron_conf
|
||||
cls.metadata_conf_file = (
|
||||
'/var/lib/config-data/ansible-generated/'
|
||||
'neutron-ovn-metadata-agent/'
|
||||
'01-neutron-ovn-metadata-agent.conf')
|
||||
# OSP resources
|
||||
cls.rand_name = data_utils.rand_name(
|
||||
cls.__name__.rsplit('.', 1)[-1])
|
||||
@ -58,11 +61,6 @@ class TestMetadataRateLimiting(wb_base.BaseTempestWhiteboxTestCase):
|
||||
name=data_utils.rand_name('secgroup'))
|
||||
cls.create_loginable_secgroup_rule(
|
||||
cls.secgroup['security_group']['id'])
|
||||
# enable metadata rate limiting feature
|
||||
cls.cmd_base = 'sudo crudini --set ' + cls.metadata_conf_file\
|
||||
+ ' metadata_rate_limiting'
|
||||
LOG.debug("Enable the metadata rate limiting using configuration.")
|
||||
cls._set_rate_limiting_config(rate_limit_enabled='true')
|
||||
|
||||
@classmethod
|
||||
def run_cmd_on_nodes(cls, cmd):
|
||||
@ -90,8 +88,6 @@ class TestMetadataRateLimiting(wb_base.BaseTempestWhiteboxTestCase):
|
||||
Args:
|
||||
- **kwargs: Configuration parameters as key-value pairs.
|
||||
"""
|
||||
# TODO(mblue): when conf change supported on computes in podified env,
|
||||
# verify test fully instead of skipping.
|
||||
for key, value in kwargs.items():
|
||||
if value is not None:
|
||||
LOG.debug(
|
||||
@ -100,16 +96,17 @@ class TestMetadataRateLimiting(wb_base.BaseTempestWhiteboxTestCase):
|
||||
'Section - metadata_rate_limiting\n'
|
||||
f'Parameter - {key}\n'
|
||||
f'Value - {value}\n')
|
||||
if WB_CONF.openstack_type == 'podified':
|
||||
cls.set_service_setting(
|
||||
'compute',
|
||||
cls.metadata_conf_file,
|
||||
'metadata_rate_limiting',
|
||||
key, value)
|
||||
else:
|
||||
cls.run_cmd_on_nodes(f"{cls.cmd_base} {key} {value}")
|
||||
cls.set_service_setting(
|
||||
'compute',
|
||||
cls.metadata_conf_file,
|
||||
'metadata_rate_limiting',
|
||||
key, value)
|
||||
cls._restart_metadata_agent()
|
||||
|
||||
def tearDown(self):
|
||||
super().tearDown()
|
||||
self._reset_config()
|
||||
|
||||
@classmethod
|
||||
def resource_cleanup(cls):
|
||||
super(TestMetadataRateLimiting, cls).resource_cleanup()
|
||||
@ -118,18 +115,14 @@ class TestMetadataRateLimiting(wb_base.BaseTempestWhiteboxTestCase):
|
||||
|
||||
@classmethod
|
||||
def _reset_config(cls):
|
||||
"""Reset the metadata rate limiting configuration."""
|
||||
# NOTE(mblue): 'oc patch' can't remove values, max count over min time
|
||||
min_duration = 1
|
||||
max_rate = 2 ** 16 - 2
|
||||
cls._set_rate_limiting_config(
|
||||
base_query_rate_limit=max_rate,
|
||||
burst_window_duration=min_duration,
|
||||
burst_query_rate_limit=max_rate,
|
||||
base_window_duration=min_duration
|
||||
)
|
||||
"""Reset/remove the metadata rate limiting configuration."""
|
||||
LOG.debug(
|
||||
"Set metadata rate limiting configuration permissive values.")
|
||||
"Removing metadata rate limiting configuration.")
|
||||
cls.run_group_cmd(
|
||||
'sudo crudini --del {} {} && sudo sync'.format(
|
||||
cls.metadata_conf_file,
|
||||
'metadata_rate_limiting'),
|
||||
'compute')
|
||||
|
||||
@classmethod
|
||||
def _disable_metadata_rate_limiting_config(cls):
|
||||
@ -205,6 +198,7 @@ class TestMetadataRateLimiting(wb_base.BaseTempestWhiteboxTestCase):
|
||||
|
||||
# modify the configuration for limiting
|
||||
self._set_rate_limiting_config(
|
||||
rate_limit_enabled='true',
|
||||
base_query_rate_limit=base_query_rate_limit,
|
||||
base_window_duration=base_window_duration
|
||||
)
|
||||
@ -219,7 +213,6 @@ class TestMetadataRateLimiting(wb_base.BaseTempestWhiteboxTestCase):
|
||||
sleep(base_window_duration)
|
||||
|
||||
self._test_limiting(base_query_rate_limit, vm)
|
||||
self._reset_config()
|
||||
|
||||
@decorators.idempotent_id('16381121-8a23-41db-8167-390c7ba1fe77')
|
||||
def test_metadata_burst_rate_limiting(self):
|
||||
@ -242,6 +235,7 @@ class TestMetadataRateLimiting(wb_base.BaseTempestWhiteboxTestCase):
|
||||
LOG.debug("Test the metadata service's burst rate limiting")
|
||||
# modify the configuration for limiting
|
||||
self._set_rate_limiting_config(
|
||||
rate_limit_enabled='true',
|
||||
base_query_rate_limit=base_query_rate_limit,
|
||||
burst_window_duration=burst_window_duration,
|
||||
burst_query_rate_limit=burst_query_rate_limit,
|
||||
@ -265,7 +259,6 @@ class TestMetadataRateLimiting(wb_base.BaseTempestWhiteboxTestCase):
|
||||
# "Too Many Requests" after exceeding the burst query rate limit
|
||||
sleep(burst_window_duration * 2)
|
||||
self._test_limiting(burst_query_rate_limit, vm)
|
||||
self._reset_config()
|
||||
|
||||
@decorators.idempotent_id('d564beda-5860-4c5f-96ac-13eb0995f7b7')
|
||||
def test_metadata_base_and_burst_rate_limiting(self):
|
||||
@ -290,6 +283,7 @@ class TestMetadataRateLimiting(wb_base.BaseTempestWhiteboxTestCase):
|
||||
|
||||
# Set rate limiting configuration
|
||||
self._set_rate_limiting_config(
|
||||
rate_limit_enabled='true',
|
||||
base_query_rate_limit=base_query_rate_limit,
|
||||
burst_window_duration=burst_window_duration,
|
||||
burst_query_rate_limit=burst_query_rate_limit,
|
||||
@ -313,4 +307,3 @@ class TestMetadataRateLimiting(wb_base.BaseTempestWhiteboxTestCase):
|
||||
# Send additional requests to verify they're within the base limit
|
||||
# but not the burst limit
|
||||
self._test_limiting(base_query_rate_limit - burst_query_rate_limit, vm)
|
||||
self._reset_config()
|
||||
|
@ -447,7 +447,10 @@
|
||||
(^whitebox_neutron_tempest_plugin.*test_previously_used_ip)|\
|
||||
(^whitebox_neutron_tempest_plugin.tests.scenario.test_ovn_dbs.OvnDbsMonitoringTest.*)|\
|
||||
(^whitebox_neutron_tempest_plugin.*ovn_controller_restart)"
|
||||
tempest_exclude_regex: ""
|
||||
# NOTE(mblue): Enable metadata rate limiting tests
|
||||
# when OSPRH-9569 is resolved (feature code available in RHOSO).
|
||||
tempest_exclude_regex: "\
|
||||
(^whitebox_neutron_tempest_plugin.tests.scenario.test_metadata_rate_limiting)"
|
||||
|
||||
- job:
|
||||
name: whitebox-neutron-tempest-plugin-openvswitch
|
||||
|
Loading…
x
Reference in New Issue
Block a user