Detect the second zone for copyImage operation When copying templates and ISOs detect that a second zone is available. Else skip the test.
Signed-off-by: Prasanna Santhanam <t...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/92e63522 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/92e63522 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/92e63522 Branch: refs/heads/vmware-datamodel Commit: 92e635228731fb72461e757f523cd20fefcd370b Parents: 8da7ec0 Author: Prasanna Santhanam <t...@apache.org> Authored: Mon May 20 17:50:32 2013 +0530 Committer: Prasanna Santhanam <t...@apache.org> Committed: Mon May 20 17:51:49 2013 +0530 ---------------------------------------------------------------------- test/integration/smoke/test_iso.py | 10 ++++++---- test/integration/smoke/test_templates.py | 11 +++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92e63522/test/integration/smoke/test_iso.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_iso.py b/test/integration/smoke/test_iso.py index ad4a8f2..c645d3b 100644 --- a/test/integration/smoke/test_iso.py +++ b/test/integration/smoke/test_iso.py @@ -202,11 +202,9 @@ class TestISO(cloudstackTestCase): cls.services["sourcezoneid"] = cls.zone.id #populate second zone id for iso copy cmd = listZones.listZonesCmd() - zones = cls.api_client.listZones(cmd) - if not isinstance(zones, list): + cls.zones = cls.api_client.listZones(cmd) + if not isinstance(cls.zones, list): raise Exception("Failed to find zones.") - if len(zones) >= 2: - cls.services["destzoneid"] = zones[1].id #Create an account, ISOs etc. cls.account = Account.create( @@ -484,6 +482,10 @@ class TestISO(cloudstackTestCase): #Validate the following #1. copy ISO should be successful and secondary storage # should contain new copied ISO. + if len(self.zones) <= 1: + self.skipTest("Not enough zones available to perform copy template") + + self.services["destzoneid"] = filter(lambda z: z.id != self.zone.id, self.zones)[0] self.debug("Copy ISO from %s to %s" % ( self.zone.id, http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92e63522/test/integration/smoke/test_templates.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py index 382f56f..8b83f5e 100644 --- a/test/integration/smoke/test_templates.py +++ b/test/integration/smoke/test_templates.py @@ -295,11 +295,9 @@ class TestTemplates(cloudstackTestCase): cls.services['mode'] = cls.zone.networktype #populate second zone id for iso copy cmd = listZones.listZonesCmd() - zones = cls.api_client.listZones(cmd) - if not isinstance(zones, list): + cls.zones = cls.api_client.listZones(cmd) + if not isinstance(cls.zones, list): raise Exception("Failed to find zones.") - if len(zones) >= 2: - cls.services["destzoneid"] = zones[1].id cls.disk_offering = DiskOffering.create( cls.api_client, @@ -664,6 +662,11 @@ class TestTemplates(cloudstackTestCase): # 1. copy template should be successful and # secondary storage should contain new copied template. + if len(self.zones) <= 1: + self.skipTest("Not enough zones available to perform copy template") + + self.services["destzoneid"] = filter(lambda z: z.id != self.services["sourcezoneid"], self.zones)[0] + self.debug("Copy template from Zone: %s to %s" % ( self.services["sourcezoneid"], self.services["destzoneid"]