summaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark/scenarios/availability/test_util.py
diff options
context:
space:
mode:
authorqiujuan <juan_qiu@tongji.edu.cn>2017-05-25 13:18:28 +0800
committerJing Lu <lvjing5@huawei.com>2017-07-25 06:10:56 +0000
commita0c9e3066046fc369870dbffe67a0613d661cf80 (patch)
treec3712ff54101f921a5abec530ac6838b1e3f5219 /tests/unit/benchmark/scenarios/availability/test_util.py
parentd29df23ae5057fe0ccded6f8d8f3e36a084a78b3 (diff)
Add intermediate variable for HA test
JIRA: YARDSTICK-397 Change-Id: I3489893caa5b8194b63cb844325ec0b2c554aecc Signed-off-by: qiujuan <juan_qiu@tongji.edu.cn>
Diffstat (limited to 'tests/unit/benchmark/scenarios/availability/test_util.py')
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_util.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/unit/benchmark/scenarios/availability/test_util.py b/tests/unit/benchmark/scenarios/availability/test_util.py
index bb0e6bc79..2e4fff417 100644
--- a/tests/unit/benchmark/scenarios/availability/test_util.py
+++ b/tests/unit/benchmark/scenarios/availability/test_util.py
@@ -19,6 +19,25 @@ from yardstick.benchmark.scenarios.availability import util
@mock.patch('yardstick.benchmark.scenarios.availability.util.subprocess')
class ExecuteShellTestCase(unittest.TestCase):
+ def setUp(self):
+ self.param_config = {'serviceName': '$serviceName', 'value': 1}
+ self.intermediate_variables = {'$serviceName': 'nova-api'}
+ self.std_output = '| id | 1 |'
+ self.cmd_config = {'cmd':'ls','param':'-a'}
+
+ def test_util_build_command_shell(self,mock_subprocess):
+ result = util.build_shell_command(self.param_config, True,
+ self.intermediate_variables)
+ self.assertEqual("nova-api" in result, True)
+
+ def test_read_stdout_item(self,mock_subprocess):
+ result = util.read_stdout_item(self.std_output,'id')
+ self.assertEquals('1',result)
+
+ def test_buildshellparams(self,mock_subprocess):
+ result = util.buildshellparams(self.cmd_config,True)
+ self.assertEquals('/bin/bash -s {0} {1}', result)
+
def test__fun_execute_shell_command_successful(self, mock_subprocess):
cmd = "env"
mock_subprocess.check_output.return_value = (0, 'unittest')