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

    https://github.com/apache/cloudstack/pull/1401#discussion_r52417597
  
    --- Diff: test/integration/component/test_project_usage.py ---
    @@ -1819,3 +1844,183 @@ def test_01_vpn_usage(self):
                                 "Check VPN.USER.ADD in events table"
                             )
             return
    +
    +class TestVMSnapshotUsage(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        cls.testClient = super(TestVMSnapshotUsage, cls).getClsTestClient()
    +        cls.api_client = cls.testClient.getApiClient()
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +        cls.snapshotSupported = True
    +        cls._cleanup = []
    +        if cls.hypervisor.lower() in ['hyperv', 'lxc', 'kvm','baremetal']:
    +            cls.snapshotSupported = False
    +            return
    +        cls.services = Services().services
    +        # Get Zone, Domain and templates
    +        cls.domain = get_domain(cls.api_client)
    +        cls.zone = get_zone(cls.api_client, 
cls.testClient.getZoneForTests())
    +        cls.services['mode'] = cls.zone.networktype
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +        template = get_template(
    +                            cls.api_client,
    +                            cls.zone.id,
    +                            cls.services["ostype"]
    +                            )
    +        cls.services["server"]["zoneid"] = cls.zone.id
    +
    +        cls.services["template"] = template.id
    +
    +        # Create Account, VMs etc
    +        cls.account = Account.create(
    +                            cls.api_client,
    +                            cls.services["account"],
    +                            domainid=cls.domain.id
    +                            )
    +
    +        cls.services["account"] = cls.account.name
    +
    +        cls.project = Project.create(
    +                                 cls.api_client,
    +                                 cls.services["project"],
    +                                 account=cls.account.name,
    +                                 domainid=cls.account.domainid
    +                                 )
    +
    +        cls.service_offering = ServiceOffering.create(
    +                                            cls.api_client,
    +                                            
cls.services["service_offering"]
    +                                            )
    +        cls.virtual_machine = VirtualMachine.create(
    +                                cls.api_client,
    +                                cls.services["server"],
    +                                templateid=template.id,
    +                                serviceofferingid=cls.service_offering.id,
    +                                projectid=cls.project.id
    +                                )
    +        cls._cleanup = [
    +                        cls.project,
    +                        cls.service_offering,
    +                        cls.account,
    +                        ]
    +        return
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        try:
    +            #Cleanup resources used
    +            cleanup_resources(cls.api_client, cls._cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    def setUp(self):
    +        self.apiclient = self.testClient.getApiClient()
    +        self.dbclient = self.testClient.getDbConnection()
    +        self.cleanup = []
    +        if not self.snapshotSupported:
    +            self.skipTest("Snapshots are not supported on %s" % 
self.hypervisor)
    +        return
    +
    +    def tearDown(self):
    +        try:
    +            #Clean up, terminate the created instance and snapshots
    +            cleanup_resources(self.apiclient, self.cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    @attr(speed = "slow")
    +    @attr(tags=["advanced", "basic", "sg", "eip", "advancedns", 
"simulator"], required_hardware="false")
    --- End diff --
    
    If the test does not dependent on the zone type, please remove some tags :)


---
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