Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D6514200B13 for ; Wed, 11 May 2016 05:50:19 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D51F4160A12; Wed, 11 May 2016 03:50:19 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D3459160A11 for ; Wed, 11 May 2016 05:50:18 +0200 (CEST) Received: (qmail 37071 invoked by uid 500); 11 May 2016 03:50:18 -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 37045 invoked by uid 99); 11 May 2016 03:50:17 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 May 2016 03:50:17 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BFC75DFE16; Wed, 11 May 2016 03:50:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: swill@apache.org To: commits@cloudstack.apache.org Date: Wed, 11 May 2016 03:50:18 -0000 Message-Id: In-Reply-To: <09a81066af934fa69f5e3b2620f13441@git.apache.org> References: <09a81066af934fa69f5e3b2620f13441@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/3] git commit: updated refs/heads/master to de582a4 archived-at: Wed, 11 May 2016 03:50:20 -0000 CLOUDSTACK-9351: Add marvin test and add it to travis file Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b9d75c6f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b9d75c6f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b9d75c6f Branch: refs/heads/master Commit: b9d75c6ffaf382468b6a0359ee24bb2915615d9b Parents: baa8610 Author: nvazquez Authored: Wed May 4 16:00:44 2016 -0300 Committer: nvazquez Committed: Tue May 10 12:35:55 2016 -0700 ---------------------------------------------------------------------- .travis.yml | 2 +- .../smoke/test_list_ids_parameter.py | 295 +++++++++++++++++++ 2 files changed, 296 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9d75c6f/.travis.yml ---------------------------------------------------------------------- diff --git a/.travis.yml b/.travis.yml index 1441fa4..d160e48 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,7 +37,7 @@ env: - PATH=$HOME/.local/bin:$PATH matrix: - TESTS="smoke/test_affinity_groups smoke/test_affinity_groups_projects smoke/test_deploy_vgpu_enabled_vm smoke/test_deploy_vm_iso smoke/test_deploy_vm_root_resize smoke/test_deploy_vm_with_userdata smoke/test_deploy_vms_with_varied_deploymentplanners smoke/test_disk_offerings smoke/test_global_settings smoke/test_guest_vlan_range" - - TESTS="smoke/test_hosts smoke/test_internal_lb smoke/test_iso smoke/test_loadbalance smoke/test_multipleips_per_nic smoke/test_network smoke/test_network_acl smoke/test_nic smoke/test_nic_adapter_type smoke/test_non_contigiousvlan" + - TESTS="smoke/test_hosts smoke/test_internal_lb smoke/test_iso smoke/test_list_ids_parameter smoke/test_loadbalance smoke/test_multipleips_per_nic smoke/test_network smoke/test_network_acl smoke/test_nic smoke/test_nic_adapter_type smoke/test_non_contigiousvlan" - TESTS="smoke/test_over_provisioning smoke/test_password_server smoke/test_portable_publicip smoke/test_primary_storage smoke/test_privategw_acl smoke/test_public_ip_range smoke/test_pvlan smoke/test_regions smoke/test_reset_vm_on_reboot smoke/test_resource_detail" - TESTS="smoke/test_router_dhcphosts smoke/test_routers smoke/test_routers_iptables_default_policy smoke/test_routers_network_ops smoke/test_scale_vm smoke/test_secondary_storage smoke/test_service_offerings smoke/test_snapshots smoke/test_ssvm smoke/test_templates" - TESTS="smoke/test_usage_events smoke/test_vm_life_cycle smoke/test_vm_snapshots smoke/test_volumes smoke/test_vpc_redundant smoke/test_vpc_router_nics smoke/test_vpc_vpn smoke/misc/test_deploy_vm smoke/misc/test_vm_ha smoke/misc/test_escalations_templates smoke/misc/test_vm_sync" http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9d75c6f/test/integration/smoke/test_list_ids_parameter.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_list_ids_parameter.py b/test/integration/smoke/test_list_ids_parameter.py new file mode 100755 index 0000000..be9554b --- /dev/null +++ b/test/integration/smoke/test_list_ids_parameter.py @@ -0,0 +1,295 @@ +# 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"] + ) + + #Take 3 VM1 Snapshots + #PLEASE UNCOMMENT ONCE VM SNAPSHOT DELAY BUG AFTER VM CREATION IS FIXED + """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 + + @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false") + def test_01_list_volumes(self): + """Test listing Volumes using 'ids' parameter + """ + list_volume_response = Volume.list( + self.apiclient, + ids=[self.vm1_root_volume.id, self.vm2_root_volume.id, self.vm3_root_volume.id], + type='ROOT', + listAll=True + ) + self.assertEqual( + isinstance(list_volume_response, list), + True, + "List Volume response was not a valid list" + ) + self.assertEqual( + len(list_volume_response), + 3, + "ListVolumes response expected 3 Volumes, received %s" % len(list_volume_response) + ) + + @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false") + def test_02_list_templates(self): + """Test listing Templates using 'ids' parameter + """ + list_template_response = Template.list( + self.apiclient, + templatefilter='all', + ids=[self.template_1.id, self.template_2.id, self.template_3.id], + account=self.account.name, + domainid=self.account.domainid, + listAll=True + ) + self.assertEqual( + isinstance(list_template_response, list), + True, + "ListTemplates response was not a valid list" + ) + self.assertEqual( + len(list_template_response), + 3, + "ListTemplates response expected 3 Templates, received %s" % len(list_template_response) + ) + + @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false") + def test_03_list_snapshots(self): + """Test listing Snapshots using 'ids' parameter + """ + list_snapshot_response = Snapshot.list( + self.apiclient, + ids=[self.snapshot_1.id, self.snapshot_2.id, self.snapshot_3.id], + listAll=True + ) + self.assertEqual( + isinstance(list_snapshot_response, list), + True, + "ListSnapshots response was not a valid list" + ) + self.assertEqual( + len(list_snapshot_response), + 3, + "ListSnapshots response expected 3 Snapshots, received %s" % len(list_snapshot_response) + ) + + #PLEASE UNCOMMENT ONCE VM SNAPSHOT DELAY BUG AFTER VM CREATION IS FIXED + #@attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false") + #def test_04_list_vm_snapshots(self): + """Test listing VMSnapshots using 'vmsnapshotids' parameter + """ + """list_vm_snapshot_response = VmSnapshot.list( + self.apiclient, + vmsnapshotids=[self.vmsnapshot_1.id, self.vmsnapshot_2.id, self.vmsnapshot_3.id], + listall=True + ) + self.assertEqual( + isinstance(list_vm_snapshot_response, list), + True, + "ListVMSnapshots response was not a valid list" + ) + self.assertEqual( + len(list_vm_snapshot_response), + 3, + "ListVMSnapshots response expected 3 VMSnapshots, received %s" % len(list_vm_snapshot_response) + )"""