diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py index c836227c42..07d8828d91 100644 --- a/tempest/scenario/manager.py +++ b/tempest/scenario/manager.py @@ -407,7 +407,16 @@ class OfficialClientTest(tempest.test.BaseTestCase): username = CONF.scenario.ssh_user if private_key is None: private_key = self.keypair.private_key - return remote_client.RemoteClient(ip, username, pkey=private_key) + linux_client = remote_client.RemoteClient(ip, username, + pkey=private_key) + try: + linux_client.validate_authentication() + except exceptions.SSHTimeout: + LOG.exception('ssh connection to %s failed' % ip) + debug.log_net_debug() + raise + + return linux_client def _log_console_output(self, servers=None): if not servers: @@ -869,9 +878,7 @@ class NetworkScenarioTest(OfficialClientTest): msg=msg) if should_connect: # no need to check ssh for negative connectivity - linux_client = self.get_remote_client(ip_address, username, - private_key) - linux_client.validate_authentication() + self.get_remote_client(ip_address, username, private_key) def _check_public_network_connectivity(self, ip_address, username, private_key, should_connect=True, @@ -885,13 +892,15 @@ class NetworkScenarioTest(OfficialClientTest): username, private_key, should_connect=should_connect) - except Exception: + except Exception as e: ex_msg = 'Public network connectivity check failed' if msg: ex_msg += ": " + msg LOG.exception(ex_msg) self._log_console_output(servers) - debug.log_net_debug() + # network debug is called as part of ssh init + if not isinstance(e, exceptions.SSHTimeout): + debug.log_net_debug() raise def _check_tenant_network_connectivity(self, server, @@ -912,10 +921,12 @@ class NetworkScenarioTest(OfficialClientTest): username, private_key, should_connect=should_connect) - except Exception: + except Exception as e: LOG.exception('Tenant network connectivity check failed') self._log_console_output(servers_for_debug) - debug.log_net_debug() + # network debug is called as part of ssh init + if not isinstance(e, exceptions.SSHTimeout): + debug.log_net_debug() raise def _check_remote_connectivity(self, source, dest, should_succeed=True): diff --git a/tempest/scenario/test_load_balancer_basic.py b/tempest/scenario/test_load_balancer_basic.py index 1c24b5cd19..03cfef5a8c 100644 --- a/tempest/scenario/test_load_balancer_basic.py +++ b/tempest/scenario/test_load_balancer_basic.py @@ -148,7 +148,6 @@ class TestLoadBalancerBasic(manager.NetworkScenarioTest): ssh_client = self.get_remote_client( server_or_ip=ip, private_key=private_key) - ssh_client.validate_authentication() # Write a backend's responce into a file resp = """HTTP/1.0 200 OK\r\nContent-Length: 8\r\n\r\n%s""" diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py index 58f0dbf66c..0406217633 100644 --- a/tempest/scenario/test_minimum_basic.py +++ b/tempest/scenario/test_minimum_basic.py @@ -93,11 +93,12 @@ class TestMinimumBasicScenario(manager.OfficialClientTest): def ssh_to_server(self): try: self.linux_client = self.get_remote_client(self.floating_ip.ip) - self.linux_client.validate_authentication() - except Exception: + except Exception as e: LOG.exception('ssh to server failed') self._log_console_output() - debug.log_net_debug() + # network debug is called as part of ssh init + if not isinstance(e, test.exceptions.SSHTimeout): + debug.log_net_debug() raise def check_partitions(self): diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py index b4e509a102..dd89dc049e 100644 --- a/tempest/scenario/test_security_groups_basic_ops.py +++ b/tempest/scenario/test_security_groups_basic_ops.py @@ -336,6 +336,8 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): self.assertTrue(self._check_remote_connectivity(access_point, ip, should_succeed), msg) + except test.exceptions.SSHTimeout: + raise except Exception: debug.log_net_debug() raise diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py index dc7a0921a0..54f1d9eb83 100644 --- a/tempest/scenario/test_server_basic_ops.py +++ b/tempest/scenario/test_server_basic_ops.py @@ -93,11 +93,10 @@ class TestServerBasicOps(manager.OfficialClientTest): instance.add_floating_ip(floating_ip) # Check ssh try: - linux_client = self.get_remote_client( + self.get_remote_client( server_or_ip=floating_ip.ip, username=self.image_utils.ssh_user(self.image_ref), private_key=self.keypair.private_key) - linux_client.validate_authentication() except Exception: LOG.exception('ssh to server failed') self._log_console_output()