From 01f25b9ed0f203eda46f1f49461efae9b17cab5b Mon Sep 17 00:00:00 2001 From: Alex Yang Date: Mon, 30 Oct 2017 10:37:48 +0800 Subject: Missing parameters in tempest In patch 45763, client parameters were missed in some functions. Change-Id: Id311e9ee6c0f7b24fe81832e2de9787e4f5693d7 Signed-off-by: Alex Yang --- deploy/tempest.py | 24 ++++++++++++------------ tests/unit/test_tempest.py | 3 ++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/deploy/tempest.py b/deploy/tempest.py index dc0847fa..b28e1265 100644 --- a/deploy/tempest.py +++ b/deploy/tempest.py @@ -52,9 +52,9 @@ def parse(conf, args): def print_bar(msg): - print ("--------------------------------------------") - print (msg) - print ("--------------------------------------------") + print("--------------------------------------------") + print(msg) + print("--------------------------------------------") def get_configure_from_daisyconf(section, key): @@ -72,7 +72,7 @@ def get_endpoint(file_path): return daisy_endpoint -def prepare_install(): +def prepare_install(client): global deployment_interface try: print("get config...") @@ -88,17 +88,17 @@ def prepare_install(): cluster_id = clusters_info.id print("cluster_id=%s." % cluster_id) print("update network...") - update_network(cluster_id, network_map) + update_network(cluster_id, network_map, client) print("build pxe server to install os...") deployment_interface = get_configure_from_daisyconf("PXE", "eth_name") build_pxe_for_discover(cluster_id, client, deployment_interface) elif conf['host'] and conf['host'] == 'yes': isbare = False if 'isbare' in conf and conf['isbare'] == 0 else True print("discover host...") - discover_host(hosts_name) + discover_host(hosts_name, client) time.sleep(10) print("update hosts interface...") - hosts_info = get_hosts() + hosts_info = get_hosts(client) cluster_info = get_cluster(client) cluster_id = cluster_info.id add_hosts_interface(cluster_id, hosts_info, mac_address_map, @@ -162,9 +162,9 @@ def install_os_for_vm_step2(cluster_id, client): client.install.install(**cluster_meta) -def discover_host(hosts_name): +def discover_host(hosts_name, client): while True: - hosts_info = get_hosts() + hosts_info = get_hosts(client) if len(hosts_info) == len(hosts_name): print('discover hosts success!') break @@ -271,7 +271,7 @@ def enable_cinder_backend(cluster_id, service_name, disk_name, protocol_type, cl try: client.disk_array.service_disk_add(**service_disk_meta) except Exception as e: - print e + print(e) def enable_opendaylight(cluster_id, layer, client): @@ -295,10 +295,10 @@ def enable_opendaylight(cluster_id, layer, client): try: client.roles.update(lb_role_id, **neutron_backend_info) except Exception as e: - print e + print(e) if __name__ == "__main__": daisy_endpoint = get_endpoint(daisyrc_path) client = daisy_client.Client(version=daisy_version, endpoint=daisy_endpoint) - prepare_install() + prepare_install(client) diff --git a/tests/unit/test_tempest.py b/tests/unit/test_tempest.py index 34ab4073..b03b3c0f 100644 --- a/tests/unit/test_tempest.py +++ b/tests/unit/test_tempest.py @@ -121,7 +121,8 @@ def test_install_os_for_vm_step2(): def test_discover_host(mock_get_hosts, mock_sleep): hosts_name = ['computer01', 'computer02', 'controller01', 'controller02', 'controller03'] mock_get_hosts.return_value = hosts_name - discover_host(hosts_name) + client = StubTestClient() + discover_host(hosts_name, client) mock_sleep.assert_not_called() -- cgit 1.2.3-korg