Increase ping timeout on scenario testing
Some gating may fail because ping timeout is short (20s).
In this commit, we will increase up to 60s.
- Added ping_timeout for compute config with default 60s
- Replaced hardcorded ssh timeout value with ssh_timeout
Fixes bug 1194026
Change-Id: If4e64aff17fc9aea1b6de03c684dff145ef5e6f2
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index a73e8a0..92371e8 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -91,6 +91,9 @@
# IP version of the address used for SSH
ip_version_for_ssh = 4
+# Number of seconds to wait to ping to an instance
+ping_timeout = 60
+
# Number of seconds to wait to authenticate to an instance
ssh_timeout = 300
diff --git a/tempest/config.py b/tempest/config.py
index d9de205..68acdaa 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -160,6 +160,10 @@
cfg.StrOpt('ssh_user',
default='root',
help="User name used to authenticate to an instance."),
+ cfg.IntOpt('ping_timeout',
+ default=60,
+ help="Timeout in seconds to wait for ping to "
+ "succeed."),
cfg.IntOpt('ssh_timeout',
default=300,
help="Timeout in seconds to wait for authentication to "
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index fcd5d0e..8b24b2e 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -425,24 +425,24 @@
if proc.returncode == 0:
return True
- # TODO(mnewby) Allow configuration of execution and sleep duration.
- return tempest.test.call_until_true(ping, 20, 1)
+ return tempest.test.call_until_true(
+ ping, self.config.compute.ping_timeout, 1)
def _is_reachable_via_ssh(self, ip_address, username, private_key,
- timeout=120):
+ timeout):
ssh_client = ssh.Client(ip_address, username,
pkey=private_key,
timeout=timeout)
return ssh_client.test_connection_auth()
- def _check_vm_connectivity(self, ip_address, username, private_key,
- timeout=120):
+ def _check_vm_connectivity(self, ip_address, username, private_key):
self.assertTrue(self._ping_ip_address(ip_address),
"Timed out waiting for %s to become "
"reachable" % ip_address)
- self.assertTrue(self._is_reachable_via_ssh(ip_address,
- username,
- private_key,
- timeout=timeout),
- 'Auth failure in connecting to %s@%s via ssh' %
- (username, ip_address))
+ self.assertTrue(self._is_reachable_via_ssh(
+ ip_address,
+ username,
+ private_key,
+ timeout=self.config.compute.ssh_timeout),
+ 'Auth failure in connecting to %s@%s via ssh' %
+ (username, ip_address))