diff options
author | Jing Lu <lvjing5@huawei.com> | 2017-05-04 12:18:01 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-05-04 12:18:01 +0000 |
commit | 430408c60b3bd6470ce6d9c0401053d13945a71d (patch) | |
tree | 7d1d669b44ee596306e041c28995c46768b74270 /tests | |
parent | 21ef1349d65eea760c4545ed6e3cb8a49288a910 (diff) | |
parent | 2fb95fbb9380ea7ce92dcb32cd2f0789b9f91bdc (diff) |
Merge "Bugfix: Local Openstack Operation in HA test frameworks"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/opnfv/test_cases/opnfv_yardstick_tc052.yaml | 2 | ||||
-rw-r--r-- | tests/unit/benchmark/scenarios/availability/test_util.py | 32 |
2 files changed, 32 insertions, 2 deletions
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc052.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc052.yaml index 6e060b15d..4254e79b6 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc052.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc052.yaml @@ -40,7 +40,6 @@ scenarios: operation_type: "general-operation" key: "create-flavor" operation_key: "nova-create-flavor" - host: node1 action_parameter: flavorconfig: "test-001 test-001 100 1 1" rollback_parameter: @@ -50,7 +49,6 @@ scenarios: - checker_type: "general-result-checker" key: "check-flavor" - host: node1 checker_key: "nova-flavor-checker" expectedValue: "test-001" condition: "in" diff --git a/tests/unit/benchmark/scenarios/availability/test_util.py b/tests/unit/benchmark/scenarios/availability/test_util.py new file mode 100644 index 000000000..bb0e6bc79 --- /dev/null +++ b/tests/unit/benchmark/scenarios/availability/test_util.py @@ -0,0 +1,32 @@ +#!/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 + +@mock.patch('yardstick.benchmark.scenarios.availability.util.subprocess') +class ExecuteShellTestCase(unittest.TestCase): + + def test__fun_execute_shell_command_successful(self, mock_subprocess): + cmd = "env" + mock_subprocess.check_output.return_value = (0, 'unittest') + exitcode, output = util.execute_shell_command(cmd) + self.assertEqual(exitcode, 0) + + def test__fun_execute_shell_command_fail_cmd_exception(self, mock_subprocess): + cmd = "env" + mock_subprocess.check_output.side_effect = RuntimeError + exitcode, output = util.execute_shell_command(cmd) + self.assertEqual(exitcode, -1) |