mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-6316: Fixed issues in various files(testcases and marvin related)
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
This commit is contained in:
parent
65e8f2dc53
commit
0d5ec63371
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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?")
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in New Issue