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 username = CONF.scenario.ssh_user
if private_key is None: if private_key is None:
private_key = self.keypair.private_key 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): def _log_console_output(self, servers=None):
if not servers: if not servers:
@ -869,9 +878,7 @@ class NetworkScenarioTest(OfficialClientTest):
msg=msg) msg=msg)
if should_connect: if should_connect:
# no need to check ssh for negative connectivity # no need to check ssh for negative connectivity
linux_client = self.get_remote_client(ip_address, username, self.get_remote_client(ip_address, username, private_key)
private_key)
linux_client.validate_authentication()
def _check_public_network_connectivity(self, ip_address, username, def _check_public_network_connectivity(self, ip_address, username,
private_key, should_connect=True, private_key, should_connect=True,
@ -885,13 +892,15 @@ class NetworkScenarioTest(OfficialClientTest):
username, username,
private_key, private_key,
should_connect=should_connect) should_connect=should_connect)
except Exception: except Exception as e:
ex_msg = 'Public network connectivity check failed' ex_msg = 'Public network connectivity check failed'
if msg: if msg:
ex_msg += ": " + msg ex_msg += ": " + msg
LOG.exception(ex_msg) LOG.exception(ex_msg)
self._log_console_output(servers) 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 raise
def _check_tenant_network_connectivity(self, server, def _check_tenant_network_connectivity(self, server,
@ -912,10 +921,12 @@ class NetworkScenarioTest(OfficialClientTest):
username, username,
private_key, private_key,
should_connect=should_connect) should_connect=should_connect)
except Exception: except Exception as e:
LOG.exception('Tenant network connectivity check failed') LOG.exception('Tenant network connectivity check failed')
self._log_console_output(servers_for_debug) 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 raise
def _check_remote_connectivity(self, source, dest, should_succeed=True): 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( ssh_client = self.get_remote_client(
server_or_ip=ip, server_or_ip=ip,
private_key=private_key) private_key=private_key)
ssh_client.validate_authentication()
# Write a backend's responce into a file # Write a backend's responce into a file
resp = """HTTP/1.0 200 OK\r\nContent-Length: 8\r\n\r\n%s""" 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): def ssh_to_server(self):
try: try:
self.linux_client = self.get_remote_client(self.floating_ip.ip) self.linux_client = self.get_remote_client(self.floating_ip.ip)
self.linux_client.validate_authentication() except Exception as e:
except Exception:
LOG.exception('ssh to server failed') LOG.exception('ssh to server failed')
self._log_console_output() 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 raise
def check_partitions(self): def check_partitions(self):

View File

@ -336,6 +336,8 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest):
self.assertTrue(self._check_remote_connectivity(access_point, ip, self.assertTrue(self._check_remote_connectivity(access_point, ip,
should_succeed), should_succeed),
msg) msg)
except test.exceptions.SSHTimeout:
raise
except Exception: except Exception:
debug.log_net_debug() debug.log_net_debug()
raise raise

View File

@ -93,11 +93,10 @@ class TestServerBasicOps(manager.OfficialClientTest):
instance.add_floating_ip(floating_ip) instance.add_floating_ip(floating_ip)
# Check ssh # Check ssh
try: try:
linux_client = self.get_remote_client( self.get_remote_client(
server_or_ip=floating_ip.ip, server_or_ip=floating_ip.ip,
username=self.image_utils.ssh_user(self.image_ref), username=self.image_utils.ssh_user(self.image_ref),
private_key=self.keypair.private_key) private_key=self.keypair.private_key)
linux_client.validate_authentication()
except Exception: except Exception:
LOG.exception('ssh to server failed') LOG.exception('ssh to server failed')
self._log_console_output() self._log_console_output()