This is an automated email from the ASF dual-hosted git repository. rohit pushed a commit to branch debian9-systemvmtemplate in repository https://gitbox.apache.org/repos/asf/cloudstack.git
commit 5b2c68e38a2c549e9e0eb5b35606a8442672ea91 Author: Rohit Yadav <rohit.ya...@shapeblue.com> AuthorDate: Mon Dec 11 21:40:49 2017 +0530 use new get_test_templates Signed-off-by: Rohit Yadav <rohit.ya...@shapeblue.com> --- test/integration/smoke/test_accounts.py | 22 +++++++------ test/integration/smoke/test_affinity_groups.py | 10 +++--- .../smoke/test_affinity_groups_projects.py | 11 ++++--- test/integration/smoke/test_deploy_vm_iso.py | 7 +++-- test/integration/smoke/test_host_maintenance.py | 6 ++-- test/integration/smoke/test_hostha_kvm.py | 4 +-- test/integration/smoke/test_list_ids_parameter.py | 10 +++--- .../smoke/test_nested_virtualization.py | 15 +++++---- test/integration/smoke/test_network.py | 36 +++++++++++----------- test/integration/smoke/test_nic.py | 6 ++-- test/integration/smoke/test_projects.py | 7 +++-- test/integration/smoke/test_reset_vm_on_reboot.py | 7 +++-- test/integration/smoke/test_router_dhcphosts.py | 12 +++++--- test/integration/smoke/test_vpc_router_nics.py | 30 ++++++++++-------- 14 files changed, 98 insertions(+), 85 deletions(-) diff --git a/test/integration/smoke/test_accounts.py b/test/integration/smoke/test_accounts.py index a64d922..00047bf 100644 --- a/test/integration/smoke/test_accounts.py +++ b/test/integration/smoke/test_accounts.py @@ -32,7 +32,7 @@ from marvin.lib.base import (Domain, PublicIPAddress) from marvin.lib.common import (get_domain, get_zone, - get_template, + get_test_template, list_accounts, list_virtual_machines, list_service_offering, @@ -128,11 +128,12 @@ class TestAccounts(cloudstackTestCase): cls.services = Services().services cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id @@ -270,11 +271,12 @@ class TestRemoveUserFromAccount(cloudstackTestCase): cls.services = Services().services cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id @@ -948,6 +950,7 @@ class TestAddVmToSubDomain(cloudstackTestCase): cls.services = Services().services cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype cls.sub_domain = Domain.create( cls.api_client, @@ -983,10 +986,10 @@ class TestAddVmToSubDomain(cloudstackTestCase): cls.sub_domain, cls.service_offering ] - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.vm_1 = VirtualMachine.create( @@ -1717,12 +1720,13 @@ class TestDomainForceRemove(cloudstackTestCase): cls.services = Services().services cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls.services["virtual_machine"]["zoneid"] = cls.zone.id diff --git a/test/integration/smoke/test_affinity_groups.py b/test/integration/smoke/test_affinity_groups.py index 3f78a84..64ec8ae 100644 --- a/test/integration/smoke/test_affinity_groups.py +++ b/test/integration/smoke/test_affinity_groups.py @@ -40,15 +40,16 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase): cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests()) - - cls.template = get_template( + cls.hypervisor = cls.testClient.getHypervisorInfo() + + cls.template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) if cls.template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] + assert False, "get_test_template() failed to return template" cls.services["virtual_machine"]["zoneid"] = cls.zone.id @@ -155,7 +156,6 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase): @classmethod def tearDownClass(cls): try: - #Clean up, terminate the created templates cleanup_resources(cls.apiclient, cls._cleanup) except Exception as e: raise Exception("Warning: Exception during cleanup : %s" % e) diff --git a/test/integration/smoke/test_affinity_groups_projects.py b/test/integration/smoke/test_affinity_groups_projects.py index 2e971c5..76401c6 100644 --- a/test/integration/smoke/test_affinity_groups_projects.py +++ b/test/integration/smoke/test_affinity_groups_projects.py @@ -40,16 +40,17 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase): cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests()) - - cls.template = get_template( + cls.hypervisor = cls.testClient.getHypervisorInfo() + + cls.template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) if cls.template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] - + assert False, "get_test_template() failed to return template" + cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["template"] = cls.template.id diff --git a/test/integration/smoke/test_deploy_vm_iso.py b/test/integration/smoke/test_deploy_vm_iso.py index 5298c48..f2273cb 100644 --- a/test/integration/smoke/test_deploy_vm_iso.py +++ b/test/integration/smoke/test_deploy_vm_iso.py @@ -28,7 +28,7 @@ from marvin.lib.base import (Account, DiskOffering) from marvin.lib.common import (get_zone, get_domain, - get_template) + get_test_template) from marvin.codes import PASS @@ -44,11 +44,12 @@ class TestDeployVMFromISO(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.testdata["ostype"] + cls.hypervisor ) # Create service, disk offerings etc diff --git a/test/integration/smoke/test_host_maintenance.py b/test/integration/smoke/test_host_maintenance.py index 94f964c..7fc2139 100644 --- a/test/integration/smoke/test_host_maintenance.py +++ b/test/integration/smoke/test_host_maintenance.py @@ -89,14 +89,14 @@ class TestHostMaintenance(cloudstackTestCase): def createVMs(self, hostId, number): - self.template = get_template( + self.template = get_test_template( self.apiclient, self.zone.id, - self.services["ostype"] + self.hypervisor ) if self.template == FAILED: - assert False, "get_template() failed to return template with description %s" % self.services["ostype"] + assert False, "get_test_template() failed to return template" self.logger.debug("Using template %s " % self.template.id) diff --git a/test/integration/smoke/test_hostha_kvm.py b/test/integration/smoke/test_hostha_kvm.py index cc44426..a153e15 100644 --- a/test/integration/smoke/test_hostha_kvm.py +++ b/test/integration/smoke/test_hostha_kvm.py @@ -80,10 +80,10 @@ class TestHAKVM(cloudstackTestCase): self.services["service_offerings"]["hasmall"] ) - self.template = get_template( + self.template = get_test_template( self.apiclient, self.zone.id, - self.services["ostype"] + self.hypervisor ) self.configureAndDisableHostHa() diff --git a/test/integration/smoke/test_list_ids_parameter.py b/test/integration/smoke/test_list_ids_parameter.py index cc45ce3..e5053cb 100755 --- a/test/integration/smoke/test_list_ids_parameter.py +++ b/test/integration/smoke/test_list_ids_parameter.py @@ -29,7 +29,7 @@ from marvin.lib.base import (Account, VmSnapshot, VirtualMachine) from marvin.lib.common import (get_domain, - get_zone, get_template) + get_zone, get_test_template) from marvin.codes import FAILED, PASS from nose.plugins.attrib import attr #Import System modules @@ -62,14 +62,14 @@ class TestListIdsParams(cloudstackTestCase): cls.services["service_offerings"]["tiny"] ) - template = get_template( + template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) if template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] - + assert False, "get_test_template() failed to return template" + cls.services["template"]["ostypeid"] = template.ostypeid cls.services["template_2"]["ostypeid"] = template.ostypeid cls.services["ostypeid"] = template.ostypeid diff --git a/test/integration/smoke/test_nested_virtualization.py b/test/integration/smoke/test_nested_virtualization.py index 3b03f77..c10dd2f 100755 --- a/test/integration/smoke/test_nested_virtualization.py +++ b/test/integration/smoke/test_nested_virtualization.py @@ -30,7 +30,7 @@ from marvin.lib.base import (Account, Network) from marvin.lib.common import (get_zone, get_domain, - get_template) + get_test_template) from nose.plugins.attrib import attr from marvin.sshClient import SshClient import logging @@ -49,6 +49,7 @@ class TestNestedVirtualization(cloudstackTestCase): cls.logger.addHandler(cls.stream_handler) cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) + cls.hypervisor = get_hypervisor_type(cls.apiclient) cls.services['mode'] = cls.zone.networktype cls.services["isolated_network"]["zoneid"] = cls.zone.id cls.domain = get_domain(cls.apiclient) @@ -57,13 +58,12 @@ class TestNestedVirtualization(cloudstackTestCase): cls.services["service_offerings"]["tiny"] ) cls.account = Account.create(cls.apiclient, services=cls.services["account"]) - cls.template = get_template( + cls.template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) - cls.hypervisor = get_hypervisor_type(cls.apiclient) - + cls.isolated_network_offering = NetworkOffering.create( cls.apiclient, cls.services["isolated_network_offering"]) @@ -71,8 +71,8 @@ class TestNestedVirtualization(cloudstackTestCase): cls.isolated_network_offering.update(cls.apiclient, state='Enabled') if cls.template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] - + assert False, "get_test_template() failed to return template" + cls.services["small"]["zoneid"] = cls.zone.id cls.services["small"]["template"] = cls.template.id @@ -149,4 +149,3 @@ class TestNestedVirtualization(cloudstackTestCase): cleanup_resources(cls.apiclient, cls.cleanup) except Exception, e: raise Exception("Cleanup failed with %s" % e) - \ No newline at end of file diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py index bb1e14b..f01f7bf 100644 --- a/test/integration/smoke/test_network.py +++ b/test/integration/smoke/test_network.py @@ -37,7 +37,7 @@ from marvin.lib.base import (Account, Router) from marvin.lib.common import (get_domain, get_zone, - get_template, + get_test_template, list_hosts, list_publicIP, list_nat_rules, @@ -258,14 +258,13 @@ class TestPortForwarding(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.apiclient) cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) - template = get_template( + template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) if template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services[ - "ostype"] + assert False, "get_test_template() failed to return template" # Create an account, network, VM and IP addresses cls.account = Account.create( @@ -583,15 +582,15 @@ class TestRebootRouter(cloudstackTestCase): # Get Zone, Domain and templates self.domain = get_domain(self.apiclient) self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests()) - template = get_template( + self.hypervisor = self.testClient.getHypervisorInfo() + template = get_test_template( self.apiclient, self.zone.id, - self.services["ostype"] + self.hypervisor ) if template == FAILED: - self.fail( - "get_template() failed to return template with description %s" % - self.services["ostype"]) + self.fail("get_test_template() failed to return template") + self.services["virtual_machine"]["zoneid"] = self.zone.id # Create an account, network, VM and IP addresses @@ -756,10 +755,11 @@ class TestReleaseIP(cloudstackTestCase): # Get Zone, Domain and templates self.domain = get_domain(self.apiclient) self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests()) - template = get_template( + self.hypervisor = self.testClient.getHypervisorInfo() + template = get_test_template( self.apiclient, self.zone.id, - self.services["ostype"] + self.hypervisor ) self.services["virtual_machine"]["zoneid"] = self.zone.id @@ -897,10 +897,11 @@ class TestDeleteAccount(cloudstackTestCase): # Get Zone, Domain and templates self.domain = get_domain(self.apiclient) self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests()) - template = get_template( + self.hypervisor = self.testClient.getHypervisorInfo() + template = get_test_template( self.apiclient, self.zone.id, - self.services["ostype"] + self.hypervisor ) self.services["virtual_machine"]["zoneid"] = self.zone.id @@ -1040,14 +1041,13 @@ class TestRouterRules(cloudstackTestCase): cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) cls.hypervisor = testClient.getHypervisorInfo() cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ - template = get_template( + template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) if template == FAILED: - assert False, "get_template() failed to return template\ - with description %s" % cls.services["ostype"] + assert False, "get_test_template() failed to return template" # Create an account, network, VM and IP addresses cls.account = Account.create( diff --git a/test/integration/smoke/test_nic.py b/test/integration/smoke/test_nic.py index c7f8468..584ccf5 100644 --- a/test/integration/smoke/test_nic.py +++ b/test/integration/smoke/test_nic.py @@ -22,7 +22,7 @@ from marvin.lib.base import (Account, VirtualMachine, NetworkOffering) from marvin.lib.common import (get_zone, - get_template, + get_test_template, get_domain) from marvin.lib.utils import validateList from marvin.codes import PASS @@ -76,10 +76,10 @@ class TestNic(cloudstackTestCase): self.services["service_offerings"][ "tiny"]["storagetype"] = 'local' - template = get_template( + template = get_test_template( self.apiclient, self.zone.id, - self.services["ostype"] + self.hypervisor ) # Set Zones and disk offerings self.services["small"]["zoneid"] = self.zone.id diff --git a/test/integration/smoke/test_projects.py b/test/integration/smoke/test_projects.py index e38bccc..173e81d 100644 --- a/test/integration/smoke/test_projects.py +++ b/test/integration/smoke/test_projects.py @@ -30,7 +30,7 @@ from marvin.lib.base import (Account, Domain) from marvin.lib.common import (get_domain, get_zone, - get_template, + get_test_template, list_configurations) import time @@ -1532,12 +1532,13 @@ class TestProjectSuspendActivate(cloudstackTestCase): cls.services = Services().services # Get Zone cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.domain = get_domain(cls.api_client) cls.services['mode'] = cls.zone.networktype - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls._cleanup = [] cls.isGlobalSettingInvalid = False diff --git a/test/integration/smoke/test_reset_vm_on_reboot.py b/test/integration/smoke/test_reset_vm_on_reboot.py index 668c77f..5c1e93d 100644 --- a/test/integration/smoke/test_reset_vm_on_reboot.py +++ b/test/integration/smoke/test_reset_vm_on_reboot.py @@ -38,15 +38,16 @@ class TestResetVmOnReboot(cloudstackTestCase): # Get Zone, Domain and templates domain = get_domain(cls.apiclient) zone = get_zone(cls.apiclient, testClient.getZoneForTests()) + hypervisor = testClient.getHypervisorInfo() cls.services['mode'] = zone.networktype - template = get_template( + template = get_test_template( cls.apiclient, zone.id, - cls.services["ostype"] + hypervisor ) if template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] + assert False, "get_test_template() failed to return template" # Set Zones and disk offerings ?? cls.services["small"]["zoneid"] = zone.id diff --git a/test/integration/smoke/test_router_dhcphosts.py b/test/integration/smoke/test_router_dhcphosts.py index 668475e..aff50bc 100644 --- a/test/integration/smoke/test_router_dhcphosts.py +++ b/test/integration/smoke/test_router_dhcphosts.py @@ -35,7 +35,7 @@ from marvin.lib.base import (ServiceOffering, Network, Router) from marvin.lib.common import (get_zone, - get_template, + get_test_template, get_domain, list_virtual_machines, list_networks, @@ -68,11 +68,12 @@ class TestRouterDHCPHosts(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ cls.services["virtual_machine"]["zoneid"] = cls.zone.id @@ -407,11 +408,12 @@ class TestRouterDHCPOpts(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ cls.services["virtual_machine"]["zoneid"] = cls.zone.id diff --git a/test/integration/smoke/test_vpc_router_nics.py b/test/integration/smoke/test_vpc_router_nics.py index 39a9214..092a70f 100644 --- a/test/integration/smoke/test_vpc_router_nics.py +++ b/test/integration/smoke/test_vpc_router_nics.py @@ -35,7 +35,7 @@ from marvin.lib.base import (stopRouter, LoadBalancerRule) from marvin.lib.common import (get_domain, get_zone, - get_template, + get_test_template, list_routers) from marvin.lib.utils import cleanup_resources import socket @@ -186,10 +186,11 @@ class TestVPCNics(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) - cls.template = get_template( + cls.hypervisor = cls.testClient.getHypervisorInfo() + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"]) + cls.hypervisor) cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id @@ -450,10 +451,10 @@ class TestVPCNics(cloudstackTestCase): def do_default_routes_test(self): for o in self.networks: for vmObj in o.get_vms(): - ssh_command = "ping -c 3 8.8.8.8" + ssh_command = "ping -c 5 8.8.8.8" # Should be able to SSH VM - result = 'failed' + packet_loss = 100 try: vm = vmObj.get_vm() public_ip = vmObj.get_ip() @@ -462,19 +463,22 @@ class TestVPCNics(cloudstackTestCase): ssh = vm.get_ssh_client(ipaddress=public_ip.ipaddress.ipaddress) self.logger.debug("Ping to google.com from VM") - result = str(ssh.execute(ssh_command)) + result = ssh.execute(ssh_command) - self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count(" 0% packet loss"))) + for line in result: + if "packet loss" in line: + packet_loss = int(line.split("% packet loss")[0].split(" ")[-1]) + break + + self.logger.debug("SSH result: %s; packet loss is ==> %s" % (result, packet_loss)) except Exception as e: self.fail("SSH Access failed for %s: %s" % \ (vmObj.get_ip(), e) ) - - self.assertEqual( - result.count(" 0% packet loss"), - 1, - "Ping to outside world from VM should be successful" - ) + + # Most pings should be successful + self.assertTrue(packet_loss < 50, + "Ping to outside world from VM should be successful") class networkO(object): -- To stop receiving notification emails like this one, please contact "commits@cloudstack.apache.org" <commits@cloudstack.apache.org>.