Missing parameters in tempest 03/46403/1
authorAlex Yang <yangyang1@zte.com.cn>
Mon, 30 Oct 2017 02:37:48 +0000 (10:37 +0800)
committerAlex Yang <yangyang1@zte.com.cn>
Mon, 30 Oct 2017 02:37:48 +0000 (10:37 +0800)
In patch 45763, client parameters were missed in some functions.

Change-Id: Id311e9ee6c0f7b24fe81832e2de9787e4f5693d7
Signed-off-by: Alex Yang <yangyang1@zte.com.cn>
deploy/tempest.py
tests/unit/test_tempest.py

index dc0847f..b28e126 100644 (file)
@@ -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)
index 34ab407..b03b3c0 100644 (file)
@@ -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()