diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-07-13 23:03:46 -0700 |
---|---|---|
committer | Ross Brattain <ross.b.brattain@intel.com> | 2017-07-13 23:25:55 -0700 |
commit | aa195b8e742556b422cf5583c3b531ec1b58ebdc (patch) | |
tree | caeff5097810317e7f230a97af618b0657a617f0 /yardstick/benchmark/scenarios/availability/attacker | |
parent | 3f1a658fce4b3d81fa2b15ab1879fd37aad80760 (diff) |
test_attacker_baremetal: don't run local commands
these tests were failing to mock subprocess.check_output
and thus were trying to run sudo commands on the local
system.
This is dangerous. Add the subprocess mock.
Also mock the LOG object so we don't print
bogus Runtime error tracebacks in the unittest logs
when we test assertRaises()
Change-Id: I01535f9952fbd95ce2f5972b641c51ff836e7e8c
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'yardstick/benchmark/scenarios/availability/attacker')
-rw-r--r-- | yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py index 22de0b645..50d44c1ca 100644 --- a/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py +++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py @@ -9,7 +9,6 @@ from __future__ import absolute_import import logging import subprocess -import traceback import yardstick.ssh as ssh from yardstick.benchmark.scenarios.availability.attacker.baseattacker import \ @@ -26,9 +25,7 @@ def _execute_shell_command(command, stdin=None): output = subprocess.check_output(command, stdin=stdin, shell=True) except Exception: exitcode = -1 - output = traceback.format_exc() - LOG.error("exec command '%s' error:\n ", command) - LOG.error(traceback.format_exc()) + LOG.error("exec command '%s' error:\n ", command, exc_info=True) return exitcode, output |