summaryrefslogtreecommitdiffstats
path: root/tests/driver_test.py
diff options
context:
space:
mode:
authorzhifeng.jiang <jiang.zhifeng@zte.com.cn>2016-09-04 10:03:03 +0800
committerzhifeng jiang <jiang.zhifeng@zte.com.cn>2016-09-08 11:23:35 +0000
commit6612d7c20e329cd5b133a41a6b35c67539f3369b (patch)
tree9d977adb46d347b980b0f49756e5607907d346fe /tests/driver_test.py
parentcf0b4338abd0dc4f8a835440db7c662a37e92911 (diff)
Remove os environment in driver.py so that it can be called by restful server
modification: Change os environments to parameters in driver.py Pass the parameters in cli.py and arg_handler.py JIRA:QTIP-97 Change-Id: Id67acb7e0ac46fa9e0e32481e947055b6d37dd95 Signed-off-by: zhifeng.jiang <jiang.zhifeng@zte.com.cn>
Diffstat (limited to 'tests/driver_test.py')
-rw-r--r--tests/driver_test.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/tests/driver_test.py b/tests/driver_test.py
index 9517d26d..71f01b0e 100644
--- a/tests/driver_test.py
+++ b/tests/driver_test.py
@@ -1,20 +1,20 @@
import pytest
import mock
-import os
from func.driver import Driver
class TestClass:
@pytest.mark.parametrize("test_input, expected", [
- (["iperf",
+ (['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.*'},
- 'fuel'],
+ 'no_proxy': 'localhost,127.0.0.1,10.20.*,192.168.*'}],
[{'Dest_dir': 'results',
'ip1': '',
'ip2': '',
@@ -29,13 +29,14 @@ class TestClass:
'protocol': 'tcp',
'bandwidthGbps': 0,
"role": "host"}]),
- (["iperf",
+ (['joid',
+ '/home',
+ "iperf",
[('1-server', ['10.20.0.13']), ('2-host', ['10.20.0.15'])],
"iperf_vm.yaml",
[('duration', 20), ('protocol', 'tcp'), ('bandwidthGbps', 0)],
[("10.20.0.13", [None]), ("10.20.0.15", [None])],
- {},
- 'joid'],
+ {}],
[{'Dest_dir': 'results',
'ip1': '10.20.0.13',
'ip2': '',
@@ -63,12 +64,10 @@ class TestClass:
@mock.patch('func.driver.AnsibleApi')
def test_driver_success(self, mock_ansible, test_input, expected):
mock_ansible.execute_playbook.return_value = True
- k = mock.patch.dict(os.environ, {'INSTALLER_TYPE': test_input[6], 'PWD': '/home'})
- k.start()
dri = Driver()
- dri.drive_bench(test_input[0], test_input[1], test_input[2], test_input[3], test_input[4], test_input[5])
+ 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.execute_playbook.call_args_list
- k.stop()
for call in call_list:
call_args, call_kwargs = call
real_call = call_args[3]