Fix tests to honor Octavia API versioning
This patch adds support for Octavia API endpoint versioning.
Previously Rocky API additions were being tested, regardless of the Octavia
API version.
It also fixes a potential race condition when testing the "ONLINE"
operating status.
The patch also makes sure that duplicate fixed IP addresses are not allocated
on subnets.
Story: 2003466
Task: 24726
Change-Id: If0ec777f34326c09c7215d9c7c2ed249571d779e
diff --git a/octavia_tempest_plugin/tests/test_base.py b/octavia_tempest_plugin/tests/test_base.py
index 2cc16e0..c30932c 100644
--- a/octavia_tempest_plugin/tests/test_base.py
+++ b/octavia_tempest_plugin/tests/test_base.py
@@ -53,6 +53,7 @@
client_manager = clients.ManagerV2
webserver1_response = 1
webserver2_response = 5
+ used_ips = []
@classmethod
def skip_checks(cls):
@@ -123,6 +124,8 @@
conf_lb = CONF.load_balancer
+ cls.api_version = cls.mem_lb_client.get_max_api_version()
+
if conf_lb.test_subnet_override and not conf_lb.test_network_override:
raise exceptions.InvalidConfiguration(
"Configuration value test_network_override must be "
@@ -366,6 +369,9 @@
ip_version = 6 if CONF.load_balancer.test_with_ipv6 else 4
if cls.lb_member_vip_subnet:
ip_index = data_utils.rand_int_id(start=10, end=100)
+ while ip_index in cls.used_ips:
+ ip_index = data_utils.rand_int_id(start=10, end=100)
+ cls.used_ips.append(ip_index)
if ip_version == 4:
network = ipaddress.IPv4Network(
six.u(CONF.load_balancer.vip_subnet_cidr))