diff --git a/test/integration/component/test_allocation_states.py b/test/integration/component/test_allocation_states.py index 98f3a032702..9ba246ffd80 100644 --- a/test/integration/component/test_allocation_states.py +++ b/test/integration/component/test_allocation_states.py @@ -23,8 +23,8 @@ from marvin.lib.base import (Host, Zone, Cluster, StoragePool) -from marvin.lib.common import get_zone - +from marvin.lib.common import get_zone, get_template +from marvin.codes import FAILED class Services: """Test Resource Limits Services """ @@ -85,13 +85,23 @@ class TestAllocationState(cloudstackTestCase): @classmethod def setUpClass(cls): - cls.api_client = super( - TestAllocationState, - cls - ).getClsTestClient().getApiClient() + cls.testClient = super(TestAllocationState, cls).getClsTestClient() + cls.api_client = cls.testClient.getApiClient() + cls.services = Services().services + # Get Zone, Domain and templates - cls.zone = get_zone(cls.api_client, cls.services) + + cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.template = get_template( + cls.api_client, + cls.zone.id, + cls.services["ostype"] + ) + if cls.template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] + + cls.services['mode'] = cls.zone.networktype cls._cleanup = [] return diff --git a/test/integration/component/test_dynamic_compute_offering.py b/test/integration/component/test_dynamic_compute_offering.py index 542b637f0cb..1636aad8c5b 100644 --- a/test/integration/component/test_dynamic_compute_offering.py +++ b/test/integration/component/test_dynamic_compute_offering.py @@ -38,21 +38,22 @@ class TestDynamicServiceOffering(cloudstackTestCase): @classmethod def setUpClass(cls): - cloudstackTestClient = super(TestDynamicServiceOffering,cls).getClsTestClient() - cls.api_client = cloudstackTestClient.getApiClient() - - # Fill services from the external config file - cls.services = cloudstackTestClient.getConfigParser().parsedDict + testClient = super(TestDynamicServiceOffering, cls).getClsTestClient() + cls.apiclient = testClient.getApiClient() + cls.services = testClient.getParsedTestDataConfig() # Get Zone, Domain and templates - cls.domain = get_domain(cls.api_client, cls.services) - cls.zone = get_zone(cls.api_client, cls.services) - cls.mode = str(cls.zone.networktype).lower() - cls.template = get_template( - cls.api_client, - cls.zone.id, - cls.services["ostype"] - ) + domain = get_domain(cls.apiclient) + cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) + cls.services['mode'] = cls.zone.networktype + + template = get_template( + cls.apiclient, + cls.zone.id, + cls.services["ostype"] + ) + if template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id cls._cleanup = [] diff --git a/test/integration/component/test_ip_reservation.py b/test/integration/component/test_ip_reservation.py index 392ad98fc93..f3476b252c4 100644 --- a/test/integration/component/test_ip_reservation.py +++ b/test/integration/component/test_ip_reservation.py @@ -80,18 +80,22 @@ class TestIpReservation(cloudstackTestCase): """ @classmethod def setUpClass(cls): - cloudstackTestClient = super(TestIpReservation, cls).getClsTestClient() - cls.api_client = cloudstackTestClient.getApiClient() - # Fill test data from the external config file - cls.testData = cloudstackTestClient.getConfigParser().parsedDict + cls.testClient = super(TestIpReservation, cls).getClsTestClient() + cls.api_client = cls.testClient.getApiClient() + + # Fill services from the external config file + cls.services = cls.testClient.getConfigParser().parsedDict + # 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.api_client, cls.zone.id, - cls.testData["ostype"] + cls.services["ostype"] ) + if cls.template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.testData["domainid"] = cls.domain.id cls.testData["zoneid"] = cls.zone.id cls.testData["virtual_machine"]["zoneid"] = cls.zone.id @@ -524,18 +528,22 @@ class TestRestartNetwork(cloudstackTestCase): """ @classmethod def setUpClass(cls): - cloudstackTestClient = super(TestRestartNetwork, cls).getClsTestClient() - cls.api_client = cloudstackTestClient.getApiClient() - # Fill test data from the external config file - cls.testData = cloudstackTestClient.getConfigParser().parsedDict + cls.testClient = super(TestRestartNetwork, cls).getClsTestClient() + cls.api_client = cls.testClient.getApiClient() + + # Fill services from the external config file + cls.services = cls.testClient.getConfigParser().parsedDict + # Get Zone, Domain and templates - cls.domain = get_domain(cls.api_client, cls.testData) - cls.zone = get_zone(cls.api_client, cls.testData) + cls.domain = get_domain(cls.api_client) + cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.template = get_template( cls.api_client, cls.zone.id, - cls.testData["ostype"] + cls.services["ostype"] ) + if cls.template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.testData["domainid"] = cls.domain.id cls.testData["zoneid"] = cls.zone.id cls.testData["virtual_machine"]["zoneid"] = cls.zone.id @@ -645,18 +653,22 @@ class TestUpdateIPReservation(cloudstackTestCase): """ @classmethod def setUpClass(cls): - cloudstackTestClient = super(TestUpdateIPReservation, cls).getClsTestClient() - cls.api_client = cloudstackTestClient.getApiClient() - # Fill test data from the external config file - cls.testData = cloudstackTestClient.getConfigParser().parsedDict + cls.testClient = super(TestUpdateIPReservation, cls).getClsTestClient() + cls.api_client = cls.testClient.getApiClient() + + # Fill services from the external config file + cls.services = cls.testClient.getConfigParser().parsedDict + # Get Zone, Domain and templates - cls.domain = get_domain(cls.api_client, cls.testData) - cls.zone = get_zone(cls.api_client, cls.testData) + cls.domain = get_domain(cls.api_client) + cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.template = get_template( cls.api_client, cls.zone.id, - cls.testData["ostype"] + cls.services["ostype"] ) + if cls.template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.testData["domainid"] = cls.domain.id cls.testData["zoneid"] = cls.zone.id cls.testData["virtual_machine"]["zoneid"] = cls.zone.id @@ -791,18 +803,22 @@ class TestRouterOperations(cloudstackTestCase): """ @classmethod def setUpClass(cls): - cloudstackTestClient = super(TestRouterOperations, cls).getClsTestClient() - cls.api_client = cloudstackTestClient.getApiClient() - # Fill test data from the external config file - cls.testData = cloudstackTestClient.getConfigParser().parsedDict + cls.testClient = super(TestRouterOperations, cls).getClsTestClient() + cls.api_client = cls.testClient.getApiClient() + + # Fill services from the external config file + cls.services = cls.testClient.getConfigParser().parsedDict + # Get Zone, Domain and templates - cls.domain = get_domain(cls.api_client, cls.testData) - cls.zone = get_zone(cls.api_client, cls.testData) + cls.domain = get_domain(cls.api_client) + cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.template = get_template( cls.api_client, cls.zone.id, - cls.testData["ostype"] + cls.services["ostype"] ) + if cls.template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.testData["domainid"] = cls.domain.id cls.testData["zoneid"] = cls.zone.id cls.testData["virtual_machine"]["zoneid"] = cls.zone.id @@ -957,18 +973,22 @@ class TestFailureScnarios(cloudstackTestCase): """ @classmethod def setUpClass(cls): - cloudstackTestClient = super(TestFailureScnarios, cls).getClsTestClient() - cls.api_client = cloudstackTestClient.getApiClient() - # Fill test data from the external config file - cls.testData = cloudstackTestClient.getConfigParser().parsedDict + cls.testClient = super(TestFailureScnarios, cls).getClsTestClient() + cls.api_client = cls.testClient.getApiClient() + + # Fill services from the external config file + cls.services = cls.testClient.getConfigParser().parsedDict + # Get Zone, Domain and templates - cls.domain = get_domain(cls.api_client, cls.testData) - cls.zone = get_zone(cls.api_client, cls.testData) + cls.domain = get_domain(cls.api_client) + cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.template = get_template( cls.api_client, cls.zone.id, - cls.testData["ostype"] + cls.services["ostype"] ) + if cls.template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.testData["domainid"] = cls.domain.id cls.testData["zoneid"] = cls.zone.id cls.testData["virtual_machine"]["zoneid"] = cls.zone.id diff --git a/test/integration/component/test_multiple_ips_per_nic.py b/test/integration/component/test_multiple_ips_per_nic.py index d061cd22009..3b833660358 100644 --- a/test/integration/component/test_multiple_ips_per_nic.py +++ b/test/integration/component/test_multiple_ips_per_nic.py @@ -119,21 +119,23 @@ class TestBasicOperations(cloudstackTestCase): @classmethod def setUpClass(cls): - cloudstackTestClient = super(TestBasicOperations,cls).getClsTestClient() - cls.api_client = cloudstackTestClient.getApiClient() + cls.testClient = super(TestBasicOperations, cls).getClsTestClient() + cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cloudstackTestClient.getConfigParser().parsedDict + cls.services = cls.testClient.getConfigParser().parsedDict # Get Zone, Domain and templates - cls.domain = get_domain(cls.api_client, cls.services) - cls.zone = get_zone(cls.api_client, cls.services) - cls.mode = str(cls.zone.networktype).lower() + cls.domain = get_domain(cls.api_client) + cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.template = get_template( cls.api_client, cls.zone.id, cls.services["ostype"] ) + if cls.template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] + cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id cls.service_offering = ServiceOffering.create( @@ -468,21 +470,23 @@ class TestNetworkRules(cloudstackTestCase): @classmethod def setUpClass(cls): - cloudstackTestClient = super(TestNetworkRules,cls).getClsTestClient() - cls.api_client = cloudstackTestClient.getApiClient() + cls.testClient = super(TestNetworkRules, cls).getClsTestClient() + cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cloudstackTestClient.getConfigParser().parsedDict + cls.services = cls.testClient.getConfigParser().parsedDict # Get Zone, Domain and templates - cls.domain = get_domain(cls.api_client, cls.services) - cls.zone = get_zone(cls.api_client, cls.services) - cls.mode = str(cls.zone.networktype).lower() + cls.domain = get_domain(cls.api_client) + cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.template = get_template( cls.api_client, cls.zone.id, cls.services["ostype"] ) + if cls.template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] + cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id cls.service_offering = ServiceOffering.create( @@ -841,21 +845,22 @@ class TestVmNetworkOperations(cloudstackTestCase): @classmethod def setUpClass(cls): - cloudstackTestClient = super(TestVmNetworkOperations,cls).getClsTestClient() - cls.api_client = cloudstackTestClient.getApiClient() + cls.testClient = super(TestVmNetworkOperations, cls).getClsTestClient() + cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cloudstackTestClient.getConfigParser().parsedDict + cls.services = cls.testClient.getConfigParser().parsedDict # Get Zone, Domain and templates - cls.domain = get_domain(cls.api_client, cls.services) - cls.zone = get_zone(cls.api_client, cls.services) - cls.mode = str(cls.zone.networktype).lower() + cls.domain = get_domain(cls.api_client) + cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.template = get_template( cls.api_client, cls.zone.id, cls.services["ostype"] ) + if cls.template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id cls.service_offering = ServiceOffering.create( diff --git a/test/integration/component/test_non_contiguous_vlan.py b/test/integration/component/test_non_contiguous_vlan.py index b323782a9be..4609af95f13 100644 --- a/test/integration/component/test_non_contiguous_vlan.py +++ b/test/integration/component/test_non_contiguous_vlan.py @@ -125,7 +125,7 @@ class TestNonContiguousVLANRanges(cloudstackTestCase): def setUp(self): self.apiclient = self.testClient.getApiClient() - self.vlan = self.services["vlan_new"] + self.vlan = self.services["vlan_nc"] self.apiClient = self.testClient.getApiClient() self.physicalnetwork, self.vlan = setNonContiguousVlanIds(self.apiclient, self.zone.id) diff --git a/test/integration/component/test_persistent_networks.py b/test/integration/component/test_persistent_networks.py index e29599cfeb7..51a91ecc645 100644 --- a/test/integration/component/test_persistent_networks.py +++ b/test/integration/component/test_persistent_networks.py @@ -21,7 +21,7 @@ from marvin.lib.base import * from marvin.lib.common import * import netaddr from nose.plugins.attrib import attr -from marvin.codes import PASS, FAIL +from marvin.codes import PASS, FAIL, FAILED from marvin.sshClient import SshClient from marvin.cloudstackTestCase import cloudstackTestCase, unittest from ddt import ddt, data @@ -57,7 +57,7 @@ class TestPersistentNetworks(cloudstackTestCase): cls.services["virtual_machine"]["template"] = cls.template.id cls.service_offering = ServiceOffering.create( cls.api_client, - cls.services["service_offering"] + cls.services["service_offerings"]["small"] ) cls.isolated_persistent_network_offering = cls.createNetworkOffering("nw_off_isolated_persistent") cls.isolated_persistent_network_offering_netscaler = cls.createNetworkOffering("nw_off_isolated_persistent_netscaler") @@ -922,20 +922,22 @@ class TestAssignVirtualMachine(cloudstackTestCase): @classmethod def setUpClass(cls): - cloudstackTestClient = super(TestAssignVirtualMachine,cls).getClsTestClient() - cls.api_client = cloudstackTestClient.getApiClient() + cls.testClient = super(TestAssignVirtualMachine, cls).getClsTestClient() + cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cloudstackTestClient.getConfigParser().parsedDict + cls.services = cls.testClient.getConfigParser().parsedDict # Get Zone, Domain and templates - cls.domain = get_domain(cls.api_client, cls.services) - cls.zone = get_zone(cls.api_client, cls.services) + cls.domain = get_domain(cls.api_client) + cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.template = get_template( cls.api_client, cls.zone.id, cls.services["ostype"] ) + if cls.template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id cls.service_offering = ServiceOffering.create( @@ -1076,20 +1078,22 @@ class TestProjectAccountOperations(cloudstackTestCase): @classmethod def setUpClass(cls): - cloudstackTestClient = super(TestProjectAccountOperations,cls).getClsTestClient() - cls.api_client = cloudstackTestClient.getApiClient() + cls.testClient = super(TestProjectAccountOperations, cls).getClsTestClient() + cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cloudstackTestClient.getConfigParser().parsedDict + cls.services = cls.testClient.getConfigParser().parsedDict # Get Zone, Domain and templates - cls.domain = get_domain(cls.api_client, cls.services) - cls.zone = get_zone(cls.api_client, cls.services) + cls.domain = get_domain(cls.api_client) + cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.template = get_template( cls.api_client, cls.zone.id, cls.services["ostype"] ) + if cls.template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id cls.service_offering = ServiceOffering.create( @@ -1231,20 +1235,22 @@ class TestRestartPersistentNetwork(cloudstackTestCase): @classmethod def setUpClass(cls): - cloudstackTestClient = super(TestRestartPersistentNetwork,cls).getClsTestClient() - cls.api_client = cloudstackTestClient.getApiClient() + cls.testClient = super(TestRestartPersistentNetwork, cls).getClsTestClient() + cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cloudstackTestClient.getConfigParser().parsedDict + cls.services = cls.testClient.getConfigParser().parsedDict # Get Zone, Domain and templates - cls.domain = get_domain(cls.api_client, cls.services) - cls.zone = get_zone(cls.api_client, cls.services) + cls.domain = get_domain(cls.api_client) + cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.template = get_template( cls.api_client, cls.zone.id, cls.services["ostype"] ) + if cls.template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id cls.service_offering = ServiceOffering.create( @@ -1487,20 +1493,23 @@ class TestVPCNetworkOperations(cloudstackTestCase): @classmethod def setUpClass(cls): - cloudstackTestClient = super(TestVPCNetworkOperations,cls).getClsTestClient() - cls.api_client = cloudstackTestClient.getApiClient() + cls.testClient = super(TestVPCNetworkOperations, cls).getClsTestClient() + cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cloudstackTestClient.getConfigParser().parsedDict + cls.services = cls.testClient.getConfigParser().parsedDict # Get Zone, Domain and templates - cls.domain = get_domain(cls.api_client, cls.services) - cls.zone = get_zone(cls.api_client, cls.services) + cls.domain = get_domain(cls.api_client) + cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.template = get_template( cls.api_client, cls.zone.id, cls.services["ostype"] ) + if cls.template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] + cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id cls.service_offering = ServiceOffering.create( diff --git a/test/integration/component/test_portable_ip.py b/test/integration/component/test_portable_ip.py index bf37447e86d..65a4eed9f83 100644 --- a/test/integration/component/test_portable_ip.py +++ b/test/integration/component/test_portable_ip.py @@ -130,6 +130,14 @@ class Services: "protocol": 'TCP', }, "ostype": 'CentOS 5.3 (64-bit)', + "portableIpRange": { + "gateway" : "10.223.252.195", + "netmask" : "255.255.255.192", + "startip" : "10.223.252.196", + "endip" : "10.223.252.197", + "vlan" : "1001" + } + } class TestCreatePortablePublicIpRanges(cloudstackTestCase): @@ -187,7 +195,7 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase): # 1. Create new portable ip range with root admin api # 2. Portable ip range should be created successfully - portable_ip_range_services = get_portable_ip_range_services(self.config) + portable_ip_range_services = get_portable_ip_range_services(self.services) self.debug(portable_ip_range_services) @@ -231,7 +239,7 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase): DomainName=self.account.domain ) - portable_ip_range_services = get_portable_ip_range_services(self.config) + portable_ip_range_services = get_portable_ip_range_services(self.services) if portable_ip_range_services is None: self.skipTest('Failed to read config values related to portable ip range') @@ -253,7 +261,7 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase): # 1. Try to create new portable ip range with invalid region id # 2. Portable ip range creation should fail - portable_ip_range_services = get_portable_ip_range_services(self.config) + portable_ip_range_services = get_portable_ip_range_services(self.services) if portable_ip_range_services is None: self.skipTest('Failed to read config values related to portable ip range') @@ -307,7 +315,7 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase): self.apiclient = self.testClient.getApiClient() self.dbclient = self.testClient.getDbConnection() - portable_ip_range_services = get_portable_ip_range_services(self.config) + portable_ip_range_services = get_portable_ip_range_services(self.services) if portable_ip_range_services is None: self.skipTest('Failed to read config values related to portable ip range') @@ -482,7 +490,7 @@ class TestListPortablePublicIpRanges(cloudstackTestCase): self.dbclient = self.testClient.getDbConnection() #create new portable ip range - self.portable_ip_range_services = get_portable_ip_range_services(self.config) + self.portable_ip_range_services = get_portable_ip_range_services(self.services) if self.portable_ip_range_services is None: self.skipTest('Failed to read config values related to portable ip range') @@ -645,7 +653,7 @@ class TestAssociatePublicIp(cloudstackTestCase): self.cleanup = [] - portable_ip_range_services = get_portable_ip_range_services(self.config) + portable_ip_range_services = get_portable_ip_range_services(self.services) if portable_ip_range_services is None: self.skipTest('Failed to read config values related to portable ip range') @@ -989,7 +997,7 @@ class TestDisassociatePublicIp(cloudstackTestCase): self.dbclient = self.testClient.getDbConnection() self.cleanup = [] - portable_ip_range_services = get_portable_ip_range_services(self.config) + portable_ip_range_services = get_portable_ip_range_services(self.services) if portable_ip_range_services is None: self.skipTest('Failed to read config values related to portable ip range') @@ -1211,7 +1219,7 @@ class TestDeleteAccount(cloudstackTestCase): ) self.cleanup = [] - portable_ip_range_services = get_portable_ip_range_services(self.config) + portable_ip_range_services = get_portable_ip_range_services(self.services) if portable_ip_range_services is None: self.skipTest('Failed to read config values related to portable ip range') @@ -1488,7 +1496,7 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase): self.dbclient = self.testClient.getDbConnection() #create new portable ip range - self.portable_ip_range_services = get_portable_ip_range_services(self.config) + self.portable_ip_range_services = get_portable_ip_range_services(self.services) if self.portable_ip_range_services is None: self.skipTest('Failed to read config values related to portable ip range') diff --git a/test/integration/component/test_region_vpc.py b/test/integration/component/test_region_vpc.py index f68d6eb4889..947c62fdf6f 100644 --- a/test/integration/component/test_region_vpc.py +++ b/test/integration/component/test_region_vpc.py @@ -159,19 +159,25 @@ class TestRegionVpcOffering(cloudstackTestCase): @classmethod def setUpClass(cls): - cls.api_client = super( - TestRegionVpcOffering, - cls - ).getClsTestClient().getApiClient() - cls.services = Services().services + testClient = super(TestRegionVpcOffering, cls).getClsTestClient() + cls.apiclient = testClient.getApiClient() + cls.services = testClient.getParsedTestDataConfig() + # Get Zone, Domain and templates - cls.domain = get_domain(cls.api_client, cls.services) - cls.zone = get_zone(cls.api_client, cls.services) - cls.template = get_template( - cls.api_client, - cls.zone.id, - cls.services["ostype"] - ) + domain = get_domain(cls.apiclient) + cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) + cls.services['mode'] = cls.zone.networktype + + + template = get_template( + cls.apiclient, + cls.zone.id, + cls.services["ostype"] + ) + if template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] + + cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id diff --git a/test/integration/component/test_tags.py b/test/integration/component/test_tags.py index 1ee2f7741a4..41a75c3fda5 100644 --- a/test/integration/component/test_tags.py +++ b/test/integration/component/test_tags.py @@ -178,23 +178,23 @@ class TestResourceTags(cloudstackTestCase): cls.api_client = cls.testClient.getApiClient() cls.services = Services().services + # 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.api_client, + cls.zone.id, + cls.services["ostype"] + ) + if cls.template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.account = Account.create( cls.api_client, cls.services["account"], admin=True, ) - cls.zone = get_zone(cls.api_client, cls.services) - - cls.template = get_template( - cls.api_client, - cls.zone.id, - cls.services["ostype"] - ) - # Create service offerings, disk offerings etc cls.service_offering = ServiceOffering.create( cls.api_client, diff --git a/test/integration/component/test_vpc_distributed_routing_offering.py b/test/integration/component/test_vpc_distributed_routing_offering.py index 0af90aa52d7..5deb6a3a7a0 100644 --- a/test/integration/component/test_vpc_distributed_routing_offering.py +++ b/test/integration/component/test_vpc_distributed_routing_offering.py @@ -154,19 +154,22 @@ class TestVPCDistributedRouterOffering(cloudstackTestCase): @classmethod def setUpClass(cls): - cls.api_client = super( - TestVPCDistributedRouterOffering, - cls - ).getClsTestClient().getApiClient() - cls.services = Services().services + testClient = super(TestVPCDistributedRouterOffering, cls).getClsTestClient() + cls.apiclient = testClient.getApiClient() + cls.services = testClient.getParsedTestDataConfig() + # Get Zone, Domain and templates - cls.domain = get_domain(cls.api_client, cls.services) - cls.zone = get_zone(cls.api_client, cls.services) - cls.template = get_template( - cls.api_client, - cls.zone.id, - cls.services["ostype"] - ) + domain = get_domain(cls.apiclient) + cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) + cls.services['mode'] = cls.zone.networktype + + template = get_template( + cls.apiclient, + cls.zone.id, + cls.services["ostype"] + ) + if template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id diff --git a/test/integration/smoke/test_VirtualRouter_alerts.py b/test/integration/smoke/test_VirtualRouter_alerts.py index a106725fd64..be327bbc8ab 100644 --- a/test/integration/smoke/test_VirtualRouter_alerts.py +++ b/test/integration/smoke/test_VirtualRouter_alerts.py @@ -24,6 +24,7 @@ from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * from nose.plugins.attrib import attr +from marvin.codes import FAILED import time @@ -96,12 +97,13 @@ class Services: class TestVRServiceFailureAlerting(cloudstackTestCase): @classmethod def setUpClass(cls): - cls.api_client = super(TestVRServiceFailureAlerting, cls).getClsTestClient().getApiClient() + cls.testClient = super(TestVRServiceFailureAlerting, cls).getClsTestClient() + cls.api_client = cls.testClient.getApiClient() cls.services = Services().services # Get Zone, Domain and templates - domain = get_domain(cls.api_client, cls.services) - cls.zone = get_zone(cls.api_client, cls.services) + cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + domain = get_domain(cls.api_client) cls.services['mode'] = cls.zone.networktype template = get_template( @@ -109,6 +111,9 @@ class TestVRServiceFailureAlerting(cloudstackTestCase): cls.zone.id, cls.services["ostype"] ) + + if template == FAILED: + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] # Set Zones and disk offerings ?? cls.services["small"]["zoneid"] = cls.zone.id cls.services["small"]["template"] = template.id diff --git a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py index f07226b28f9..16276538a5a 100644 --- a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py +++ b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py @@ -31,8 +31,11 @@ from marvin.lib.utils import cleanup_resources #common - commonly used methods for all tests are listed here from marvin.lib.common import get_zone, get_domain, get_template +from marvin.codes import FAILED + from nose.plugins.attrib import attr + class Services: """Test VM Life Cycle Services """ @@ -116,12 +119,14 @@ class TestDeployvGPUenabledVM(cloudstackTestCase): self.apiclient = self.testClient.getApiClient() # Get Zone, Domain and Default Built-in template - self.domain = get_domain(self.apiclient, self.services) - self.zone = get_zone(self.apiclient, self.services) + self.domain = get_domain(self.apiclient) + self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests()) self.services["mode"] = self.zone.networktype # Before running this test, register a windows template with ostype as 'Windows 7 (32-bit)' self.template = get_template(self.apiclient, self.zone.id, self.services["ostype"], templatetype='USER') + if self.template == FAILED: + assert False, "get_template() failed to return template with description %s" % self.services["ostype"] #create a user account self.account = Account.create( self.apiclient, diff --git a/test/integration/smoke/test_deploy_vm_root_resize.py b/test/integration/smoke/test_deploy_vm_root_resize.py index 737b2cf047b..e758ffd169a 100644 --- a/test/integration/smoke/test_deploy_vm_root_resize.py +++ b/test/integration/smoke/test_deploy_vm_root_resize.py @@ -31,6 +31,8 @@ from marvin.lib.utils import cleanup_resources #common - commonly used methods for all tests are listed here from marvin.lib.common import get_zone, get_domain, get_template, list_volumes +from marvin.codes import FAILED + from nose.plugins.attrib import attr class TestData(object): @@ -74,10 +76,12 @@ class TestDeployVM(cloudstackTestCase): self.hypervisor = self.testClient.getHypervisorInfo() # Get Zone, Domain and Default Built-in template - self.domain = get_domain(self.apiclient, self.testdata) - self.zone = get_zone(self.apiclient, self.testdata) + self.domain = get_domain(self.apiclient) + self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests()) self.testdata["mode"] = self.zone.networktype self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"]) + if self.template == FAILED: + assert False, "get_template() failed to return template with description %s" % self.services["ostype"] # for testing with specific template # self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"], templatetype='USER', services = {"template":'31f52a4d-5681-43f7-8651-ad4aaf823618'}) diff --git a/test/integration/smoke/test_over_provisioning.py b/test/integration/smoke/test_over_provisioning.py index eac397de811..45d803eecb9 100644 --- a/test/integration/smoke/test_over_provisioning.py +++ b/test/integration/smoke/test_over_provisioning.py @@ -67,7 +67,7 @@ class TestUpdateOverProvision(cloudstackTestCase): self.poolId = pool.id """ list overprovisioning factor for storage pool """ - factorOld = float(pool.overprovisionfactor) + factorOld = float(str(pool.overprovisionfactor)) factorNew = str(factorOld + 1.0) """ update setting for the pool""" @@ -85,7 +85,7 @@ class TestUpdateOverProvision(cloudstackTestCase): id = self.poolId ) pool = storage_pools[0] - factorNew = float(pool.overprovisionfactor) + factorNew = float(str(pool.overprovisionfactor)) self.assertNotEqual(int(factorNew), int(factorOld)," Check if overprovision factor of storage pool has changed") self.assertEqual(int(factorNew), int(factorOld + 1.0)," Check if overprovision factor of storage pool has increased by 1") @@ -100,7 +100,7 @@ class TestUpdateOverProvision(cloudstackTestCase): pool = storage_pools[0] updateConfigurationCmd = updateConfiguration.updateConfigurationCmd() updateConfigurationCmd.name = "storage.overprovisioning.factor" - factorOld = float(pool.overprovisionfactor) + factorOld = float(str(pool.overprovisionfactor)) factorNew = str(factorOld - 1.0) updateConfigurationCmd.value = factorNew updateConfigurationCmd.storageid = pool.id diff --git a/test/integration/smoke/test_vm_iam.py b/test/integration/smoke/test_vm_iam.py index 51aa8832f90..662c7df83fc 100644 --- a/test/integration/smoke/test_vm_iam.py +++ b/test/integration/smoke/test_vm_iam.py @@ -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.codes import FAILED from nose.plugins.attrib import attr #Import System modules import time @@ -103,7 +104,8 @@ class TestVMIam(cloudstackTestCase): @classmethod def setUpClass(self): - self.apiclient = super(TestVMIam, self).getClsTestClient().getApiClient() + testClient = super(TestVMIam, self).getClsTestClient() + self.apiclient = testClient.getApiClient() self.services = Services().services # backup default apikey and secretkey diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py index 926d1573697..fb7e5fa5d43 100644 --- a/tools/marvin/marvin/config/test_data.py +++ b/tools/marvin/marvin/config/test_data.py @@ -158,6 +158,10 @@ test_data = { "type": "host anti-affinity", }, }, + "virtual_machine2" : { + "name" : "testvm2", + "displayname" : "Test VM2", + }, "server_without_disk": { "displayname": "Test VM-No Disk", "username": "root",