diff options
author | 2017-11-29 22:56:21 +0000 | |
---|---|---|
committer | 2018-02-12 16:57:56 +0000 | |
commit | ba4e9e6e47bd10ecc803bab920178ea973c2fa86 (patch) | |
tree | 54576c199cabe8ccc29d04eedfe0e4f88b2bd598 /tests/unit/benchmark/scenarios/availability/test_util.py | |
parent | babe3cc2882e19c6dafdbf41d502d7ba5560635a (diff) |
Move tests: unit/benchmark
* Fix pylint errors
* Add TODOs
Some errors are ignored locally, as they were a symptom of other problems.
These issues have been flagged with a TODO, and should be fixed later.
Change-Id: I30eb4b0aafe0575d0cddbc946108291f21a98ed8
Jira: YARDSTICK-837
Signed-off-by: Emma Foley <emma.l.foley@intel.com>
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'tests/unit/benchmark/scenarios/availability/test_util.py')
-rw-r--r-- | tests/unit/benchmark/scenarios/availability/test_util.py | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/tests/unit/benchmark/scenarios/availability/test_util.py b/tests/unit/benchmark/scenarios/availability/test_util.py deleted file mode 100644 index 548efe91b..000000000 --- a/tests/unit/benchmark/scenarios/availability/test_util.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python - -############################################################################## -# Copyright (c) 2016 Kanglin Yin and others -# 14_ykl@tongji.edu.cn -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -# Unittest for yardstick.benchmark.scenarios.availability.utils - -import mock -import unittest - -from yardstick.benchmark.scenarios.availability import util - - -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'} - - self._mock_subprocess = mock.patch.object(util, 'subprocess') - self.mock_subprocess = self._mock_subprocess.start() - self.addCleanup(self._stop_mock) - - def _stop_mock(self): - self._mock_subprocess.stop() - - def test_util_build_command_shell(self): - result = util.build_shell_command(self.param_config, True, - self.intermediate_variables) - self.assertIn("nova-api", result) - - def test_read_stdout_item(self): - result = util.read_stdout_item(self.std_output, 'id') - self.assertEqual('1', result) - - def test_buildshellparams(self): - result = util.buildshellparams(self.cmd_config, True) - self.assertEqual('/bin/bash -s {0} {1}', result) - - def test__fun_execute_shell_command_successful(self): - cmd = "env" - self.mock_subprocess.check_output.return_value = (0, 'unittest') - exitcode, _ = util.execute_shell_command(cmd) - self.assertEqual(exitcode, 0) - - def test__fun_execute_shell_command_fail_cmd_exception(self): - cmd = "env" - self.mock_subprocess.check_output.side_effect = RuntimeError - exitcode, _ = util.execute_shell_command(cmd) - self.assertEqual(exitcode, -1) |