Skip to content

Commit

Permalink
Increase ping timeout on scenario testing
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Nachi Ueno committed Jul 25, 2013
1 parent 58d2330 commit 6d580be
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
3 changes: 3 additions & 0 deletions etc/tempest.conf.sample
Expand Up @@ -91,6 +91,9 @@ network_for_ssh = private
# 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

Expand Down
4 changes: 4 additions & 0 deletions tempest/config.py
Expand Up @@ -160,6 +160,10 @@ def register_identity_opts(conf):
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 "
Expand Down
22 changes: 11 additions & 11 deletions tempest/scenario/manager.py
Expand Up @@ -425,24 +425,24 @@ def ping():
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))

0 comments on commit 6d580be

Please sign in to comment.