Add integration scenario test for Neutron LBaaS
- added new scenario test that checks work of Neutron LBaaS resource:
test creates stack with two servers and LB resource, checks connection,
adds one more member to LP and finally checks load balancing.
Co-Authored-by: Sergey Kraynev <skraynev@mirantis.com>
Change-Id: I5d05909d437a2ba7b047ae758f3b5d8669fc8b1b
diff --git a/common/config.py b/common/config.py
index 878cd33..158d087 100644
--- a/common/config.py
+++ b/common/config.py
@@ -103,6 +103,10 @@
cfg.BoolOpt('skip_stack_abandon_tests',
default=False,
help="Skip Stack Abandon Integration tests"),
+ cfg.IntOpt('connectivity_timeout',
+ default=120,
+ help="Timeout in seconds to wait for connectivity to "
+ "server."),
]
diff --git a/common/test.py b/common/test.py
index 0ffa2b0..70d8708 100644
--- a/common/test.py
+++ b/common/test.py
@@ -16,6 +16,7 @@
import re
import subprocess
import time
+import urllib
import fixtures
from heatclient import exc as heat_exceptions
@@ -107,6 +108,22 @@
return linux_client
+ def check_connectivity(self, check_ip):
+ def try_connect(ip):
+ try:
+ urllib.urlopen('http://%s/' % ip)
+ return True
+ except IOError:
+ return False
+
+ timeout = self.conf.connectivity_timeout
+ elapsed_time = 0
+ while not try_connect(check_ip):
+ time.sleep(10)
+ elapsed_time += 10
+ if elapsed_time > timeout:
+ raise exceptions.TimeoutException()
+
def _log_console_output(self, servers=None):
if not servers:
servers = self.compute_client.servers.list()