Fix a potential IP address conflict
Previously the tests generated a random IP address (out of 90)
for each load balancer. As these tests run in parallel there was a
chance that two load balancers could be assigned the same address,
causing a conflict and randomly failing a test.
This patch changes the tests to use a neutron assigned address unless
an explicit "use_fixed_ip" flag is set.
The load balancer create API test uses this flag, the others will use
a neutron assigned address.
Change-Id: Ic22efd1df027fd7dd0db14783f2c76069fd51bb5
diff --git a/octavia_tempest_plugin/tests/test_base.py b/octavia_tempest_plugin/tests/test_base.py
index 0e6eba4..2cc16e0 100644
--- a/octavia_tempest_plugin/tests/test_base.py
+++ b/octavia_tempest_plugin/tests/test_base.py
@@ -360,7 +360,8 @@
cls.lb_member_2_ipv6_subnet['id'])
@classmethod
- def _setup_lb_network_kwargs(cls, lb_kwargs, ip_version=None):
+ def _setup_lb_network_kwargs(cls, lb_kwargs, ip_version=None,
+ use_fixed_ip=False):
if not ip_version:
ip_version = 6 if CONF.load_balancer.test_with_ipv6 else 4
if cls.lb_member_vip_subnet:
@@ -376,7 +377,8 @@
lb_vip_address = str(network[ip_index])
subnet_id = cls.lb_member_vip_ipv6_subnet[const.ID]
lb_kwargs[const.VIP_SUBNET_ID] = subnet_id
- lb_kwargs[const.VIP_ADDRESS] = lb_vip_address
+ if use_fixed_ip:
+ lb_kwargs[const.VIP_ADDRESS] = lb_vip_address
if CONF.load_balancer.test_with_noop:
lb_kwargs[const.VIP_NETWORK_ID] = (
cls.lb_member_vip_net[const.ID])