Github user gauravaradhye commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/170#discussion_r28493161
  
    --- Diff: test/integration/testpaths/testpath_snapshot_limits.py ---
    @@ -0,0 +1,341 @@
    +# Licensed to the Apache Software Foundation (ASF) under one
    +# or more contributor license agreements.  See the NOTICE file
    +# distributed with this work for additional information
    +# regarding copyright ownership.  The ASF licenses this file
    +# to you under the Apache License, Version 2.0 (the
    +# "License"); you may not use this file except in compliance
    +# with the License.  You may obtain a copy of the License at
    +#
    +#   http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing,
    +# software distributed under the License is distributed on an
    +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +# KIND, either express or implied.  See the License for the
    +# specific language governing permissions and limitations
    +# under the License.
    +""" Test cases for Storage and Snapshot Limits Test Path
    +"""
    +
    +from nose.plugins.attrib import attr
    +from marvin.cloudstackTestCase import cloudstackTestCase
    +from marvin.lib.utils import (cleanup_resources,
    +                              validateList)
    +from marvin.lib.base import (Account,
    +                             ServiceOffering,
    +                             DiskOffering,
    +                             Volume,
    +                             Resources,
    +                             VirtualMachine,
    +                             Snapshot
    +                             )
    +from marvin.lib.common import (get_domain,
    +                               get_zone,
    +                               get_template
    +                               )
    +
    +from marvin.codes import (BACKEDUP, PASS)
    +
    +class TestStorageSnapshotsLimits(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        testClient = super(TestStorageSnapshotsLimits, 
cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.testdata = testClient.getParsedTestDataConfig()
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +
    +        # Get Zone, Domain and templates
    +        cls.domain = get_domain(cls.apiclient)
    +        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
    +
    +        cls.template = get_template(
    +            cls.apiclient,
    +            cls.zone.id,
    +            cls.testdata["ostype"])
    +
    +        cls._cleanup = []
    +
    +        try:
    +
    +            # Create an account
    +            cls.account = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +            cls._cleanup.append(cls.account)
    +
    +            # Create user api client of the account
    +            cls.userapiclient = testClient.getUserApiClient(
    +                UserName=cls.account.name,
    +                DomainName=cls.account.domain
    +            )
    +
    +            # Create Service offering
    +            cls.service_offering = ServiceOffering.create(
    +                cls.apiclient,
    +                cls.testdata["service_offering"],
    +            )
    +            cls._cleanup.append(cls.service_offering)
    +
    +            cls.disk_offering = DiskOffering.create(
    +                cls.apiclient,
    +                cls.testdata["disk_offering"],
    +            )
    +
    +            cls._cleanup.append(cls.disk_offering)
    +
    +            cls.vm = VirtualMachine.create(
    +                cls.userapiclient,
    +                cls.testdata["small"],
    +                templateid=cls.template.id,
    +                accountid=cls.account.name,
    +                domainid=cls.account.domainid,
    +                serviceofferingid=cls.service_offering.id,
    +                zoneid=cls.zone.id,
    +            )
    +
    +        except Exception as e:
    +            cls.tearDownClass()
    +            raise e
    +        return
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        try:
    +            cleanup_resources(cls.apiclient, cls._cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +
    +    def setUp(self):
    +        self.apiclient = self.testClient.getApiClient()
    +        self.dbclient = self.testClient.getDbConnection()
    +        self.cleanup = []
    +
    +    def tearDown(self):
    +        try:
    +            cleanup_resources(self.apiclient, self.cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    @attr(tags=["basic", "advanced"], required_hardware="true")
    +    def test_01_storage_snapshots_limits(self):
    +        """ Storage and Snapshot Limit
    +            1.   Create Snapshot of ROOT disk.
    +            2.   Verify the Secondary Storage value\
    +                 is increased by the size of snapshot.
    +            3.   Delete Snaphshot.
    +            4.   Verify the Secondary\
    +                 Storage value is decreased by the size of snapshot.
    +            5.   Set the Snapshot limit of Account.
    +            6.   Create Snasphots till limit is reached.
    +            7.   Create Snapshot of ROOT Volume.\
    +                 Creation should fail.
    +            8.   Delete few Snapshots.
    +            9.   Create Snapshot again.
    +                 Creation should succeed.
    +        """
    +
    +        # Get ROOT Volume
    +        root_volumes_list = Volume.list(
    +            self.userapiclient,
    +            virtualmachineid=self.vm.id,
    +            type='ROOT',
    +            listall=True
    +        )
    +
    +        self.assertEqual(
    +            isinstance(
    --- End diff --
    
    use validateList method


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to