summaryrefslogtreecommitdiffstats
path: root/legacy/tests/args_handler_test.py
diff options
context:
space:
mode:
authorYujun Zhang <zhang.yujunz@zte.com.cn>2017-01-08 09:48:31 +0800
committerYujun Zhang <zhang.yujunz@zte.com.cn>2017-01-11 15:14:16 +0800
commit23b627df622eeafafa215ce19764310c1d55dd55 (patch)
treed92c4c9b8a50a03461a40d2a2aba67bc7312041a /legacy/tests/args_handler_test.py
parent23f48e46a46976ae6f6d97aea11440e6a8b63121 (diff)
Reorganize the project folders
Code from Brahmaputra is no longer maintained, including: - docker - playbooks - scripts - utils They are moved to legacy folder to avoid unnecessary confusion to new developers. Change-Id: Ia50383ca5c3bd82571eb7b2184e7f83e264ff8a7 Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
Diffstat (limited to 'legacy/tests/args_handler_test.py')
-rw-r--r--legacy/tests/args_handler_test.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/legacy/tests/args_handler_test.py b/legacy/tests/args_handler_test.py
new file mode 100644
index 00000000..dceca1f5
--- /dev/null
+++ b/legacy/tests/args_handler_test.py
@@ -0,0 +1,36 @@
+##############################################################################
+# Copyright (c) 2016 ZTE Corp 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
+##############################################################################
+import pytest
+import mock
+import qtip.utils.args_handler
+
+
+@pytest.mark.xfail(reason="to be fixed")
+class TestClass:
+ @pytest.mark.parametrize("test_input, expected", [
+ (['fuel', '/home', 'benchmarks/testplan/default/network/iperf_bm.yaml'],
+ ['fuel', '/home', "iperf",
+ [('1-server', ['10.20.0.23']), ('2-host', ['10.20.0.24'])],
+ "iperf_bm.yaml",
+ [('duration', 20), ('protocol', 'tcp'), ('bandwidthGbps', 10)],
+ [("10.20.0.24", [None]), ("10.20.0.23", [None])], {}])
+ ])
+ @mock.patch('qtip.utils.args_handler.Env_setup.call_ping_test')
+ @mock.patch('qtip.utils.args_handler.Env_setup.call_ssh_test')
+ @mock.patch('qtip.utils.args_handler.Env_setup.update_ansible')
+ @mock.patch('qtip.utils.args_handler.SpawnVM')
+ @mock.patch('qtip.utils.args_handler.Driver.drive_bench')
+ def test_prepare_and_run_benchmark_successful(self, mock_driver, mock_sqawn_vm, mock_env_setup_ping,
+ mock_env_setup_ssh, mock_update_ansible, test_input, expected):
+ mock_ips = mock.Mock(return_value=["10.20.0.23", "10.20.0.24"])
+ qtip.utils.args_handler.Env_setup.fetch_compute_ips = mock_ips
+ qtip.utils.args_handler.prepare_and_run_benchmark(test_input[0], test_input[1], test_input[2])
+ call = mock_driver.call_args
+ call_args, call_kwargs = call
+ assert sorted(map(sorted, call_args)) == sorted(map(sorted, expected))