diff --git a/test/integration/component/test_assign_vm.py b/test/integration/component/test_assign_vm.py index 0429fa456e4..24b63a62f14 100644 --- a/test/integration/component/test_assign_vm.py +++ b/test/integration/component/test_assign_vm.py @@ -354,8 +354,8 @@ class TestVMOwnership(cloudstackTestCase): # 1. deploy VM in sub subdomain1 # 2. stop VM in sub subdomain1 # 3. assignVirtualMachine to subdomain2 - userapiclient = self.testClient.getUserApiClient(account=self.sdomain_account_user1['account'].name, - domain=self.sdomain_account_user1['domain'].name, + userapiclient = self.testClient.getUserApiClient(UserName=self.sdomain_account_user1['account'].name, + DomainName=self.sdomain_account_user1['domain'].name, type=2) self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain']) self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, userapiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id) @@ -390,8 +390,8 @@ class TestVMOwnership(cloudstackTestCase): # Validate the following: # 1. deploy VM in sub subdomain1 with volumes. # 3. assignVirtualMachine to subdomain2 - userapiclient = self.testClient.getUserApiClient(account=self.sdomain_account_user1['account'].name, - domain=self.sdomain_account_user1['domain'].name, + userapiclient = self.testClient.getUserApiClient(UserName=self.sdomain_account_user1['account'].name, + DomainName=self.sdomain_account_user1['domain'].name, type=2) self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'],volume=self.sdomain_account_user1['volume']) self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, userapiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id) @@ -432,8 +432,8 @@ class TestVMOwnership(cloudstackTestCase): # Validate the following: # 1. deploy VM in sub subdomain1 with snapshot. # 3. assignVirtualMachine to subdomain2 - userapiclient = self.testClient.getUserApiClient(account=self.sdomain_account_user1['account'].name, - domain=self.sdomain_account_user1['domain'].name, + userapiclient = self.testClient.getUserApiClient(UserName=self.sdomain_account_user1['account'].name, + DomainName=self.sdomain_account_user1['domain'].name, type=2) self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'], project=self.sdomain_account_user1['project']) self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, userapiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id) @@ -451,8 +451,8 @@ class TestVMOwnership(cloudstackTestCase): account=self.sdomain_account_user2['account'].name, domainid=self.sdomain_account_user2['domain'].id, max=0) - userapiclient = self.testClient.getUserApiClient(account=self.sdomain_account_user1['account'].name, - domain=self.sdomain_account_user1['domain'].name, + userapiclient = self.testClient.getUserApiClient(UserName=self.sdomain_account_user1['account'].name, + DomainName=self.sdomain_account_user1['domain'].name, type=2) self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'], snapshot=True) self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, userapiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id) @@ -471,8 +471,8 @@ class TestVMOwnership(cloudstackTestCase): account=self.sdomain_account_user2['account'].name, domainid=self.sdomain_account_user2['domain'].id, max=0) - userapiclient = self.testClient.getUserApiClient(account=self.sdomain_account_user1['account'].name, - domain=self.sdomain_account_user1['domain'].name, + userapiclient = self.testClient.getUserApiClient(UserName=self.sdomain_account_user1['account'].name, + DomainName=self.sdomain_account_user1['domain'].name, type=2) self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'], snapshot=True, volume=self.sdomain_account_user1['volume']) self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, userapiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id) diff --git a/test/integration/component/test_deploy_vm_userdata_reg.py b/test/integration/component/test_deploy_vm_userdata_reg.py index c87a41a5e70..0fd7a06978e 100755 --- a/test/integration/component/test_deploy_vm_userdata_reg.py +++ b/test/integration/component/test_deploy_vm_userdata_reg.py @@ -72,9 +72,9 @@ class TestDeployVmWithUserData(cloudstackTestCase): @classmethod def setUpClass(cls): cls.testClient = super(TestDeployVmWithUserData, cls).getClsTestClient() - cls.api_client = cls.testClient.getApiClient() + cls.apiClient = cls.testClient.getApiClient() cls.services = Services().services - cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.zone = get_zone(cls.apiClient, cls.testClient.getZoneForTests()) if cls.zone.localstorageenabled: #For devcloud since localstroage is enabled cls.services["service_offering"]["storagetype"] = "local" diff --git a/test/integration/component/test_network_offering.py b/test/integration/component/test_network_offering.py index efaa2cbb9f4..da43e8a9a57 100644 --- a/test/integration/component/test_network_offering.py +++ b/test/integration/component/test_network_offering.py @@ -1180,15 +1180,15 @@ class TestNOWithOnlySourceNAT(cloudstackTestCase): @classmethod def setUpClass(cls): cls.testClient = super(TestNOWithOnlySourceNAT, cls).getClsTestClient() - cls.api_client = cls.testClient.getApiClient() + cls.apiClient = 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.domain = get_domain(cls.apiClient) + cls.zone = get_zone(cls.apiClient, cls.testClient.getZoneForTests()) cls.services['mode'] = cls.zone.networktype cls.template = get_template( - cls.apiclient, + cls.apiClient, cls.zone.id, cls.services["ostype"] ) @@ -1197,7 +1197,7 @@ class TestNOWithOnlySourceNAT(cloudstackTestCase): cls.services["virtual_machine"]["template"] = cls.template.id cls.service_offering = ServiceOffering.create( - cls.apiclient, + cls.apiClient, cls.services["service_offering"] ) diff --git a/test/integration/component/test_portable_ip.py b/test/integration/component/test_portable_ip.py index 505c9cd6157..c67b7cc61dd 100644 --- a/test/integration/component/test_portable_ip.py +++ b/test/integration/component/test_portable_ip.py @@ -141,7 +141,7 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase): cls.services = Services().services # Get Zone, Domain and templates - cls.region = get_region(cls.api_client, cls.services) + cls.region = get_region(cls.api_client) cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.pod = get_pod(cls.api_client, cls.zone.id) @@ -279,7 +279,7 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase): cls.services = Services().services # Get Zone, Domain and templates - cls.region = get_region(cls.api_client, cls.services) + cls.region = get_region(cls.api_client) cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.pod = get_pod(cls.api_client, cls.zone.id) @@ -453,7 +453,7 @@ class TestListPortablePublicIpRanges(cloudstackTestCase): cls.services = Services().services # Get Zone, Domain and templates - cls.region = get_region(cls.api_client, cls.services) + cls.region = get_region(cls.api_client) cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.pod = get_pod(cls.api_client, cls.zone.id) @@ -579,7 +579,7 @@ class TestAssociatePublicIp(cloudstackTestCase): cls.services = Services().services # Get Zone, Domain and templates - cls.region = get_region(cls.api_client, cls.services) + cls.region = get_region(cls.api_client) cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.pod = get_pod(cls.api_client, cls.zone.id) @@ -897,7 +897,7 @@ class TestDisassociatePublicIp(cloudstackTestCase): cls.services = Services().services # Get Zone, Domain and templates - cls.region = get_region(cls.api_client, cls.services) + cls.region = get_region(cls.api_client) cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.pod = get_pod(cls.api_client, cls.zone.id) @@ -1149,7 +1149,7 @@ class TestDeleteAccount(cloudstackTestCase): cls.services = Services().services # Get Zone, Domain and templates - cls.region = get_region(cls.api_client, cls.services) + cls.region = get_region(cls.api_client) cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.services['mode'] = cls.zone.networktype @@ -1365,7 +1365,7 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase): cls.services = Services().services # Get Zone, Domain and templates - cls.region = get_region(cls.api_client, cls.services) + cls.region = get_region(cls.api_client) cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.pod = get_pod(cls.api_client, cls.zone.id) diff --git a/test/integration/component/test_project_configs.py b/test/integration/component/test_project_configs.py index e19d90bcb94..983e63a5de9 100644 --- a/test/integration/component/test_project_configs.py +++ b/test/integration/component/test_project_configs.py @@ -424,7 +424,7 @@ class TestProjectInviteRequired(cloudstackTestCase): cls.services['mode'] = cls.zone.networktype # Create domains, account etc. - cls.domain = get_domain(cls.api_client, cls.services) + cls.domain = get_domain(cls.api_client) # Verify 'project.invite.required' is set to false configs = Configurations.list( @@ -574,7 +574,7 @@ class TestProjectInviteRequiredTrue(cloudstackTestCase): cls.services['mode'] = cls.zone.networktype # Create domains, account etc. - cls.domain = get_domain(cls.api_client, cls.services) + cls.domain = get_domain(cls.api_client) # Verify 'project.invite.required' is set to true configs = Configurations.list( @@ -725,7 +725,7 @@ class TestProjectInviteTimeout(cloudstackTestCase): cls.services['mode'] = cls.zone.networktype # Create domains, account etc. - cls.domain = get_domain(cls.api_client, cls.services) + cls.domain = get_domain(cls.api_client) # Verify 'project.invite.required' is set to true configs = Configurations.list( diff --git a/test/integration/component/test_project_limits.py b/test/integration/component/test_project_limits.py index 2420e2dc693..0727b224a01 100644 --- a/test/integration/component/test_project_limits.py +++ b/test/integration/component/test_project_limits.py @@ -124,7 +124,7 @@ class TestProjectLimits(cloudstackTestCase): @classmethod def setUpClass(cls): - cls.testClient = super(TestAddNetScaler, cls).getClsTestClient() + cls.testClient = super(TestProjectLimits, cls).getClsTestClient() cls.api_client = cls.testClient.getApiClient() cls.services = Services().services diff --git a/test/integration/component/test_volumes.py b/test/integration/component/test_volumes.py index 2bbc1ae737d..87755cc08fa 100644 --- a/test/integration/component/test_volumes.py +++ b/test/integration/component/test_volumes.py @@ -1110,7 +1110,7 @@ class TestVolumes(cloudstackTestCase): ) self.assertTrue(domuser is not None) - domapiclient = self.testClient.getUserApiClient(account=domuser.name, domain=dom.name) + domapiclient = self.testClient.getUserApiClient(UserName=domuser.name, DomainName=dom.name) diskoffering = DiskOffering.list(self.apiclient) self.assertTrue(isinstance(diskoffering, list), msg="DiskOffering list is not a list?") diff --git a/tools/marvin/marvin/cloudstackTestClient.py b/tools/marvin/marvin/cloudstackTestClient.py index 25dfcc7ec52..281057b8781 100644 --- a/tools/marvin/marvin/cloudstackTestClient.py +++ b/tools/marvin/marvin/cloudstackTestClient.py @@ -399,7 +399,7 @@ class CSTestClient(object): return self.__apiClient return None - def getUserApiClient(self, account, domain, type=0): + def getUserApiClient(self, UserName=None, DomainName=None, type=0): """ @Name : getUserApiClient @Desc : Provides the User API Client to test Users @@ -407,7 +407,9 @@ class CSTestClient(object): @OutPut : FAILED In case of an issue else User API Client """ - return self.__createUserApiClient(account, domain, type) + if UserName is None or DomainName is None: + return FAILED + return self.__createUserApiClient(UserName, DomainName, type) def submitCmdsAndWait(self, cmds, workers=1): ''' @@ -424,7 +426,7 @@ class CSTestClient(object): ntimes, with nums_threads of threads ''' if self.__asyncJobMgr is None: - self.__asyncJobMgr = asyncJobMgr.asyncJobMgr(self.__apiClient, + self.__asyncJobMgr = asyncJobMgr(self.__apiClient, self.__dbConnection) self.__asyncJobMgr.submitJobExecuteNtimes(job, ntimes, nums_threads, @@ -436,6 +438,6 @@ class CSTestClient(object): of threads ''' if self.__asyncJobMgr is None: - self.__asyncJobMgr = asyncJobMgr.asyncJobMgr(self.__apiClient, + self.__asyncJobMgr = asyncJobMgr(self.__apiClient, self.__dbConnection) self.__asyncJobMgr.submitJobs(jobs, nums_threads, interval) diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py index b9d524c7ae1..f08cffb01bd 100644 --- a/tools/marvin/marvin/lib/common.py +++ b/tools/marvin/marvin/lib/common.py @@ -160,15 +160,13 @@ def get_region(apiclient, region_id=None, region_name=None): @Output : 1. Region Information for the passed inputs else first Region 2. FAILED In case the cmd failed ''' - if region_id is None and region_name is None: - return FAILED cmd = listRegions.listRegionsCmd() if region_name is not None: cmd.name = region_name if region_id is not None: cmd.id = region_id cmd_out = apiclient.listRegions(cmd) - return FAILED if validateList(cmd_out)[0] != PASS else cmd_out + return FAILED if validateList(cmd_out)[0] != PASS else cmd_out[0] def get_domain(apiclient, domain_id=None, domain_name=None):