Reduce retry interval from 5 to 3 for all loops involving OSP API requests

Apparently, sending requests to Openstack APIs on Podified environments
every 5 seconds is problematic and tobiko tests are unstable due to
this.
In two previous patches, this change was already done for heat and
glance requests.
With this patch, the interval has been changed for all loops that
involve retries to any Openstack APIs.

OSPCIX-844

Change-Id: If0bb72b6e46683425429e3b93d3993fb57221799
This commit is contained in:
Eduardo Olivares
2025-06-17 10:54:54 +02:00
parent dd516acf49
commit dec1661438
14 changed files with 17 additions and 17 deletions

View File

@@ -129,7 +129,7 @@ def wait_for_status(status_key, status, get_client, object_id,
for attempt in tobiko.retry(timeout=timeout,
interval=interval,
default_timeout=300.,
default_interval=5.):
default_interval=3.):
response = get_client(object_id, **kwargs)
if response[status_key] == status:
return response

View File

@@ -115,7 +115,7 @@ class HeatStackFixture(base_fixture.BaseResourceFixture):
retry_count: int = 3
retry_timeout: float = 1200.
min_retry_interval: float = 0.1
max_retry_interval: float = 5.
max_retry_interval: float = 3.
wait_interval: tobiko.Seconds = 3
wait_timeout: tobiko.Seconds = 600.
template: _template.HeatTemplateFixture

View File

@@ -79,7 +79,7 @@ def wait_for_node_power_state(
for attempt in tobiko.retry(timeout=timeout,
interval=sleep_time,
default_timeout=300.,
default_interval=5.):
default_interval=3.):
_node = get_node(node_id=node_id, client=client)
if _node.power_state == power_state:
break

View File

@@ -55,7 +55,7 @@ def wait_for_status(object_id: str,
for attempt in tobiko.retry(timeout=timeout,
interval=interval,
default_timeout=300.,
default_interval=5.):
default_interval=3.):
response = get_client(object_id, **kwargs)
if response[status_key] == status:
return response

View File

@@ -94,7 +94,7 @@ def wait_for_master_and_backup_agents(
for attempt in tobiko.retry(timeout=timeout,
interval=interval,
default_timeout=300.,
default_interval=5.):
default_interval=3.):
router_agents = _agent.list_l3_agent_hosting_routers(router_id)
master_agents = router_agents.with_items(ha_state='active')
if master_agents:

View File

@@ -380,7 +380,7 @@ def wait_for_server_status(
for attempt in tobiko.retry(timeout=timeout,
interval=sleep_time,
default_timeout=300.,
default_interval=5.):
default_interval=3.):
_server = get_server(server_id=server_id, client=client)
if _server.status == status:
break

View File

@@ -49,7 +49,7 @@ def wait_for_services_up(retry: typing.Optional[tobiko.Retry] = None,
**list_services_params):
for attempt in tobiko.retry(other_retry=retry,
default_timeout=300.,
default_interval=5.):
default_interval=3.):
try:
services = _client.list_services(**list_services_params)
except (ks_exceptions.connection.ConnectFailure,

View File

@@ -76,7 +76,7 @@ def wait_for_octavia_service(interval: tobiko.Seconds = None,
for attempt in tobiko.retry(timeout=timeout,
interval=interval,
default_timeout=180.,
default_interval=5.):
default_interval=3.):
try: # Call any Octavia API
octavia.list_amphorae()
except octavia.OctaviaClientException as ex:

View File

@@ -361,7 +361,7 @@ class ServerStackFixture(heat.HeatStackFixture, ABC):
interval=retry_interval,
default_count=3,
default_timeout=900.,
default_interval=5.):
default_interval=3.):
tobiko.setup_fixture(self)
server_id = self.server_id
try:

View File

@@ -50,7 +50,7 @@ def build_ovn_db_show_dict(ovn_db_show_str):
return ovn_master_db_dict
def test_neutron_agents_are_alive(timeout=420., interval=5.) \
def test_neutron_agents_are_alive(timeout=420., interval=3.) \
-> tobiko.Selection[neutron.NeutronAgentType]:
for attempt in tobiko.retry(timeout=timeout, interval=interval):
LOG.debug("Look for unhealthy Neutron agents...")
@@ -98,7 +98,7 @@ def test_neutron_agents_are_alive(timeout=420., interval=5.) \
def test_alive_agents_are_consistent_along_time(retry_timeout=360.,
retry_interval=5.,
retry_interval=3.,
consistent_sleep=5.,
consistent_count=5,):
# the following dict of agents is obtained when:

View File

@@ -1,4 +1,4 @@
# Copyright 2022 Red Hat
# Copyright 2021 Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@@ -48,7 +48,7 @@ def wait_for_namespace_in_hosts(*namespaces: str,
count=count,
interval=interval,
default_timeout=60.,
default_interval=5.):
default_interval=3.):
try:
if present:
assert_namespace_in_hosts(*namespaces,

View File

@@ -105,11 +105,11 @@ def octavia_health_checks():
LOG.debug("check all LBs are in healthy status")
for lb in octavia.list_load_balancers():
LOG.debug("checkin LBs:\n%s", lb)
octavia.wait_for_status(lb['id'], interval=5., timeout=120.)
octavia.wait_for_status(lb['id'], interval=3., timeout=120.)
octavia.wait_for_status(lb['id'],
status_key=octavia.OPERATING_STATUS,
status=octavia.ONLINE,
interval=5.,
interval=3.,
timeout=120.)
LOG.debug("All LBs are in healthy status")

View File

@@ -450,7 +450,7 @@ class L3AgentTest(BaseAgentTest):
def wait_for_active_ha_l3_agent(self) -> AgentType:
ha_router_id = self.ha_stack.network_stack.gateway_id
for attempt in tobiko.retry(timeout=180., interval=5.):
for attempt in tobiko.retry(timeout=180., interval=3.):
agents = neutron.list_l3_agent_hosting_routers(ha_router_id)
try:
active_agent = agents.with_items(ha_state='active').unique

View File

@@ -165,7 +165,7 @@ class OpenStackTopologyTest(testtools.TestCase):
# Process isn't listed after kill
processes.unique.kill()
for attempt in tobiko.retry(timeout=30., interval=5.):
for attempt in tobiko.retry(timeout=30., interval=3.):
processes = osp_topology.list_nodes_processes(
command_line=command_line,
hostnames=[node.hostname])