CLOUDSTACK-8071: Fixed api key issue in test_snapshots_improvement.py

Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
This commit is contained in:
Ashutosh K 2014-12-15 15:54:51 +05:30 committed by SrikanteswaraRao Talluri
parent 94814603db
commit ed5bc1c7ea

View File

@ -303,7 +303,9 @@ class TestCreateSnapshot(cloudstackTestCase):
def setUpClass(cls): def setUpClass(cls):
cls.testClient = super(TestCreateSnapshot, cls).getClsTestClient() cls.testClient = super(TestCreateSnapshot, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient() cls.api_client = cls.testClient.getApiClient()
cls.hypervisor = cls.testClient.getHypervisorInfo()
if cls.hypervisor.lower() in ['hyperv']:
raise unittest.SkipTest("Snapshots feature is not supported on Hyper-V")
cls.services = Services().services cls.services = Services().services
# Get Zone, Domain and templates # Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client) cls.domain = get_domain(cls.api_client)
@ -345,13 +347,17 @@ class TestCreateSnapshot(cloudstackTestCase):
self.services["account"], self.services["account"],
domainid=self.domain.id domainid=self.domain.id
) )
self.apiclient = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
self.cleanup = [self.account, ] self.cleanup = [self.account, ]
return return
def tearDown(self): def tearDown(self):
try: try:
# Clean up, terminate the created instance, volumes and snapshots # Clean up, terminate the created instance, volumes and snapshots
cleanup_resources(self.apiclient, self.cleanup) cleanup_resources(self.api_client, self.cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@ -615,13 +621,8 @@ class TestCreateSnapshot(cloudstackTestCase):
self.debug("Create a template from snapshot: %s" % snapshot.name) self.debug("Create a template from snapshot: %s" % snapshot.name)
jobs.append(self.create_Template_from_Snapshot(snapshot)) jobs.append(self.create_Template_from_Snapshot(snapshot))
userapiclient = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
# Verify IO usage by submitting the concurrent jobs # Verify IO usage by submitting the concurrent jobs
self.testClient.submitCmdsAndWait(jobs, apiclient=userapiclient) self.testClient.submitCmdsAndWait(jobs)
self.debug("Verifying if templates are created properly or not?") self.debug("Verifying if templates are created properly or not?")
templates = Template.list( templates = Template.list(