diff options
Diffstat (limited to 'tests/functional')
-rwxr-xr-x | tests/functional/__init__.py | 0 | ||||
-rwxr-xr-x | tests/functional/test_cli_runner.py | 49 | ||||
-rwxr-xr-x | tests/functional/test_cli_scenario.py | 56 | ||||
-rwxr-xr-x | tests/functional/utils.py | 63 |
4 files changed, 0 insertions, 168 deletions
diff --git a/tests/functional/__init__.py b/tests/functional/__init__.py deleted file mode 100755 index e69de29bb..000000000 --- a/tests/functional/__init__.py +++ /dev/null diff --git a/tests/functional/test_cli_runner.py b/tests/functional/test_cli_runner.py deleted file mode 100755 index 620edc396..000000000 --- a/tests/functional/test_cli_runner.py +++ /dev/null @@ -1,49 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. -# -# 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 -############################################################################## - - -from __future__ import absolute_import -import unittest - -from tests.functional import utils - - -class RunnerTestCase(unittest.TestCase): - - def setUp(self): - super(RunnerTestCase, self).setUp() - self.yardstick = utils.Yardstick() - - def test_runner_list(self): - res = self.yardstick("runner list") - - self.assertIn("Duration", res) - self.assertIn("Arithmetic", res) - self.assertIn("Iteration", res) - self.assertIn("Sequence", res) - - def test_runner_show_Duration(self): - res = self.yardstick("runner show Duration") - duration = "duration - amount of time" in res - self.assertTrue(duration) - - def test_runner_show_Arithmetic(self): - res = self.yardstick("runner show Arithmetic") - arithmetic = "Run a scenario arithmetically" in res - self.assertTrue(arithmetic) - - def test_runner_show_Iteration(self): - res = self.yardstick("runner show Iteration") - iteration = "iterations - amount of times" in res - self.assertTrue(iteration) - - def test_runner_show_Sequence(self): - res = self.yardstick("runner show Sequence") - sequence = "sequence - list of values which are executed" in res - self.assertTrue(sequence) diff --git a/tests/functional/test_cli_scenario.py b/tests/functional/test_cli_scenario.py deleted file mode 100755 index 63b533b85..000000000 --- a/tests/functional/test_cli_scenario.py +++ /dev/null @@ -1,56 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. -# -# 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 -############################################################################## - - -from __future__ import absolute_import -import unittest - -from tests.functional import utils - - -class ScenarioTestCase(unittest.TestCase): - - def setUp(self): - super(ScenarioTestCase, self).setUp() - self.yardstick = utils.Yardstick() - - def test_scenario_list(self): - res = self.yardstick("scenario list") - - self.assertIn("Lmbench", res) - self.assertIn("Perf", res) - self.assertIn("Fio", res) - self.assertIn("Ping", res) - self.assertIn("Iperf3", res) - self.assertIn("Pktgen", res) - - def test_scenario_show_Lmbench(self): - res = self.yardstick("scenario show Lmbench") - self.assertIn("Execute lmbench memory read latency or memory " - "bandwidth benchmark in a hos", res) - - def test_scenario_show_Perf(self): - res = self.yardstick("scenario show Perf") - self.assertIn("Execute perf benchmark in a host", res) - - def test_scenario_show_Fio(self): - res = self.yardstick("scenario show Fio") - self.assertIn("Execute fio benchmark in a host", res) - - def test_scenario_show_Ping(self): - res = self.yardstick("scenario show Ping") - self.assertIn("Execute ping between two hosts", res) - - def test_scenario_show_Iperf3(self): - res = self.yardstick("scenario show Iperf3") - self.assertIn("Execute iperf3 between two hosts", res) - - def test_scenario_show_Pktgen(self): - res = self.yardstick("scenario show Pktgen") - self.assertIn("Execute pktgen between two hosts", res) diff --git a/tests/functional/utils.py b/tests/functional/utils.py deleted file mode 100755 index b96d2dd50..000000000 --- a/tests/functional/utils.py +++ /dev/null @@ -1,63 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. -# -# 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 -############################################################################## - -from __future__ import absolute_import - -import copy -import os -import subprocess - -from oslo_serialization import jsonutils -from oslo_utils import encodeutils - - -class Yardstick(object): - """Create and represent separate yardstick installation. - - Usage: - yardstick = yardstick() - output = yardstick("runner list") - - """ - - def __init__(self, fake=False): - - self.args = ["yardstick"] - self.env = copy.deepcopy(os.environ) - - def __del__(self): - pass - - def __call__(self, cmd, getjson=False, report_path=None, raw=False, - suffix=None, extension=None, keep_old=False, - write_report=False): - """Call yardstick in the shell - - :param cmd: yardstick command - :param getjson: in cases, when yardstick prints JSON, you can catch - output deserialized - TO DO: - :param report_path: if present, yardstick command and its output will - be written to file with passed file name - :param raw: don't write command itself to report file. Only output - will be written - """ - - if not isinstance(cmd, list): - cmd = cmd.split(" ") - try: - output = encodeutils.safe_decode(subprocess.check_output( - self.args + cmd, stderr=subprocess.STDOUT, env=self.env), - 'utf-8') - - if getjson: - return jsonutils.loads(output) - return output - except subprocess.CalledProcessError as e: - raise e |