Merge "Force connection auth as part of RemoteClient in scenario"

This commit is contained in:
Jenkins 2014-06-19 18:46:42 +00:00 committed by Gerrit Code Review
commit 339181aefd
5 changed files with 26 additions and 14 deletions

View File

@ -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):

View File

@ -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"""

View File

@ -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):

View File

@ -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

View File

@ -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()