Merge "Add an option to reuse connections"
diff --git a/octavia_tempest_plugin/config.py b/octavia_tempest_plugin/config.py
index 7987c65..29dc1da 100644
--- a/octavia_tempest_plugin/config.py
+++ b/octavia_tempest_plugin/config.py
@@ -188,6 +188,9 @@
cfg.StrOpt('availability_zone',
default=None,
help='Availability zone to use for creating servers.'),
+ cfg.BoolOpt('test_reuse_connection', default=True,
+ help='Reuse TCP connections while testing LB with '
+ 'HTTP members (keep-alive).'),
]
lb_feature_enabled_group = cfg.OptGroup(name='loadbalancer-feature-enabled',
diff --git a/octavia_tempest_plugin/tests/test_base.py b/octavia_tempest_plugin/tests/test_base.py
index 0e8a909..c8f7954 100644
--- a/octavia_tempest_plugin/tests/test_base.py
+++ b/octavia_tempest_plugin/tests/test_base.py
@@ -862,7 +862,9 @@
def check_members_balanced(self, vip_address, traffic_member_count=2,
protocol='http', verify=True):
- session = requests.Session()
+ handler = requests
+ if CONF.load_balancer.test_reuse_connection:
+ handler = requests.Session()
response_counts = {}
if ipaddress.ip_address(vip_address).version == 6:
@@ -873,7 +875,7 @@
# Send a number requests to lb vip
for i in range(20):
try:
- r = session.get('{0}://{1}'.format(protocol, vip_address),
+ r = handler.get('{0}://{1}'.format(protocol, vip_address),
timeout=2, verify=verify)
if r.content in response_counts: