Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2BF6F10D31 for ; Wed, 24 Jul 2013 17:35:38 +0000 (UTC) Received: (qmail 25888 invoked by uid 500); 24 Jul 2013 17:35:38 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 25036 invoked by uid 500); 24 Jul 2013 17:35:35 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 24989 invoked by uid 99); 24 Jul 2013 17:35:34 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jul 2013 17:35:34 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 069F58B39EE; Wed, 24 Jul 2013 17:35:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tsp@apache.org To: commits@cloudstack.apache.org Message-Id: <5fb21e6c29d24bf4acbb4af56a0b3536@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/master to cd51303 Date: Wed, 24 Jul 2013 17:35:34 +0000 (UTC) Updated Branches: refs/heads/master d0971ce80 -> cd51303f2 CLOUDSTACK-3696: Test case test_project_limits.TestResourceLimitsProject.test_06_volumes_per_project failed due to volume usage exceeded for project. Signed-off-by: Prasanna Santhanam (cherry picked from commit 5009d3b82af4fa385490517185d071e1326cffaa) Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cd51303f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cd51303f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cd51303f Branch: refs/heads/master Commit: cd51303f2086fc1fe6d21495c9514ef59450ea0d Parents: d0971ce Author: Sanjay Tripathi Authored: Wed Jul 24 10:21:44 2013 +0530 Committer: Prasanna Santhanam Committed: Wed Jul 24 23:05:17 2013 +0530 ---------------------------------------------------------------------- .../component/test_project_limits.py | 85 +++++++++++++------- 1 file changed, 58 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cd51303f/test/integration/component/test_project_limits.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_project_limits.py b/test/integration/component/test_project_limits.py index 6e3f41d..c6df7f3 100644 --- a/test/integration/component/test_project_limits.py +++ b/test/integration/component/test_project_limits.py @@ -149,10 +149,15 @@ class TestProjectLimits(cloudstackTestCase): cls.services["user"], domainid=cls.domain.id ) + cls.disk_offering = DiskOffering.create( + cls.api_client, + cls.services["disk_offering"] + ) cls._cleanup = [ cls.admin, cls.user, - cls.domain + cls.domain, + cls.disk_offering ] return @@ -181,7 +186,7 @@ class TestProjectLimits(cloudstackTestCase): @attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"]) def test_01_project_limits(self): - """ Test project limits + """ Test project limits for domain admin """ # Validate the following # 1. Create a Project. Verify once projects are created, they inherit @@ -194,8 +199,8 @@ class TestProjectLimits(cloudstackTestCase): # account resource limits # 3. Increase Projects Resources limits above domains limit. Verify # project can't have more resources than domain level limit allows. - # 4. Create Resource more than its set limit for a project. Verify - # resource allocation should fail giving proper message + # 4. Create Resource more than its set limit for the parent domain. + # Verify resource allocation should fail giving proper message # Create project as a domain admin project = Project.create( @@ -309,27 +314,46 @@ class TestProjectLimits(cloudstackTestCase): self.apiclient, resource.resourcetype, domainid=self.domain.id, - max=2 - ) - with self.assertRaises(Exception): - max_value = 3 - self.debug( - "Attempting to update project: %s resource limit to: %s" % ( - project.id, - max_value - )) - # Update project resource limits to 3 - update_resource_limit( - self.apiclient, - resource.resourcetype, - max=max_value, - projectid=project.id + max=1 ) + max_value = 2 + self.debug( + "Attempting to update project: %s resource limit to: %s" % ( + project.id, + max_value + )) + # Update project resource limits to 3 + update_resource_limit( + self.apiclient, + resource.resourcetype, + max=max_value, + projectid=project.id + ) + + # Verify project can't have more resources then limit set for domain by adding volumes. + volume = Volume.create( + self.apiclient, + self.services["volume"], + zoneid=self.zone.id, + diskofferingid=self.disk_offering.id, + projectid=project.id + ) + # Exception should be raised for second volume + with self.assertRaises(Exception): + Volume.create( + self.apiclient, + self.services["volume"], + zoneid=self.zone.id, + diskofferingid=self.disk_offering.id, + projectid=project.id + ) + volume.delete(self.apiclient); + return @attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"]) def test_02_project_limits_normal_user(self): - """ Test project limits + """ Test project limits for normal user """ # Validate the following # 1. Create a Project @@ -786,26 +810,33 @@ class TestResourceLimitsProject(cloudstackTestCase): # an appropriate error that Volume limit is exhausted and an alert # should be generated. + self.project_1 = Project.create( + self.api_client, + self.services["project"], + account=self.account.name, + domainid=self.account.domainid + ) + self.cleanup.append(self.project_1) + self.debug( "Updating volume resource limits for project: %s" % - self.project.id) + self.project_1.id) # Set usage_vm=1 for Account 1 update_resource_limit( self.apiclient, 2, # Volume - max=2, - projectid=self.project.id + max=1, + projectid=self.project_1.id ) - self.debug("Deploying VM for project: %s" % self.project.id) + self.debug("Deploying VM for project: %s" % self.project_1.id) virtual_machine_1 = VirtualMachine.create( self.apiclient, self.services["server"], templateid=self.template.id, serviceofferingid=self.service_offering.id, - projectid=self.project.id + projectid=self.project_1.id ) - self.cleanup.append(virtual_machine_1) # Verify VM state self.assertEqual( virtual_machine_1.state, @@ -820,7 +851,7 @@ class TestResourceLimitsProject(cloudstackTestCase): self.services["volume"], zoneid=self.zone.id, diskofferingid=self.disk_offering.id, - projectid=self.project.id + projectid=self.project_1.id ) return