diff options
author | zhifeng.jiang <jiang.zhifeng@zte.com.cn> | 2016-09-15 15:01:38 +0800 |
---|---|---|
committer | zhifeng.jiang <jiang.zhifeng@zte.com.cn> | 2016-09-15 15:56:44 +0800 |
commit | fac2a3bff97efed6d4e50bfe249c8107100b8f52 (patch) | |
tree | a7e7bf2ae5b4147e0600a62d3e7cfc996d859f34 /tests | |
parent | 471817a86ae20cb288347fbedcb865ac7e31e60f (diff) |
Bugfix:iperf benchmark run failed "privateip1 is undefined"
modification:
get privatedip1 var when role is '2-host'
run on localhost once instead of twice
Change-Id: I4155f2d0c45208c4a2a0e2844fdf87acb5c8575e
Signed-off-by: zhifeng.jiang <jiang.zhifeng@zte.com.cn>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/driver_test.py | 11 | ||||
-rw-r--r-- | tests/output/hosts | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/tests/driver_test.py b/tests/driver_test.py index 71f01b0e..9162ca16 100644 --- a/tests/driver_test.py +++ b/tests/driver_test.py @@ -41,7 +41,7 @@ class TestClass: 'ip1': '10.20.0.13', 'ip2': '', 'installer': 'joid', - "privateip1": "NONE", + 'privateip1': 'NONE', 'workingdir': '/home', 'fname': 'iperf_vm.yaml', 'username': 'ubuntu', @@ -50,9 +50,10 @@ class TestClass: 'bandwidthGbps': 0, "role": "1-server"}, {'Dest_dir': 'results', - 'ip1': '', + 'ip1': '10.20.0.13', 'ip2': '', 'installer': 'joid', + 'privateip1': 'NONE', 'workingdir': '/home', 'fname': 'iperf_vm.yaml', 'username': 'ubuntu', @@ -61,13 +62,13 @@ class TestClass: 'bandwidthGbps': 0, "role": "2-host"}]) ]) - @mock.patch('func.driver.AnsibleApi') + @mock.patch('func.driver.AnsibleApi.execute_playbook') def test_driver_success(self, mock_ansible, test_input, expected): - mock_ansible.execute_playbook.return_value = True + mock_ansible.return_value = True dri = Driver() 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 + call_list = mock_ansible.call_args_list for call in call_list: call_args, call_kwargs = call real_call = call_args[3] diff --git a/tests/output/hosts b/tests/output/hosts index b380e475..9b47df0e 100644 --- a/tests/output/hosts +++ b/tests/output/hosts @@ -1,5 +1,3 @@ [host] 10.20.0.29 10.20.0.28 -[localhost] -127.0.0.1 |