Print VM console output upon different exceptions
VM console ouput is printed when tests fail due to some exceptions This patch extends the list of caught exceptions for which it will be printed - The added exceptions were recently reproduced The complete list of expected exceptions follows: tempest.lib.exceptions.SSHTimeout paramiko.ssh_exception.AuthenticationException paramiko.ssh_exception.NoValidConnectionsError ConnectionResetError Change-Id: Ie5f58209739aed1a0dd7f4fb3a9b1fb06b27061c
This commit is contained in:
parent
36a231e229
commit
46fa42463c
@ -38,8 +38,11 @@ from neutron_tempest_plugin import exceptions
|
||||
from neutron_tempest_plugin.scenario import constants
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
SSH_EXC_TUPLE = (lib_exc.SSHTimeout,
|
||||
ssh_exc.AuthenticationException,
|
||||
ssh_exc.NoValidConnectionsError,
|
||||
ConnectionResetError)
|
||||
|
||||
|
||||
def get_ncat_version(ssh_client=None):
|
||||
@ -308,7 +311,7 @@ class BaseTempestTestCase(base_api.BaseNetworkTest):
|
||||
pkey=ssh_key, timeout=ssh_timeout)
|
||||
try:
|
||||
ssh_client.test_connection_auth()
|
||||
except (lib_exc.SSHTimeout, ssh_exc.AuthenticationException) as ssh_e:
|
||||
except SSH_EXC_TUPLE as ssh_e:
|
||||
LOG.debug(ssh_e)
|
||||
self._log_console_output(servers)
|
||||
self._log_local_network_status()
|
||||
@ -448,7 +451,7 @@ class BaseTempestTestCase(base_api.BaseNetworkTest):
|
||||
timeout=timeout, pattern=pattern,
|
||||
forbid_packet_loss=forbid_packet_loss,
|
||||
check_response_ip=check_response_ip))
|
||||
except (lib_exc.SSHTimeout, ssh_exc.AuthenticationException) as ssh_e:
|
||||
except SSH_EXC_TUPLE as ssh_e:
|
||||
LOG.debug(ssh_e)
|
||||
self._log_console_output(servers)
|
||||
self._log_local_network_status()
|
||||
@ -565,7 +568,7 @@ class BaseTempestTestCase(base_api.BaseNetworkTest):
|
||||
**kwargs)
|
||||
self.assertIn(server['name'],
|
||||
ssh_client.get_hostname())
|
||||
except (lib_exc.SSHTimeout, ssh_exc.AuthenticationException) as ssh_e:
|
||||
except SSH_EXC_TUPLE as ssh_e:
|
||||
LOG.debug(ssh_e)
|
||||
if log_errors:
|
||||
self._log_console_output(servers)
|
||||
@ -600,7 +603,7 @@ class BaseTempestTestCase(base_api.BaseNetworkTest):
|
||||
return ssh_client.execute_script(
|
||||
get_ncat_server_cmd(port, protocol, echo_msg),
|
||||
become_root=True, combine_stderr=True)
|
||||
except (lib_exc.SSHTimeout, ssh_exc.AuthenticationException) as ssh_e:
|
||||
except SSH_EXC_TUPLE as ssh_e:
|
||||
LOG.debug(ssh_e)
|
||||
self._log_console_output(servers)
|
||||
self._log_local_network_status()
|
||||
|
@ -14,10 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log
|
||||
from paramiko import ssh_exception as ssh_exc
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
from neutron_tempest_plugin.common import ssh
|
||||
from neutron_tempest_plugin.common import utils
|
||||
@ -121,7 +119,7 @@ class MacLearningTest(base.BaseTempestTestCase):
|
||||
def _check_cmd_installed_on_server(self, ssh_client, server, cmd):
|
||||
try:
|
||||
ssh_client.execute_script('which %s' % cmd)
|
||||
except (lib_exc.SSHTimeout, ssh_exc.AuthenticationException) as ssh_e:
|
||||
except base.SSH_EXC_TUPLE as ssh_e:
|
||||
LOG.debug(ssh_e)
|
||||
self._log_console_output([server])
|
||||
self._log_local_network_status()
|
||||
|
@ -16,10 +16,8 @@
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from oslo_log import log
|
||||
from paramiko import ssh_exception as ssh_exc
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
from neutron_tempest_plugin.common import ip
|
||||
from neutron_tempest_plugin.common import ssh
|
||||
@ -218,7 +216,7 @@ class BaseMulticastTest(object):
|
||||
def _check_cmd_installed_on_server(self, ssh_client, server, cmd):
|
||||
try:
|
||||
ssh_client.execute_script('which %s' % cmd)
|
||||
except (lib_exc.SSHTimeout, ssh_exc.AuthenticationException) as ssh_e:
|
||||
except base.SSH_EXC_TUPLE as ssh_e:
|
||||
LOG.debug(ssh_e)
|
||||
self._log_console_output([server])
|
||||
self._log_local_network_status()
|
||||
|
Loading…
Reference in New Issue
Block a user