aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/tests/driver_test.py
diff options
context:
space:
mode:
authorzhihui wu <zhihui.wu2006+zte@gmail.com>2017-03-15 01:28:02 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-03-15 01:28:02 +0000
commitdeb48720a34ff36d23d777b9a9a1b4f73c17d80d (patch)
treef704ac8a24c5e74c7982d0ad3c49cab9f355baa2 /legacy/tests/driver_test.py
parentfef1092cdb5a28d8d39eff94dbbd0dd187a16971 (diff)
parent63c002a51ff072c911d3b89296b627b16983f5a0 (diff)
Merge "Remove legacy code from stable branch" into stable/danube
Diffstat (limited to 'legacy/tests/driver_test.py')
-rw-r--r--legacy/tests/driver_test.py103
1 files changed, 0 insertions, 103 deletions
diff --git a/legacy/tests/driver_test.py b/legacy/tests/driver_test.py
deleted file mode 100644
index abe8cfbb..00000000
--- a/legacy/tests/driver_test.py
+++ /dev/null
@@ -1,103 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation 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
-from qtip.utils.driver import Driver
-from os.path import expanduser
-
-HOME_DIR = expanduser('~')
-
-
-class TestClass:
- @pytest.mark.parametrize("test_input, expected", [
- (['fuel',
- '/home',
- "iperf",
- [('host', ['10.20.0.13', '10.20.0.15'])],
- "iperf_bm.yaml",
- [('duration', 20), ('protocol', 'tcp'), ('bandwidthGbps', 0)],
- [("10.20.0.13", [None]), ("10.20.0.15", [None])],
- {'http_proxy': 'http://10.20.0.1:8118',
- 'https_proxy': 'http://10.20.0.1:8118',
- 'no_proxy': 'localhost,127.0.0.1,10.20.*,192.168.*'}],
- [{'Dest_dir': HOME_DIR + '/qtip/results',
- 'ip1': '',
- 'ip2': '',
- 'installer': 'fuel',
- 'workingdir': '/home',
- 'fname': 'iperf_bm.yaml',
- 'username': 'root',
- 'http_proxy': 'http://10.20.0.1:8118',
- 'https_proxy': 'http://10.20.0.1:8118',
- 'no_proxy': 'localhost,127.0.0.1,10.20.*,192.168.*',
- 'duration': 20,
- 'protocol': 'tcp',
- 'bandwidthGbps': 0,
- "role": "host"}]),
- (['joid',
- '/home',
- "iperf",
- [('1-server', ['10.20.0.13']), ('2-host', ['10.20.0.15'])],
- "iperf_vm.yaml",
- [('duration', 20), ('protocol', 'tcp'), ('bandwidthGbps', 0)],
- [('1-server', '10.10.17.4'), ('2-host', '10.10.17.5')],
- {}],
- [{'Dest_dir': HOME_DIR + '/qtip/results',
- 'ip1': '10.20.0.13',
- 'ip2': '',
- 'installer': 'joid',
- 'privateip1': '10.10.17.4',
- 'workingdir': '/home',
- 'fname': 'iperf_vm.yaml',
- 'username': 'ubuntu',
- 'duration': 20,
- 'protocol': 'tcp',
- 'bandwidthGbps': 0,
- "role": "1-server"},
- {'Dest_dir': HOME_DIR + '/qtip/results',
- 'ip1': '10.20.0.13',
- 'ip2': '',
- 'installer': 'joid',
- 'privateip1': '10.10.17.4',
- 'workingdir': '/home',
- 'fname': 'iperf_vm.yaml',
- 'username': 'ubuntu',
- 'duration': 20,
- 'protocol': 'tcp',
- 'bandwidthGbps': 0,
- "role": "2-host"}])
- ])
- @mock.patch('qtip.utils.driver.AnsibleApi.execute_playbook')
- @mock.patch('qtip.utils.driver.AnsibleApi.get_detail_playbook_stats')
- def test_driver_success(self, mock_stats, mock_ansible, test_input, expected):
- mock_ansible.return_value = True
- mock_stats.return_value = [(u'10.20.6.14', {'unreachable': 0,
- 'skipped': 13,
- 'ok': 27,
- 'changed': 26,
- 'failures': 0}),
- ('localhost', {'unreachable': 0,
- 'skipped': 0,
- 'ok': 6,
- 'changed': 6,
- 'failures': 0}),
- (u'10.20.6.13', {'unreachable': 0,
- 'skipped': 13,
- 'ok': 27,
- 'changed': 26,
- 'failures': 0})]
- dri = Driver()
- result = dri.drive_bench(test_input[0], test_input[1], test_input[2], test_input[3],
- test_input[4], test_input[5], test_input[6], test_input[7])
- call_list = mock_ansible.call_args_list
- for call in call_list:
- call_args, call_kwargs = call
- real_call = call_args[3]
- assert real_call == expected[call_list.index(call)]
- assert result['result'] == 0