cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject git commit: updated refs/heads/master to ed70eaf
Date Thu, 08 Aug 2013 16:50:15 GMT
Updated Branches:
  refs/heads/master b2ed63239 -> ed70eaf2c


include test for volumes created in non-root domains

Test verifies that volumes in non-root domains are visible to the user
that created them.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ed70eaf2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ed70eaf2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ed70eaf2

Branch: refs/heads/master
Commit: ed70eaf2cebf778c6bed57bee1d2ef211ca81628
Parents: b2ed632
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Thu Aug 8 22:19:08 2013 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Thu Aug 8 22:20:04 2013 +0530

----------------------------------------------------------------------
 test/integration/component/test_volumes.py | 65 +++++++++++++++++++++----
 1 file changed, 55 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ed70eaf2/test/integration/component/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_volumes.py b/test/integration/component/test_volumes.py
index 2c2301a..14109dc 100644
--- a/test/integration/component/test_volumes.py
+++ b/test/integration/component/test_volumes.py
@@ -17,14 +17,12 @@
 """ P1 tests for Volumes
 """
 #Import Local Modules
-import marvin
 from nose.plugins.attrib import attr
 from marvin.cloudstackTestCase import *
 from marvin.cloudstackAPI import *
 from marvin.integration.lib.utils import *
 from marvin.integration.lib.base import *
 from marvin.integration.lib.common import *
-from marvin.remoteSSHClient import remoteSSHClient
 #Import System modules
 import time
 
@@ -136,7 +134,6 @@ class TestAttachVolume(cloudstackTestCase):
                             domainid=cls.domain.id
                             )
 
-        cls.services["account"] = cls.account.name
         cls.service_offering = ServiceOffering.create(
                                             cls.api_client,
                                             cls.services["service_offering"]
@@ -188,7 +185,7 @@ class TestAttachVolume(cloudstackTestCase):
         # 5. Start The VM. Start VM should be successful
 
         # Create 5 volumes and attach to VM
-        for i in range(self.services["volume"]["max"]):
+        for i in range(self.services["volume"]["max"] - 1):
             volume = Volume.create(
                                    self.apiclient,
                                    self.services["volume"],
@@ -428,7 +425,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
                             domainid=cls.domain.id
                             )
 
-        cls.services["account"] = cls.account.name
+
         cls.service_offering = ServiceOffering.create(
                                             cls.api_client,
                                             cls.services["service_offering"]
@@ -480,7 +477,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
 
         volumes = []
         # Create 5 volumes and attach to VM
-        for i in range(self.services["volume"]["max"]):
+        for i in range(self.services["volume"]["max"] - 1):
             volume = Volume.create(
                                    self.apiclient,
                                    self.services["volume"],
@@ -693,7 +690,7 @@ class TestAttachVolumeISO(cloudstackTestCase):
                             cls.services["account"],
                             domainid=cls.domain.id
                             )
-        cls.services["account"] = cls.account.name
+
         cls.service_offering = ServiceOffering.create(
                                             cls.api_client,
                                             cls.services["service_offering"]
@@ -743,7 +740,7 @@ class TestAttachVolumeISO(cloudstackTestCase):
         # 3. Verify that attach ISO is successful
 
         # Create 5 volumes and attach to VM
-        for i in range(self.services["volume"]["max"]):
+        for i in range(self.services["volume"]["max"] - 1):
             volume = Volume.create(
                                    self.apiclient,
                                    self.services["volume"],
@@ -885,7 +882,7 @@ class TestVolumes(cloudstackTestCase):
                             domainid=cls.domain.id
                             )
 
-        cls.services["account"] = cls.account.name
+
         cls.service_offering = ServiceOffering.create(
                                             cls.api_client,
                                             cls.services["service_offering"]
@@ -1089,6 +1086,54 @@ class TestVolumes(cloudstackTestCase):
                     )
         return
 
+    @attr(tags=["advanced", "advancedns", "simulator", "basic", "eip", "sg"])
+    def test_create_volume_under_domain(self):
+        """Create a volume under a non-root domain as non-root-domain user
+
+        1. Create a domain under ROOT
+        2. Create a user within this domain
+        3. As user in step 2. create a volume with standard disk offering
+        4. Ensure the volume is created in the domain and available to the user in his listVolumes
call
+        """
+        dom = Domain.create(
+            self.apiclient,
+            services={},
+            name="NROOT",
+            parentdomainid=self.domain.id
+        )
+        self.assertTrue(dom is not None, msg="Domain creation failed")
+
+        domuser = Account.create(
+            apiclient=self.apiclient,
+            services=self.services["account"],
+            admin=False,
+            domainid=dom.id
+        )
+        self.assertTrue(domuser is not None)
+
+        domapiclient = self.testClient.getUserApiClient(account=domuser.name, domain=dom.name)
+
+        diskoffering = DiskOffering.list(self.apiclient)
+        self.assertTrue(isinstance(diskoffering, list), msg="DiskOffering list is not a list?")
+        self.assertTrue(len(diskoffering) > 0, "no disk offerings in the deployment")
+
+        vol = Volume.create(
+            domapiclient,
+            services=self.services["volume"],
+            zoneid=self.zone.id,
+            account=domuser.name,
+            domainid=dom.id,
+            diskofferingid=diskoffering[0].id
+        )
+        self.assertTrue(vol is not None, "volume creation fails in domain %s as user %s"
% (dom.name, domuser.name))
+
+        listed_vol = Volume.list(domapiclient, id=vol.id)
+        self.assertTrue(listed_vol is not None and isinstance(listed_vol, list),
+            "invalid response from listVolumes for volume %s" % vol.id)
+        self.assertTrue(listed_vol[0].id == vol.id,
+            "Volume returned by list volumes %s not matching with queried volume %s in domain
%s" % (
+            listed_vol[0].id, vol.id, dom.name))
+
 
 class TestDeployVmWithCustomDisk(cloudstackTestCase):
 
@@ -1125,7 +1170,7 @@ class TestDeployVmWithCustomDisk(cloudstackTestCase):
                             domainid=cls.domain.id
                             )
 
-        cls.services["account"] = cls.account.name
+
         cls.service_offering = ServiceOffering.create(
                                             cls.api_client,
                                             cls.services["service_offering"]


Mime
View raw message