diff --git a/test/integration/smoke/test_deploy_vm.py b/test/integration/smoke/test_deploy_vm.py index 5a2695d72b2..e7e0dc464a7 100644 --- a/test/integration/smoke/test_deploy_vm.py +++ b/test/integration/smoke/test_deploy_vm.py @@ -42,7 +42,6 @@ class TestDeployVM(cloudstackTestCase): self.apiclient = self.testClient.getApiClient() self.testdata = self.testClient.getParsedTestDataConfig() - # Get Zone, Domain and Default Built-in template self.domain = get_domain(self.apiclient) self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests()) @@ -116,7 +115,7 @@ class TestDeployVM(cloudstackTestCase): """Test Multiple Deploy Virtual Machine # Validate the following: - # 1. deploy 2 virtual machines + # 1. deploy 2 virtual machines # 2. listVirtualMachines using 'ids' parameter returns accurate information """ self.virtual_machine = VirtualMachine.create( @@ -206,7 +205,7 @@ class TestDeployVMVolumeCreationFailure(cloudstackTestCase): self.mock_volume_failure ] - @attr(tags = ['selfservice']) + @attr(tags = ['selfservice'],BugId="CLOUDSTACK-6708") def test_deploy_vm_volume_creation_failure(self): """Test Deploy Virtual Machine - volume creation failure and retry diff --git a/test/integration/smoke/test_hosts.py b/test/integration/smoke/test_hosts.py index 52827aa7fed..7798c8eb3dd 100644 --- a/test/integration/smoke/test_hosts.py +++ b/test/integration/smoke/test_hosts.py @@ -5,9 +5,9 @@ # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -23,6 +23,7 @@ from marvin.cloudstackAPI import * from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * +from marvin.lib.utils import (random_gen) from nose.plugins.attrib import attr #Import System modules @@ -66,21 +67,22 @@ class TestHosts(cloudstackTestCase): #Create clusters with Hypervisor type Simulator/XEN/KVM/VWare """ for k, v in self.services["clusters"].items(): + v["clustername"] = v["clustername"] + "-" + random_gen() cluster = Cluster.create( self.apiclient, v, zoneid=self.zone.id, podid=self.pod.id, - hypervisor=self.hypervisor + hypervisor=v["hypervisor"].lower() ) self.debug( "Created Cluster for hypervisor type %s & ID: %s" %( v["hypervisor"], - cluster.id + cluster.id )) self.assertEqual( - cluster.hypervisortype, - v["hypervisor"], + cluster.hypervisortype.lower(), + v["hypervisor"].lower(), "Check hypervisor type is " + v["hypervisor"] + " or not" ) self.assertEqual( @@ -103,7 +105,7 @@ class TestHosts(cloudstackTestCase): self.services["hosts"][hypervisor_type], zoneid=self.zone.id, podid=self.pod.id, - hypervisor=self.hypervisor + hypervisor=v["hypervisor"].lower() ) if host == FAILED: self.fail("Host Creation Failed") @@ -112,9 +114,8 @@ class TestHosts(cloudstackTestCase): host.id, cluster.id )) - - #Cleanup Host & Cluster - self.cleanup.append(host) + #Cleanup Host & Cluster + self.cleanup.append(host) self.cleanup.append(cluster) list_hosts_response = list_hosts( @@ -162,8 +163,8 @@ class TestHosts(cloudstackTestCase): "Check cluster ID with list clusters response" ) self.assertEqual( - cluster_response.hypervisortype, - cluster.hypervisortype, + cluster_response.hypervisortype.lower(), + cluster.hypervisortype.lower(), "Check hypervisor type with is " + v["hypervisor"] + " or not" ) return diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py index a9e0c25a36d..838f4a30594 100644 --- a/test/integration/smoke/test_network.py +++ b/test/integration/smoke/test_network.py @@ -5,9 +5,9 @@ # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -159,16 +159,10 @@ class TestPublicIP(cloudstackTestCase): self.apiclient, id=ip_address.ipaddress.id ) - self.assertEqual( - isinstance(list_pub_ip_addr_resp, list), - True, - "Check list response returns a valid list" - ) - self.assertEqual( - len(list_pub_ip_addr_resp), - 0, - "Check if the list public ip api response is not zero" - ) + if list_pub_ip_addr_resp is None: + return + if (list_pub_ip_addr_resp) and (isinstance(list_pub_ip_addr_resp, list)) and (len(list_pub_ip_addr_resp) > 0): + self.fail("list public ip response is not empty") return @attr(tags = ["advanced", "advancedns", "smoke", "selfservice"]) @@ -327,7 +321,7 @@ class TestPortForwarding(cloudstackTestCase): 'Running', "VM state should be Running before creating a NAT rule." ) - # Open up firewall port for SSH + # Open up firewall port for SSH fw_rule = FireWallRule.create( self.apiclient, ipaddressid=src_nat_ip_addr.id, @@ -380,7 +374,7 @@ class TestPortForwarding(cloudstackTestCase): ) if vm_response[0].state != 'Running': self.fail("State of VM : %s is not found to be Running" % str(self.virtual_machine.ipaddress)) - + except Exception as e: self.fail( "SSH Access failed for %s: %s" % \ @@ -449,7 +443,7 @@ class TestPortForwarding(cloudstackTestCase): 'Running', "VM state should be Running before creating a NAT rule." ) - # Open up firewall port for SSH + # Open up firewall port for SSH fw_rule = FireWallRule.create( self.apiclient, ipaddressid=ip_address.ipaddress.id, @@ -785,7 +779,7 @@ class TestReleaseIP(cloudstackTestCase): self.ip_address.delete(self.apiclient) - # Sleep to ensure that deleted state is reflected in other calls + # Sleep to ensure that deleted state is reflected in other calls time.sleep(self.services["sleep"]) # ListPublicIpAddresses should not list deleted Public IP address diff --git a/test/integration/smoke/test_routers.py b/test/integration/smoke/test_routers.py index 2aa83c32c6a..1c8e747d68b 100644 --- a/test/integration/smoke/test_routers.py +++ b/test/integration/smoke/test_routers.py @@ -5,9 +5,9 @@ # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -183,9 +183,6 @@ class TestRouterServices(cloudstackTestCase): return - - - @attr(tags = ["advanced", "smoke", "provisioning"]) def test_02_router_internal_adv(self): """Test router internal advanced zone @@ -206,7 +203,6 @@ class TestRouterServices(cloudstackTestCase): True, "Check list response returns a valid list" ) - router = list_router_response[0] hosts = list_hosts( @@ -255,7 +251,6 @@ class TestRouterServices(cloudstackTestCase): self.skipTest("Marvin configuration has no host credentials to check router services") res = str(result) self.debug("Dnsmasq process status: %s" % res) - self.assertEqual( res.count("running"), 1, @@ -464,7 +459,6 @@ class TestRouterServices(cloudstackTestCase): ) except KeyError: self.skipTest("Marvin configuration has no host credentials to check router services") - # res = 12:37:14 up 1 min, 0 users, load average: 0.61, 0.22, 0.08 # Split result to check the uptime result = res[0].split() @@ -656,7 +650,6 @@ class TestRouterServices(cloudstackTestCase): "Check list response returns a valid list" ) router = list_router_response[0] - self.debug("Stopping the router with ID: %s" % router.id) #Stop the router cmd = stopRouter.stopRouterCmd() @@ -726,6 +719,13 @@ class TestRouterServices(cloudstackTestCase): ) return + def verifyRouterResponse(self,router_response,ip): + if (router_response) and (isinstance(router_response, list)) and \ + (router_response[0].state == "Running") and \ + (router_response[0].publicip == ip): + return True + return False + @attr(tags = ["advanced", "advancedns", "smoke", "selfservice"]) def test_09_reboot_router(self): """Test reboot router @@ -749,32 +749,22 @@ class TestRouterServices(cloudstackTestCase): public_ip = router.publicip self.debug("Rebooting the router with ID: %s" % router.id) - #Reboot the router cmd = rebootRouter.rebootRouterCmd() cmd.id = router.id self.apiclient.rebootRouter(cmd) #List routers to check state of router - router_response = list_routers( + retries_cnt = 6 + while retries_cnt >= 0: + router_response = list_routers( self.apiclient, id=router.id ) - self.assertEqual( - isinstance(router_response, list), - True, - "Check list response returns a valid list" - ) - #List router should have router in running state and same public IP - self.assertEqual( - router_response[0].state, - 'Running', - "Check list router response for router state" - ) - - self.assertEqual( - router_response[0].publicip, - public_ip, - "Check list router response for router public IP" - ) + if self.verifyRouterResponse(router_response,public_ip): + self.debug("Router is running successfully after reboot") + return + time.sleep(10) + retries_cnt = retries_cnt - 1 + self.fail("Router response after reboot is either is invalid or in stopped state") return diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py index f114ec9024b..2219d088e58 100644 --- a/test/integration/smoke/test_vm_life_cycle.py +++ b/test/integration/smoke/test_vm_life_cycle.py @@ -507,14 +507,14 @@ class TestVMLifeCycle(cloudstackTestCase): # For XenServer and VMware, migration is possible between hosts belonging to different clusters # with the help of XenMotion and Vmotion respectively. - if hypervisor == "kvm": + if hypervisor.lower() in ["kvm","simulator"]: #identify suitable host clusters = [h.clusterid for h in hosts] #find hosts withe same clusterid clusters = [cluster for index, cluster in enumerate(clusters) if clusters.count(cluster) > 1] if len(clusters) <= 1: - self.skipTest("In KVM, Live Migration needs two hosts within same cluster") + self.skipTest("In " + hypervisor.lower() + " Live Migration needs two hosts within same cluster") suitable_hosts = [host for host in hosts if host.clusterid == clusters[0]] else: @@ -567,7 +567,7 @@ class TestVMLifeCycle(cloudstackTestCase): @attr(configuration = "expunge.interval") @attr(configuration = "expunge.delay") - @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg", "selfservice"]) + @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg", "selfservice"],BugId="CLOUDSTACK-6708") def test_09_expunge_vm(self): """Test destroy(expunge) Virtual Machine """ @@ -595,7 +595,7 @@ class TestVMLifeCycle(cloudstackTestCase): name='expunge.interval' ) expunge_cycle = int(config[0].value) - wait_time = expunge_cycle * 2 + wait_time = expunge_cycle * 4 while wait_time >= 0: list_vm_response = list_virtual_machines( self.apiclient,