diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-07-31 12:25:40 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-08-01 10:17:02 +0200 |
commit | a4bbcd895a0fbf29cb7c2dc396fefb4229573225 (patch) | |
tree | 9e7a1402f3a09644fa4d51ead35145c84088fc43 | |
parent | fb1fafba4fa172fffe92d33ed71adaeb866b5c05 (diff) |
Print stderr in logs when calling cmd over ssh
Change-Id: I152ac898661a0e99a6232df86689c70c468ceaa5
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
(cherry picked from commit b66827d753e09c29cd6f541119dc0ec4c6344511)
-rw-r--r-- | functest/core/singlevm.py | 3 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/vping/vping_ssh.py | 5 | ||||
-rw-r--r-- | functest/tests/unit/openstack/vping/test_vping_ssh.py | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/functest/core/singlevm.py b/functest/core/singlevm.py index 2a8ae879a..46aa41902 100644 --- a/functest/core/singlevm.py +++ b/functest/core/singlevm.py @@ -381,8 +381,9 @@ class SingleVm1(VmReady1): Returns: echo exit codes """ - (_, stdout, _) = self.ssh.exec_command('echo Hello World') + (_, stdout, stderr) = self.ssh.exec_command('echo Hello World') self.__logger.debug("output:\n%s", stdout.read()) + self.__logger.debug("error:\n%s", stderr.read()) return stdout.channel.recv_exit_status() def run(self, **kwargs): diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py index 643f4f6de..a8a6fd9a6 100644 --- a/functest/opnfv_tests/openstack/vping/vping_ssh.py +++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py @@ -44,9 +44,10 @@ class VPingSSH(singlevm.SingleVm2): Returns: ping exit codes """ assert self.ssh - (_, stdout, _) = self.ssh.exec_command( + (_, stdout, stderr) = self.ssh.exec_command( 'ping -c 1 ' + self.vm2.private_v4) - self.__logger.debug("output:\n%s", stdout.read()) + self.__logger.info("output:\n%s", stdout.read()) + self.__logger.info("error:\n%s", stderr.read()) return stdout.channel.recv_exit_status() def clean(self): diff --git a/functest/tests/unit/openstack/vping/test_vping_ssh.py b/functest/tests/unit/openstack/vping/test_vping_ssh.py index 3595638ec..05482ed6b 100644 --- a/functest/tests/unit/openstack/vping/test_vping_ssh.py +++ b/functest/tests/unit/openstack/vping/test_vping_ssh.py @@ -75,7 +75,7 @@ class VpingSSHTesting(unittest.TestCase): self.vping.ssh = mock.Mock() stdout = mock.Mock() stdout.channel.recv_exit_status.return_value = ret - self.vping.ssh.exec_command.return_value = (None, stdout, None) + self.vping.ssh.exec_command.return_value = (None, stdout, mock.Mock()) self.assertEqual(self.vping.execute(), ret) self.vping.ssh.exec_command.assert_called_once_with( 'ping -c 1 {}'.format(self.vping.vm2.private_v4)) |