Add tests for allowed CIDRs in listeners
This patch adds API and scenario tests for testing allowed CIDRS in
listeners introduced in API version 2.12 (included in Train release).
Change-Id: Ibe677e046afc16f038ccacb10e5fe62802828581
diff --git a/octavia_tempest_plugin/tests/test_base.py b/octavia_tempest_plugin/tests/test_base.py
index 741bb1c..bd1a225 100644
--- a/octavia_tempest_plugin/tests/test_base.py
+++ b/octavia_tempest_plugin/tests/test_base.py
@@ -503,6 +503,8 @@
if CONF.load_balancer.test_with_noop:
lb_kwargs[const.VIP_NETWORK_ID] = (
cls.lb_member_vip_net[const.ID])
+ if ip_version == 6:
+ lb_kwargs[const.VIP_ADDRESS] = lb_vip_address
else:
lb_kwargs[const.VIP_NETWORK_ID] = cls.lb_member_vip_net[const.ID]
lb_kwargs[const.VIP_SUBNET_ID] = None
@@ -1099,7 +1101,8 @@
protocol_port=protocol_port)
def assertConsistentResponse(self, response, url, method='GET', repeat=10,
- redirect=False, timeout=2, **kwargs):
+ redirect=False, timeout=2,
+ conn_error=False, **kwargs):
"""Assert that a request to URL gets the expected response.
:param response: Expected response in format (status_code, content).
@@ -1112,6 +1115,7 @@
:param redirect: Is the request a redirect? If true, assume the passed
content should be the next URL in the chain.
:param timeout: Optional seconds to wait for the server to send data.
+ :param conn_error: Optional Expect a connection error?
:return: boolean success status
@@ -1121,6 +1125,13 @@
response_code, response_content = response
for i in range(0, repeat):
+ if conn_error:
+ self.assertRaises(
+ requests.exceptions.ConnectionError, session.request,
+ method, url, allow_redirects=not redirect, timeout=timeout,
+ **kwargs)
+ continue
+
req = session.request(method, url, allow_redirects=not redirect,
timeout=timeout, **kwargs)
if response_code: