cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From koushik-das <...@git.apache.org>
Subject [GitHub] cloudstack pull request: CLOUDSTACK-9351: Add ids parameter to res...
Date Mon, 09 May 2016 07:01:43 GMT
Github user koushik-das commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1497#discussion_r62456186
  
    --- Diff: test/integration/smoke/test_list_ids_parameter.py ---
    @@ -0,0 +1,293 @@
    +# 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.
    +""" Tests for API listing methods using 'ids' parameter
    +"""
    +#Import Local Modules
    +from marvin.cloudstackTestCase import cloudstackTestCase
    +from marvin.lib.utils import (cleanup_resources,
    +                              validateList)
    +from marvin.lib.base import (Account,
    +                             Volume,
    +                             DiskOffering,
    +                             Template,
    +                             ServiceOffering,
    +                             Snapshot,
    +                             VmSnapshot,
    +                             VirtualMachine)
    +from marvin.lib.common import (get_domain,
    +                                get_zone, get_template)
    +from marvin.codes import FAILED, PASS
    +from nose.plugins.attrib import attr
    +#Import System modules
    +import time
    +
    +_multiprocess_shared_ = True
    +class TestListIdsParams(cloudstackTestCase):
    +    
    +    @classmethod
    +    def setUpClass(cls):
    +        testClient = super(TestListIdsParams, cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.services = testClient.getParsedTestDataConfig()
    +        cls.hypervisor = testClient.getHypervisorInfo()
    +
    +        cls.domain = get_domain(cls.apiclient)
    +        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
    +
    +        cls.disk_offering = DiskOffering.create(
    +                                    cls.apiclient,
    +                                    cls.services["disk_offering"]
    +                                    )
    +
    +        cls.account = Account.create(
    +                            cls.apiclient,
    +                            cls.services["account"],
    +                            domainid=cls.domain.id
    +                            )
    +        cls.service_offering = ServiceOffering.create(
    +                                            cls.apiclient,
    +                                            cls.services["service_offerings"]["tiny"]
    +                                            )
    +
    +        template = get_template(
    +                            cls.apiclient,
    +                            cls.zone.id,
    +                            cls.services["ostype"]
    +                            )
    +        if template == FAILED:
    +            assert False, "get_template() failed to return template with description
%s" % cls.services["ostype"]
    +            
    +        cls.services["template"]["ostypeid"] = template.ostypeid
    +        cls.services["template_2"]["ostypeid"] = template.ostypeid
    +        cls.services["ostypeid"] = template.ostypeid
    +        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
    +        cls.services["mode"] = cls.zone.networktype
    +
    +        #Create 3 VMs
    +        cls.virtual_machine_1 = VirtualMachine.create(
    +                                cls.apiclient,
    +                                cls.services["virtual_machine"],
    +                                templateid=template.id,
    +                                accountid=cls.account.name,
    +                                domainid=cls.account.domainid,
    +                                serviceofferingid=cls.service_offering.id,
    +                                mode=cls.services["mode"]
    +                                )
    +        cls.virtual_machine_2 = VirtualMachine.create(
    +                                cls.apiclient,
    +                                cls.services["virtual_machine"],
    +                                templateid=template.id,
    +                                accountid=cls.account.name,
    +                                domainid=cls.account.domainid,
    +                                serviceofferingid=cls.service_offering.id,
    +                                mode=cls.services["mode"]
    +                                )
    +        cls.virtual_machine_3 = VirtualMachine.create(
    +                                cls.apiclient,
    +                                cls.services["virtual_machine"],
    +                                templateid=template.id,
    +                                accountid=cls.account.name,
    +                                domainid=cls.account.domainid,
    +                                serviceofferingid=cls.service_offering.id,
    +                                mode=cls.services["mode"]
    +                                )
    +
    +        #Sleep for 12 minutes after vms creation because of bug while taking snapshots.

    +        time.sleep(720)
    +
    +        #Take 3 VM1 Snapshots
    +        cls.vmsnapshot_1 = VmSnapshot.create(
    +                                cls.apiclient,
    +                                cls.virtual_machine_1.id
    +                            )
    +        cls.vmsnapshot_2 = VmSnapshot.create(
    +                                cls.apiclient,
    +                                cls.virtual_machine_1.id
    +                            )
    +        cls.vmsnapshot_3 = VmSnapshot.create(
    +                                cls.apiclient,
    +                                cls.virtual_machine_1.id
    +                            )
    +
    +        #Stop VMs
    +        cls.virtual_machine_1.stop(cls.apiclient)
    +        cls.virtual_machine_2.stop(cls.apiclient)
    +        cls.virtual_machine_3.stop(cls.apiclient)
    +
    +        #Get ROOT volumes of 3 VMs        
    +        vm1RootVolumeResponse = Volume.list(
    +                                            cls.apiclient,
    +                                            virtualmachineid=cls.virtual_machine_1.id,
    +                                            type='ROOT',
    +                                            listall=True
    +                                            )
    +        vm2RootVolumeResponse = Volume.list(
    +                                            cls.apiclient,
    +                                            virtualmachineid=cls.virtual_machine_2.id,
    +                                            type='ROOT',
    +                                            listall=True
    +                                            )
    +        vm3RootVolumeResponse = Volume.list(
    +                                            cls.apiclient,
    +                                            virtualmachineid=cls.virtual_machine_3.id,
    +                                            type='ROOT',
    +                                            listall=True
    +                                            )
    +        cls.vm1_root_volume = vm1RootVolumeResponse[0]
    +        cls.vm2_root_volume = vm2RootVolumeResponse[0]
    +        cls.vm3_root_volume = vm3RootVolumeResponse[0]
    +
    +        #Take 3 snapshots of VM2's ROOT volume
    +        cls.snapshot_1 = Snapshot.create(
    +                                         cls.apiclient,
    +                                         cls.vm2_root_volume.id,
    +                                         account=cls.account.name,
    +                                         domainid=cls.account.domainid
    +                                         )
    +        cls.snapshot_2 = Snapshot.create(
    +                                         cls.apiclient,
    +                                         cls.vm2_root_volume.id,
    +                                         account=cls.account.name,
    +                                         domainid=cls.account.domainid
    +                                         )
    +        cls.snapshot_3 = Snapshot.create(
    +                                         cls.apiclient,
    +                                         cls.vm2_root_volume.id,
    +                                         account=cls.account.name,
    +                                         domainid=cls.account.domainid
    +                                         )
    +
    +        #Create 3 templates
    +        cls.template_1 = Template.create(
    +                                         cls.apiclient,
    +                                         cls.services["template"],
    +                                         cls.vm3_root_volume.id,
    +                                         account=cls.account.name,
    +                                         domainid=cls.account.domainid
    +                                         )
    +        cls.template_2 = Template.create(
    +                                         cls.apiclient,
    +                                         cls.services["template_2"],
    +                                         cls.vm3_root_volume.id,
    +                                         account=cls.account.name,
    +                                         domainid=cls.account.domainid
    +                                         )
    +        cls.template_3 = Template.create(
    +                                         cls.apiclient,
    +                                         cls.services["template_2"],
    +                                         cls.vm3_root_volume.id,
    +                                         account=cls.account.name,
    +                                         domainid=cls.account.domainid
    +                                         )
    +        
    +        cls._cleanup = [
    +                        cls.disk_offering,
    +                        cls.account,
    +                        cls.service_offering,
    +                        cls.snapshot_1,
    +                        cls.snapshot_2,
    +                        cls.snapshot_3
    +                        ]
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        cls.apiclient = super(TestListIdsParams, cls).getClsTestClient().getApiClient()
    +        try:
    +            cleanup_resources(cls.apiclient, cls._cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    def test_01_list_volumes(self):
    --- End diff --
    
    Add tags as appropriate


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