From 94fc4bf6bd110f4ec88bb874e6f2bfb0ff9bc6f6 Mon Sep 17 00:00:00 2001 From: SrikanteswaraRao Talluri Date: Thu, 10 Apr 2014 21:21:28 +0530 Subject: [PATCH] CLOUDSTACK-6316: fixes for bvt failures --- .../component/test_ip_reservation.py | 10 +++--- .../component/test_multiple_ips_per_nic.py | 6 ++-- .../component/test_persistent_networks.py | 8 ++--- .../integration/component/test_portable_ip.py | 18 +++++----- test/integration/component/test_region_vpc.py | 4 +-- test/integration/component/test_tags.py | 1 + .../test_vpc_distributed_routing_offering.py | 4 +-- .../smoke/test_deploy_vgpu_enabled_vm.py | 3 +- .../smoke/test_over_provisioning.py | 19 +++++++--- .../integration/smoke/test_primary_storage.py | 2 +- .../integration/smoke/test_public_ip_range.py | 1 + test/integration/smoke/test_vm_iam.py | 2 +- tools/marvin/marvin/config/test_data.py | 1 + tools/marvin/marvin/lib/common.py | 35 ------------------- 14 files changed, 47 insertions(+), 67 deletions(-) diff --git a/test/integration/component/test_ip_reservation.py b/test/integration/component/test_ip_reservation.py index f3476b252c4..7a82076f53d 100644 --- a/test/integration/component/test_ip_reservation.py +++ b/test/integration/component/test_ip_reservation.py @@ -84,7 +84,7 @@ class TestIpReservation(cloudstackTestCase): cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cls.testClient.getConfigParser().parsedDict + cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) @@ -532,7 +532,7 @@ class TestRestartNetwork(cloudstackTestCase): cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cls.testClient.getConfigParser().parsedDict + cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) @@ -657,7 +657,7 @@ class TestUpdateIPReservation(cloudstackTestCase): cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cls.testClient.getConfigParser().parsedDict + cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) @@ -807,7 +807,7 @@ class TestRouterOperations(cloudstackTestCase): cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cls.testClient.getConfigParser().parsedDict + cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) @@ -977,7 +977,7 @@ class TestFailureScnarios(cloudstackTestCase): cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cls.testClient.getConfigParser().parsedDict + cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) diff --git a/test/integration/component/test_multiple_ips_per_nic.py b/test/integration/component/test_multiple_ips_per_nic.py index 3b833660358..27396371ad1 100644 --- a/test/integration/component/test_multiple_ips_per_nic.py +++ b/test/integration/component/test_multiple_ips_per_nic.py @@ -123,7 +123,7 @@ class TestBasicOperations(cloudstackTestCase): cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cls.testClient.getConfigParser().parsedDict + cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) @@ -474,7 +474,7 @@ class TestNetworkRules(cloudstackTestCase): cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cls.testClient.getConfigParser().parsedDict + cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) @@ -849,7 +849,7 @@ class TestVmNetworkOperations(cloudstackTestCase): cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cls.testClient.getConfigParser().parsedDict + cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) diff --git a/test/integration/component/test_persistent_networks.py b/test/integration/component/test_persistent_networks.py index 51a91ecc645..b5b4bd4e244 100644 --- a/test/integration/component/test_persistent_networks.py +++ b/test/integration/component/test_persistent_networks.py @@ -926,7 +926,7 @@ class TestAssignVirtualMachine(cloudstackTestCase): cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cls.testClient.getConfigParser().parsedDict + cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) @@ -1082,7 +1082,7 @@ class TestProjectAccountOperations(cloudstackTestCase): cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cls.testClient.getConfigParser().parsedDict + cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) @@ -1239,7 +1239,7 @@ class TestRestartPersistentNetwork(cloudstackTestCase): cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cls.testClient.getConfigParser().parsedDict + cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) @@ -1497,7 +1497,7 @@ class TestVPCNetworkOperations(cloudstackTestCase): cls.api_client = cls.testClient.getApiClient() # Fill services from the external config file - cls.services = cls.testClient.getConfigParser().parsedDict + cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) diff --git a/test/integration/component/test_portable_ip.py b/test/integration/component/test_portable_ip.py index 65a4eed9f83..4c67dacb0e2 100644 --- a/test/integration/component/test_portable_ip.py +++ b/test/integration/component/test_portable_ip.py @@ -195,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.services) + portable_ip_range_services = self.services["portableIpRange"] self.debug(portable_ip_range_services) @@ -239,7 +239,7 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase): DomainName=self.account.domain ) - portable_ip_range_services = get_portable_ip_range_services(self.services) + portable_ip_range_services = self.services["portableIpRange"] if portable_ip_range_services is None: self.skipTest('Failed to read config values related to portable ip range') @@ -261,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.services) + portable_ip_range_services = self.services["portableIpRange"] if portable_ip_range_services is None: self.skipTest('Failed to read config values related to portable ip range') @@ -315,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.services) + portable_ip_range_services = self.services["portableIpRange"] if portable_ip_range_services is None: self.skipTest('Failed to read config values related to portable ip range') @@ -490,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.services) + self.portable_ip_range_services = self.services["portableIpRange"] if self.portable_ip_range_services is None: self.skipTest('Failed to read config values related to portable ip range') @@ -653,7 +653,7 @@ class TestAssociatePublicIp(cloudstackTestCase): self.cleanup = [] - portable_ip_range_services = get_portable_ip_range_services(self.services) + portable_ip_range_services = self.services["PortableIpRange"] if portable_ip_range_services is None: self.skipTest('Failed to read config values related to portable ip range') @@ -997,7 +997,7 @@ class TestDisassociatePublicIp(cloudstackTestCase): self.dbclient = self.testClient.getDbConnection() self.cleanup = [] - portable_ip_range_services = get_portable_ip_range_services(self.services) + portable_ip_range_services = self.services["portableIpRange"] if portable_ip_range_services is None: self.skipTest('Failed to read config values related to portable ip range') @@ -1219,7 +1219,7 @@ class TestDeleteAccount(cloudstackTestCase): ) self.cleanup = [] - portable_ip_range_services = get_portable_ip_range_services(self.services) + portable_ip_range_services = self.services["portableIpRange"] if portable_ip_range_services is None: self.skipTest('Failed to read config values related to portable ip range') @@ -1496,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.services) + self.portable_ip_range_services = self.services["portableIpRange"] 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 947c62fdf6f..43f1fed2044 100644 --- a/test/integration/component/test_region_vpc.py +++ b/test/integration/component/test_region_vpc.py @@ -169,12 +169,12 @@ class TestRegionVpcOffering(cloudstackTestCase): cls.services['mode'] = cls.zone.networktype - template = get_template( + cls.template = get_template( cls.apiclient, cls.zone.id, cls.services["ostype"] ) - if template == FAILED: + if cls.template == FAILED: assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] diff --git a/test/integration/component/test_tags.py b/test/integration/component/test_tags.py index 41a75c3fda5..d6b43d97d19 100644 --- a/test/integration/component/test_tags.py +++ b/test/integration/component/test_tags.py @@ -182,6 +182,7 @@ class TestResourceTags(cloudstackTestCase): # Get Zone, Domain and templates cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.domain = get_domain(cls.api_client) cls.template = get_template( cls.api_client, cls.zone.id, diff --git a/test/integration/component/test_vpc_distributed_routing_offering.py b/test/integration/component/test_vpc_distributed_routing_offering.py index 5deb6a3a7a0..28ddd4b9597 100644 --- a/test/integration/component/test_vpc_distributed_routing_offering.py +++ b/test/integration/component/test_vpc_distributed_routing_offering.py @@ -163,12 +163,12 @@ class TestVPCDistributedRouterOffering(cloudstackTestCase): cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) cls.services['mode'] = cls.zone.networktype - template = get_template( + cls.template = get_template( cls.apiclient, cls.zone.id, cls.services["ostype"] ) - if template == FAILED: + 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 diff --git a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py index 16276538a5a..13fad61d856 100644 --- a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py +++ b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py @@ -123,7 +123,8 @@ class TestDeployvGPUenabledVM(cloudstackTestCase): 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') + self.services["ostype"] = 'Windows 7 (32-bit)' + self.template = get_template(self.apiclient, self.zone.id, self.services["ostype"]) if self.template == FAILED: assert False, "get_template() failed to return template with description %s" % self.services["ostype"] diff --git a/test/integration/smoke/test_over_provisioning.py b/test/integration/smoke/test_over_provisioning.py index 45d803eecb9..1c5d8a520f6 100644 --- a/test/integration/smoke/test_over_provisioning.py +++ b/test/integration/smoke/test_over_provisioning.py @@ -67,6 +67,10 @@ class TestUpdateOverProvision(cloudstackTestCase): self.poolId = pool.id """ list overprovisioning factor for storage pool """ + failed = 0 + if pool.overprovisionfactor is None: + failed = 1 + self.assertNotEqual(failed,1,"pool.overprovisionfactor is none") factorOld = float(str(pool.overprovisionfactor)) factorNew = str(factorOld + 1.0) @@ -85,6 +89,10 @@ class TestUpdateOverProvision(cloudstackTestCase): id = self.poolId ) pool = storage_pools[0] + failed = 0 + if pool.overprovisionfactor is None: + failed = 1 + self.assertNotEqual(failed,1,"pool.overprovisionfactor is none") 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,8 +108,11 @@ class TestUpdateOverProvision(cloudstackTestCase): pool = storage_pools[0] updateConfigurationCmd = updateConfiguration.updateConfigurationCmd() updateConfigurationCmd.name = "storage.overprovisioning.factor" - factorOld = float(str(pool.overprovisionfactor)) + factorOld = 0 + if pool.overprovisionfactor is not None: + factorOld = float(str(pool.overprovisionfactor)) factorNew = str(factorOld - 1.0) - updateConfigurationCmd.value = factorNew - updateConfigurationCmd.storageid = pool.id - updateConfigurationResponse = self.apiClient.updateConfiguration(updateConfigurationCmd) + if factorNew > 0: + updateConfigurationCmd.value = factorNew + updateConfigurationCmd.storageid = pool.id + updateConfigurationResponse = self.apiClient.updateConfiguration(updateConfigurationCmd) diff --git a/test/integration/smoke/test_primary_storage.py b/test/integration/smoke/test_primary_storage.py index 8633aece264..3147d86645f 100644 --- a/test/integration/smoke/test_primary_storage.py +++ b/test/integration/smoke/test_primary_storage.py @@ -199,7 +199,7 @@ class TestPrimaryStorageServices(cloudstackTestCase): self.assertEqual( storage.type, - 'NetworkFilesystem', + 'IscsiLUN', "Check storage pool type " ) diff --git a/test/integration/smoke/test_public_ip_range.py b/test/integration/smoke/test_public_ip_range.py index 0355325b1c2..b961dc34773 100644 --- a/test/integration/smoke/test_public_ip_range.py +++ b/test/integration/smoke/test_public_ip_range.py @@ -37,6 +37,7 @@ class TestDedicatePublicIPRange(cloudstackTestCase): cls.domain = get_domain(cls.apiclient) cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests()) cls.services["zoneid"] = cls.zone.id + cls.pod = get_pod(cls.apiclient, cls.zone.id) # Create Account cls.account = Account.create( cls.apiclient, diff --git a/test/integration/smoke/test_vm_iam.py b/test/integration/smoke/test_vm_iam.py index 662c7df83fc..be75a79737f 100644 --- a/test/integration/smoke/test_vm_iam.py +++ b/test/integration/smoke/test_vm_iam.py @@ -193,7 +193,7 @@ class TestVMIam(cloudstackTestCase): self.services["service_offering"]["small"] ) - self.zone = get_zone(self.apiclient, self.services) + self.zone = get_zone(self.apiclient, testClient.getZoneForTests()) self.services['mode'] = self.zone.networktype self.template = get_template(self.apiclient, self.zone.id, self.services["ostype"]) diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py index 88babf49ce1..080d537e8f3 100644 --- a/tools/marvin/marvin/config/test_data.py +++ b/tools/marvin/marvin/config/test_data.py @@ -382,6 +382,7 @@ test_data = { }, "securitygroupenabled": "true" }, + "vlan": "10", "portableiprange_vlan": { "part": ["4090-4091", "4092-4095"], "full": "4090-4095" diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py index 62dab255c55..8868d2d51ea 100644 --- a/tools/marvin/marvin/lib/common.py +++ b/tools/marvin/marvin/lib/common.py @@ -798,41 +798,6 @@ def get_resource_type(resource_id): return lookup[resource_id] -def get_portable_ip_range_services(config): - """ Reads config values related to portable ip and fills up - services accordingly""" - - services = {} - attributeError = False - - if config.portableIpRange.startip: - services["startip"] = config.portableIpRange.startip - else: - attributeError = True - - if config.portableIpRange.endip: - services["endip"] = config.portableIpRange.endip - else: - attributeError = True - - if config.portableIpRange.netmask: - services["netmask"] = config.portableIpRange.netmask - else: - attributeError = True - - if config.portableIpRange.gateway: - services["gateway"] = config.portableIpRange.gateway - else: - attributeError = True - - if config.portableIpRange.vlan: - services["vlan"] = config.portableIpRange.vlan - - if attributeError: - services = None - - return services - def get_free_vlan(apiclient, zoneid): """