Add retry decorator for tests failing due to traffic not passing
Some traffic-related tests intermittently failed in Kubernetes
environments due to port conflicts with other services on the host.
This patch introduces a retry decorator that increments the port
number and retries the test a configurable number of times.
Change-Id: I63d7f8aec934bc995a8f1b6546fc12bf273d84aa
diff --git a/octavia_tempest_plugin/tests/validators.py b/octavia_tempest_plugin/tests/validators.py
index 5ff7bd5..57ba2e2 100644
--- a/octavia_tempest_plugin/tests/validators.py
+++ b/octavia_tempest_plugin/tests/validators.py
@@ -113,6 +113,8 @@
session.close()
raise
except Exception as e:
+ if "[Errno 98] Address already in use" in str(e):
+ raise e
LOG.info('Validate URL got exception: %s. '
'Retrying.', e)
time.sleep(request_interval)
@@ -410,8 +412,10 @@
response_counts)
time.sleep(1)
return
- except Exception:
+ except Exception as e:
LOG.warning('Server is not passing initial traffic. Waiting.')
+ if "[Errno 98] Address already in use" in str(e):
+ raise e
time.sleep(request_interval)
LOG.debug('Loadbalancer wait for load balancer response totals: %s',