cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gauravaradhye <...@git.apache.org>
Subject [GitHub] cloudstack pull request: CLOUDSTACK-8380: Adding automation test c...
Date Thu, 02 Apr 2015 12:12:36 GMT
Github user gauravaradhye commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/117#discussion_r27651210
  
    --- Diff: test/integration/testpaths/testpath_volume_recurring_snap.py ---
    @@ -0,0 +1,1015 @@
    +# 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 VM/Volume recurring snapshot Test Path
    +"""
    +from nose.plugins.attrib import attr
    +from marvin.cloudstackTestCase import cloudstackTestCase, unittest
    +from marvin.lib.utils import (cleanup_resources,
    +                              is_snapshot_on_nfs,
    +                              validateList
    +                              )
    +from marvin.lib.base import (Account,
    +                             ServiceOffering,
    +                             DiskOffering,
    +                             VirtualMachine,
    +                             SnapshotPolicy,
    +                             Snapshot,
    +                             Configurations
    +                             )
    +from marvin.lib.common import (get_domain,
    +                               get_zone,
    +                               get_template,
    +                               list_volumes,
    +                               list_snapshots,
    +                               list_snapshot_policy
    +                               )
    +
    +from marvin.codes import PASS
    +
    +import time
    +
    +
    +class TestVolumeSnapshot(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        testClient = super(TestVolumeSnapshot, 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 = []
    +
    +        if cls.hypervisor.lower() not in [
    +                "vmware",
    +                "kvm",
    +                "xenserver"]:
    +            raise unittest.SkipTest(
    +                "Storage migration not supported on %s" %
    +                cls.hypervisor)
    +
    +        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)
    +            # Create Disk offering
    +            cls.disk_offering = DiskOffering.create(
    +                cls.apiclient,
    +                cls.testdata["disk_offering"],
    +            )
    +            cls._cleanup.append(cls.disk_offering)
    +            # Deploy A VM
    +            cls.vm_1 = 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,
    +                diskofferingid=cls.disk_offering.id,
    +                mode=cls.zone.networktype
    +            )
    +
    +            cls.volume = list_volumes(
    +                cls.apiclient,
    +                virtualmachineid=cls.vm_1.id,
    +                type='ROOT',
    +                listall=True
    +            )
    +
    +            cls.data_volume = list_volumes(
    +                cls.apiclient,
    +                virtualmachineid=cls.vm_1.id,
    +                type='DATADISK',
    +                listall=True
    +            )
    +
    +        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=["advanced", "basic"])
    +    def test_01_volume_snapshot(self):
    +        """ Test Volume (root) Snapshot
    +        # 1. Create Hourly, Daily,Weekly recurring snapshot policy for ROOT disk and
\
    +                    Verify the presence of the corresponding snapshots on the Secondary
Storage
    +        # 2. Delete the snapshot policy and verify the entry as Destroyed in snapshot_schedule
    +        # 3. Verify that maxsnaps should not consider manual snapshots for deletion
    +        # 4. Snapshot policy should reflect the correct timezone
    +        # 5. Verify that listSnapshotPolicies() should return all snapshot policies \
    +                that belong to the account (both manual and recurring snapshots)
    +        # 6. Verify that listSnapshotPolicies() should not return snapshot \
    +                policies that have been deleted
    +        # 7. Verify that snapshot should not be created for VM in Destroyed state
    +        # 8. Verify that snapshot should get created after resuming the VM
    +        # 9. Verify that All the recurring policies associated with the VM should be
\
    +                deleted after VM get destroyed.
    +        """
    +        # Step 1
    +        recurring_snapshot = SnapshotPolicy.create(
    +            self.apiclient,
    +            self.volume[0].id,
    +            self.testdata["recurring_snapshot"]
    --- End diff --
    
    What is the snapshot policy interval here? Rather than passing same data as in test data,
define the data in the test case itself whichever interval is want, and pass that data to
snapshot policy. The test case behavior should not change if the dict in test_data.py is changed
in future.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message