Repository: cloudstack Updated Branches: refs/heads/pytest c15035874 -> 9610685f4
add mark.tags Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9610685f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9610685f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9610685f Branch: refs/heads/pytest Commit: 9610685f454eea4abaf36103caa1b10bdb3262d0 Parents: c150358 Author: Edison Su <sudi...@gmail.com> Authored: Mon Sep 15 18:29:30 2014 -0700 Committer: Edison Su <sudi...@gmail.com> Committed: Mon Sep 15 18:29:30 2014 -0700 ---------------------------------------------------------------------- setup/dev/advanced.cfg | 2 +- test/integration/smoke/test_CS-18306.py | 2 +- test/integration/smoke/test_affinity_groups.py | 3 +- .../smoke/test_deploy_vgpu_enabled_vm.py | 5 +- .../smoke/test_deploy_vm_root_resize.py | 9 ++-- .../smoke/test_deploy_vm_with_userdata.py | 7 +-- ...deploy_vms_with_varied_deploymentplanners.py | 8 ++-- test/integration/smoke/test_disk_offerings.py | 15 +++--- test/integration/smoke/test_global_settings.py | 4 +- test/integration/smoke/test_guest_vlan_range.py | 4 +- test/integration/smoke/test_hosts.py | 4 +- test/integration/smoke/test_internal_lb.py | 4 +- test/integration/smoke/test_iso.py | 16 +++---- test/integration/smoke/test_loadbalance.py | 8 ++-- .../smoke/test_multipleips_per_nic.py | 4 +- test/integration/smoke/test_network.py | 25 +++++----- test/integration/smoke/test_network_acl.py | 4 +- test/integration/smoke/test_nic.py | 4 +- .../smoke/test_non_contigiousvlan.py | 4 +- .../integration/smoke/test_over_provisioning.py | 4 +- .../integration/smoke/test_portable_publicip.py | 6 +-- test/integration/smoke/test_primary_storage.py | 6 +-- test/integration/smoke/test_privategw_acl.py | 4 +- test/integration/smoke/test_public_ip_range.py | 4 +- test/integration/smoke/test_pvlan.py | 4 +- test/integration/smoke/test_regions.py | 4 +- .../smoke/test_reset_vm_on_reboot.py | 6 +-- test/integration/smoke/test_resource_detail.py | 5 +- test/integration/smoke/test_routers.py | 20 ++++---- test/integration/smoke/test_scale_vm.py | 5 +- .../integration/smoke/test_secondary_storage.py | 6 +-- .../integration/smoke/test_service_offerings.py | 10 ++-- test/integration/smoke/test_snapshots.py | 4 +- test/integration/smoke/test_ssvm.py | 22 ++++----- test/integration/smoke/test_templates.py | 18 +++---- test/integration/smoke/test_vm_life_cycle.py | 49 +++++++++++--------- test/integration/smoke/test_vm_snapshots.py | 8 ++-- test/integration/smoke/test_volumes.py | 20 ++++---- test/integration/smoke/test_vpc_vpn.py | 6 +-- tools/marvin/marvin/config/test_data.py | 2 +- .../marvin/pytest/pytest_marvin_plugin.py | 40 ++++++++++++++-- 41 files changed, 211 insertions(+), 174 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/setup/dev/advanced.cfg ---------------------------------------------------------------------- diff --git a/setup/dev/advanced.cfg b/setup/dev/advanced.cfg index 18dee31..6eb9b4e 100644 --- a/setup/dev/advanced.cfg +++ b/setup/dev/advanced.cfg @@ -172,7 +172,7 @@ }, { "name": "account.cleanup.interval", - "value": "600" + "value": "60" }, { "name": "guest.domain.suffix", http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_CS-18306.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_CS-18306.py b/test/integration/smoke/test_CS-18306.py index 457f2b7..416cb5e 100644 --- a/test/integration/smoke/test_CS-18306.py +++ b/test/integration/smoke/test_CS-18306.py @@ -17,6 +17,6 @@ # under the License. import pytest -@pytest.mark.attr(tags=["advanced"], required_hardware=True) +@pytest.mark.tags(tags=["advanced"], required_hardware="false") def test_01_create_disk_offering(vm): assert vm is not None http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_affinity_groups.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_affinity_groups.py b/test/integration/smoke/test_affinity_groups.py index c1c5d5b..a01beba 100644 --- a/test/integration/smoke/test_affinity_groups.py +++ b/test/integration/smoke/test_affinity_groups.py @@ -24,6 +24,7 @@ from marvin.lib.base import * from marvin.lib.common import * from marvin.sshClient import SshClient from nose.plugins.attrib import attr +import pytest class TestDeployVmWithAffinityGroup(cloudstackTestCase): """ @@ -75,7 +76,7 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase): ] return - @attr(tags=["basic", "advanced", "multihost"], required_hardware="false") + @pytest.mark.tags(tags=["basic", "advanced", "multihost"], required_hardware="false") def test_DeployVmAntiAffinityGroup(self): """ test DeployVM in anti-affinity groups http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_deploy_vgpu_enabled_vm.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py index f13ac92..1fbf70e 100644 --- a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py +++ b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py @@ -35,8 +35,7 @@ from marvin.sshClient import SshClient from marvin.codes import FAILED, XEN_SERVER -from nose.plugins.attrib import attr - +import pytest class TestDeployvGPUenabledVM(cloudstackTestCase): """ Test deploy a vGPU enabled VM into a user account @@ -119,7 +118,7 @@ class TestDeployvGPUenabledVM(cloudstackTestCase): self.account ] - @attr(tags = ['advanced', 'basic', 'vgpu'], required_hardware="true") + @pytest.mark.tags(tags = ['advanced', 'basic', 'vgpu'], required_hardware="true") def test_deploy_vgpu_enabled_vm(self): """Test Deploy Virtual Machine http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_deploy_vm_root_resize.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_deploy_vm_root_resize.py b/test/integration/smoke/test_deploy_vm_root_resize.py index ff0211c..39d50c1 100644 --- a/test/integration/smoke/test_deploy_vm_root_resize.py +++ b/test/integration/smoke/test_deploy_vm_root_resize.py @@ -33,8 +33,7 @@ from marvin.lib.common import get_zone, get_domain, get_template, list_volumes from marvin.codes import FAILED -from nose.plugins.attrib import attr - +import pytest import re class TestData(object): @@ -105,7 +104,7 @@ class TestDeployVM(cloudstackTestCase): self.account ] - @attr(tags = ['advanced', 'basic', 'sg'], required_hardware="true") + @pytest.mark.tags(tags = ['advanced', 'basic', 'sg'], required_hardware="true") def test_00_deploy_vm_root_resize(self): """Test deploy virtual machine with root resize @@ -204,7 +203,7 @@ class TestDeployVM(cloudstackTestCase): self.assertEqual(success, True, "Check if unsupported hypervisor %s fails appropriately" % self.hypervisor) - @attr(tags = ['advanced', 'basic', 'sg'], required_hardware="true") + @pytest.mark.tags(tags = ['advanced', 'basic', 'sg'], required_hardware="true") def test_01_deploy_vm_root_resize(self): """Test proper failure to deploy virtual machine with rootdisksize of 0 """ @@ -232,7 +231,7 @@ class TestDeployVM(cloudstackTestCase): else: self.debug("test 01 does not support hypervisor type " + self.hypervisor); - @attr(tags = ['advanced', 'basic', 'sg'], required_hardware="true", BugId="CLOUDSTACK-6984") + @pytest.mark.tags(tags = ['advanced', 'basic', 'sg'], required_hardware="true", BugId="CLOUDSTACK-6984") def test_02_deploy_vm_root_resize(self): """Test proper failure to deploy virtual machine with rootdisksize less than template size """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_deploy_vm_with_userdata.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_deploy_vm_with_userdata.py b/test/integration/smoke/test_deploy_vm_with_userdata.py index c98b38a..95c1d3d 100644 --- a/test/integration/smoke/test_deploy_vm_with_userdata.py +++ b/test/integration/smoke/test_deploy_vm_with_userdata.py @@ -21,10 +21,11 @@ from marvin.lib.base import (ServiceOffering, Account) from marvin.lib.common import get_template, get_zone, list_virtual_machines from marvin.lib.utils import cleanup_resources -from nose.plugins.attrib import attr + from marvin.codes import FAILED import random import string +import pytest class TestDeployVmWithUserData(cloudstackTestCase): """Tests for UserData @@ -70,7 +71,7 @@ class TestDeployVmWithUserData(cloudstackTestCase): def setup(self): self.hypervisor = self.testClient.getHypervisorInfo() - @attr(tags=["devcloud", "basic", "advanced", "post"], required_hardware="true") + @pytest.mark.tags(tags=["devcloud", "basic", "advanced", "post"], required_hardware="true") def test_deployvm_userdata_post(self): """Test userdata as POST, size > 2k """ @@ -95,7 +96,7 @@ class TestDeployVmWithUserData(cloudstackTestCase): self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test") self.assert_(vm.state == "Running", "VM is not in Running state") - @attr(tags=["devcloud", "basic", "advanced"], required_hardware="true") + @pytest.mark.tags(tags=["devcloud", "basic", "advanced"], required_hardware="true") def test_deployvm_userdata(self): """Test userdata as GET, size > 2k """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py index 9fcb643..09a43f5 100644 --- a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py +++ b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py @@ -20,7 +20,7 @@ from marvin.cloudstackTestCase import cloudstackTestCase from marvin.lib.base import Account, VirtualMachine, ServiceOffering, Host, Cluster from marvin.lib.common import get_zone, get_domain, get_template from marvin.lib.utils import cleanup_resources -from nose.plugins.attrib import attr +import pytest class TestDeployVmWithVariedPlanners(cloudstackTestCase): """ Test to create services offerings for deployment planners @@ -60,7 +60,7 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase): cls.account ] - @attr(tags=["advanced", "basic", "sg"], required_hardware="false") + @pytest.mark.tags(tags=["advanced", "basic", "sg"], required_hardware="false") def test_deployvm_firstfit(self): """Test to deploy vm with a first fit offering """ @@ -104,7 +104,7 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase): msg="VM is not in Running state" ) - @attr(tags=["advanced", "basic", "sg"], required_hardware="false") + @pytest.mark.tags(tags=["advanced", "basic", "sg"], required_hardware="false") def test_deployvm_userdispersing(self): """Test deploy VMs using user dispersion planner """ @@ -163,7 +163,7 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase): self.debug("VMs (%s, %s) meant to be dispersed are deployed in the same cluster %s" % ( vm1.id, vm2.id, vm1clusterid)) - @attr(tags=["advanced", "basic", "sg"], required_hardware="false") + @pytest.mark.tags(tags=["advanced", "basic", "sg"], required_hardware="false") def test_deployvm_userconcentrated(self): """Test deploy VMs using user concentrated planner """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_disk_offerings.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_disk_offerings.py b/test/integration/smoke/test_disk_offerings.py index bf89ee3..6ac617e 100644 --- a/test/integration/smoke/test_disk_offerings.py +++ b/test/integration/smoke/test_disk_offerings.py @@ -23,7 +23,7 @@ from marvin.cloudstackAPI import * from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest _multiprocess_shared_ = True @@ -45,7 +45,7 @@ class TestCreateDiskOffering(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return - @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke"], required_hardware="false") def test_01_create_disk_offering(self): """Test to create disk offering @@ -89,8 +89,7 @@ class TestCreateDiskOffering(cloudstackTestCase): ) return - @attr(hypervisor="kvm") - @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "simulator", "smoke"]) + @pytest.mark.tags(tags = ["advanced", "basic", "eip", "sg", "advancedns", "simulator", "smoke"], hypervisors=["kvm"]) def test_02_create_sparse_type_disk_offering(self): """Test to create a sparse type disk offering""" @@ -130,8 +129,8 @@ class TestCreateDiskOffering(cloudstackTestCase): return - @attr(hypervisor="kvm") - @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "simulator", "smoke"]) + + @pytest.mark.tags(tags = ["advanced", "basic", "eip", "sg", "advancedns", "simulator", "smoke"], hypervisors=["kvm"]) def test_04_create_fat_type_disk_offering(self): """Test to create a sparse type disk offering""" @@ -213,7 +212,7 @@ class TestDiskOfferings(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return - @attr(tags=["advanced", "basic", "eip", "sg", "advancedns", "smoke"], required_hardware="false") + @pytest.mark.tags(tags=["advanced", "basic", "eip", "sg", "advancedns", "smoke"], required_hardware="false") def test_02_edit_disk_offering(self): """Test to update existing disk offering @@ -265,7 +264,7 @@ class TestDiskOfferings(cloudstackTestCase): ) return - @attr(tags=["advanced", "basic", "eip", "sg", "advancedns", "smoke"], required_hardware="false") + @pytest.mark.tags(tags=["advanced", "basic", "eip", "sg", "advancedns", "smoke"], required_hardware="false") def test_03_delete_disk_offering(self): """Test to delete disk offering http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_global_settings.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_global_settings.py b/test/integration/smoke/test_global_settings.py index 4920421..8e10140 100644 --- a/test/integration/smoke/test_global_settings.py +++ b/test/integration/smoke/test_global_settings.py @@ -22,7 +22,7 @@ from marvin.cloudstackAPI import * from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest #Import System modules class TestUpdateConfigWithScope(cloudstackTestCase): @@ -32,7 +32,7 @@ class TestUpdateConfigWithScope(cloudstackTestCase): def setUp(self): self.apiClient = self.testClient.getApiClient() - @attr(tags=["devcloud", "basic", "advanced"], required_hardware="false") + @pytest.mark.tags(tags=["devcloud", "basic", "advanced"], required_hardware="false") def test_UpdateConfigParamWithScope(self): """ test update configuration setting at zone level scope http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_guest_vlan_range.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_guest_vlan_range.py b/test/integration/smoke/test_guest_vlan_range.py index 12ea52e..83d6d88 100644 --- a/test/integration/smoke/test_guest_vlan_range.py +++ b/test/integration/smoke/test_guest_vlan_range.py @@ -18,7 +18,7 @@ """ #Import Local Modules import marvin -from nose.plugins.attrib import attr +import pytest from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * from marvin.lib.utils import * @@ -78,7 +78,7 @@ class TestDedicateGuestVlanRange(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return - @attr(tags=["advanced", "guestvlanrange", "dedicate", "release"], required_hardware="false") + @pytest.mark.tags(tags=["advanced", "guestvlanrange", "dedicate", "release"], required_hardware="false") def test_dedicateGuestVlanRange(self): """Test guest vlan range dedication """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_hosts.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_hosts.py b/test/integration/smoke/test_hosts.py index 952f160..d4fddc4 100644 --- a/test/integration/smoke/test_hosts.py +++ b/test/integration/smoke/test_hosts.py @@ -24,7 +24,7 @@ from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * from marvin.lib.utils import (random_gen) -from nose.plugins.attrib import attr +import pytest #Import System modules import time @@ -53,7 +53,7 @@ class TestHosts(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return - #@attr(tags=["selfservice"]) + @pytest.mark.skipif(True,reason="you can't just write test case like this") def test_01_clusters(self): """Test Add clusters & hosts - simulator http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_internal_lb.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_internal_lb.py b/test/integration/smoke/test_internal_lb.py index d2e6364..37c3f5f 100644 --- a/test/integration/smoke/test_internal_lb.py +++ b/test/integration/smoke/test_internal_lb.py @@ -23,7 +23,7 @@ from marvin.cloudstackAPI import * from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest class TestInternalLb(cloudstackTestCase): """Test Internal LB @@ -56,7 +56,7 @@ class TestInternalLb(cloudstackTestCase): cls.account.id)) cls.cleanup = [cls.account] - @attr(tags=["smoke", "advanced"], required_hardware="true") + @pytest.mark.tags(tags=["smoke", "advanced"], required_hardware="true") def test_internallb(self): """Test create, delete, assign, remove of internal loadbalancer """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_iso.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_iso.py b/test/integration/smoke/test_iso.py index 3498ad7..2645a31 100644 --- a/test/integration/smoke/test_iso.py +++ b/test/integration/smoke/test_iso.py @@ -23,7 +23,7 @@ from marvin.cloudstackAPI import * from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest import urllib from random import random #Import System modules @@ -75,7 +75,7 @@ class TestCreateIso(cloudstackTestCase): return - @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "basic", "eip", "sg", "advancedns"], required_hardware="false") def test_01_create_iso(self): """Test create public & private ISO """ @@ -229,7 +229,7 @@ class TestISO(cloudstackTestCase): return - @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke"], required_hardware="false") def test_02_edit_iso(self): """Test Edit ISO """ @@ -294,7 +294,7 @@ class TestISO(cloudstackTestCase): ) return - @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "basic", "eip", "sg", "advancedns"], required_hardware="false") def test_03_delete_iso(self): """Test delete ISO """ @@ -322,7 +322,7 @@ class TestISO(cloudstackTestCase): ) return - @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "basic", "eip", "sg", "advancedns"], required_hardware="true") def test_04_extract_Iso(self): "Test for extract ISO" @@ -373,7 +373,7 @@ class TestISO(cloudstackTestCase): ) return - @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke", "selfservice"]) + @pytest.mark.tags(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke", "selfservice"]) def test_05_iso_permissions(self): """Update & Test for ISO permissions""" @@ -425,7 +425,7 @@ class TestISO(cloudstackTestCase): ) return - @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke", "multizone", "provisioning"]) + @pytest.mark.tags(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke", "multizone", "provisioning"]) def test_06_copy_iso(self): """Test for copy ISO from one zone to another""" @@ -482,7 +482,7 @@ class TestISO(cloudstackTestCase): # Cleanup- Delete the copied ISO timeout = self.services["timeout"] while True: - time.sleep(self.services["sleep"]) + time.sleep(5) list_iso_response = list_isos( self.apiclient, id=self.iso_2.id, http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_loadbalance.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_loadbalance.py b/test/integration/smoke/test_loadbalance.py index f662974..3b72d4f 100644 --- a/test/integration/smoke/test_loadbalance.py +++ b/test/integration/smoke/test_loadbalance.py @@ -22,7 +22,7 @@ from marvin.sshClient import SshClient from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest #Import System modules import time @@ -143,7 +143,7 @@ class TestLoadBalance(cloudstackTestCase): time.sleep(10) return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="true") def test_01_create_lb_rule_src_nat(self): """Test to create Load balancing rule with source NAT""" @@ -303,7 +303,7 @@ class TestLoadBalance(cloudstackTestCase): self.try_ssh(src_nat_ip_addr.ipaddress, hostnames) return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="true") def test_02_create_lb_rule_non_nat(self): """Test to create Load balancing rule with non source NAT""" @@ -421,7 +421,7 @@ class TestLoadBalance(cloudstackTestCase): self.try_ssh(self.non_src_nat_ip.ipaddress.ipaddress, hostnames) return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="true") def test_assign_and_removal_lb(self): """Test for assign & removing load balancing rule""" http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_multipleips_per_nic.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_multipleips_per_nic.py b/test/integration/smoke/test_multipleips_per_nic.py index 4093356..4d5b697 100644 --- a/test/integration/smoke/test_multipleips_per_nic.py +++ b/test/integration/smoke/test_multipleips_per_nic.py @@ -37,7 +37,7 @@ from marvin.cloudstackAPI.removeIpFromNic import removeIpFromNicCmd from marvin.cloudstackAPI.listNics import listNicsCmd -from nose.plugins.attrib import attr +import pytest class TestDeployVM(cloudstackTestCase): """Test deploy a VM into a user account @@ -122,7 +122,7 @@ class TestDeployVM(cloudstackTestCase): msg="VM is not in Running state" ) - @attr(tags = ['advanced', 'basic'], required_hardware="false") + @pytest.mark.tags(tags = ['advanced', 'basic'], required_hardware="false") def test_nic_secondaryip_add_remove(self): #TODO: SIMENH: add verification list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_network.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py index cca1803..26d887e 100644 --- a/test/integration/smoke/test_network.py +++ b/test/integration/smoke/test_network.py @@ -26,7 +26,7 @@ from marvin.sshClient import SshClient from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest #Import System modules import time @@ -116,7 +116,7 @@ class TestPublicIP(cloudstackTestCase): return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") def test_public_ip_admin_account(self): """Test for Associate/Disassociate public IP address for admin account""" @@ -152,7 +152,8 @@ class TestPublicIP(cloudstackTestCase): ) ip_address.delete(self.apiclient) - time.sleep(30) + time.sleep(self.services["sleep"]) + # Validate the following: # 1.listPublicIpAddresses should no more return the released address @@ -166,7 +167,7 @@ class TestPublicIP(cloudstackTestCase): self.fail("list public ip response is not empty") return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") def test_public_ip_user_account(self): """Test for Associate/Disassociate public IP address for user account""" @@ -279,7 +280,7 @@ class TestPortForwarding(cloudstackTestCase): cleanup_resources(self.apiclient, self.cleanup) return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="true") def test_01_port_fwd_on_src_nat(self): """Test for port forwarding on source NAT""" @@ -406,7 +407,7 @@ class TestPortForwarding(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="true") def test_02_port_fwd_on_non_src_nat(self): """Test for port forwarding on non source NAT""" @@ -567,7 +568,8 @@ class TestRebootRouter(cloudstackTestCase): ) # Wait for VM to come up - time.sleep(120) + time.sleep(self.services["sleep"]) + src_nat_ip_addrs = list_publicIP( self.apiclient, @@ -617,7 +619,7 @@ class TestRebootRouter(cloudstackTestCase): ] return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="true") def test_reboot_router(self): """Test for reboot router""" @@ -773,7 +775,7 @@ class TestReleaseIP(cloudstackTestCase): def tearDown(self): cleanup_resources(self.apiclient, self.cleanup) - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") def test_releaseIP(self): """Test for release public IP address""" @@ -792,7 +794,8 @@ class TestReleaseIP(cloudstackTestCase): isIpAddressDisassociated = True break retriesCount -= 1 - time.sleep(60) + time.sleep(self.services["sleep"]) + # End while self.assertTrue(isIpAddressDisassociated, "Failed to disassociate IP address") @@ -898,7 +901,7 @@ class TestDeleteAccount(cloudstackTestCase): self.cleanup = [] return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") def test_delete_account(self): """Test for delete account""" http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_network_acl.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_network_acl.py b/test/integration/smoke/test_network_acl.py index 015ebab..ac0db19 100644 --- a/test/integration/smoke/test_network_acl.py +++ b/test/integration/smoke/test_network_acl.py @@ -23,7 +23,7 @@ from marvin.cloudstackAPI import * from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest class TestNetworkACL(cloudstackTestCase): @@ -54,7 +54,7 @@ class TestNetworkACL(cloudstackTestCase): cls.account.id)) cls.cleanup = [cls.account] - @attr(tags=["advanced"], required_hardware="true") + @pytest.mark.tags(tags=["advanced"], required_hardware="true") def test_network_acl(self): #TODO: SIMENH: add actual verification Logic for rules. """Test network ACL lists and items in VPC""" http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_nic.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_nic.py b/test/integration/smoke/test_nic.py index 488ed0a..ed9e3c5 100644 --- a/test/integration/smoke/test_nic.py +++ b/test/integration/smoke/test_nic.py @@ -23,7 +23,7 @@ from marvin.sshClient import SshClient from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest import signal import sys @@ -123,7 +123,7 @@ class TestNic(cloudstackTestCase): except Exception as ex: self.debug("Exception during NIC test SETUP!: " + str(ex)) - @attr(tags = ["devcloud", "smoke", "advanced", "advancedns"], required_hardware="true") + @pytest.mark.tags(tags = ["devcloud", "smoke", "advanced", "advancedns"], required_hardware="true") def test_01_nic(self): #TODO: SIMENH: add validation """Test to add and update added nic to a virtual machine""" http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_non_contigiousvlan.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_non_contigiousvlan.py b/test/integration/smoke/test_non_contigiousvlan.py index e444618..bc7cd16 100644 --- a/test/integration/smoke/test_non_contigiousvlan.py +++ b/test/integration/smoke/test_non_contigiousvlan.py @@ -19,7 +19,7 @@ from marvin.cloudstackTestCase import cloudstackTestCase from marvin.lib.base import PhysicalNetwork from marvin.lib.common import setNonContiguousVlanIds, get_zone -from nose.plugins.attrib import attr +import pytest class TestUpdatePhysicalNetwork(cloudstackTestCase): @@ -38,7 +38,7 @@ class TestUpdatePhysicalNetwork(cloudstackTestCase): raise Exception("Failed to set non contiguous vlan ids to test. Free some ids from \ from existing physical networks at ends") - @attr(tags = ["advanced"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced"], required_hardware="false") def test_extendPhysicalNetworkVlan(self): """ Test to update a physical network and extend its vlan http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_over_provisioning.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_over_provisioning.py b/test/integration/smoke/test_over_provisioning.py index 43d558e..60f846e 100644 --- a/test/integration/smoke/test_over_provisioning.py +++ b/test/integration/smoke/test_over_provisioning.py @@ -22,7 +22,7 @@ from marvin.cloudstackAPI import * from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest #Import System modules class TestUpdateOverProvision(cloudstackTestCase): @@ -32,7 +32,7 @@ class TestUpdateOverProvision(cloudstackTestCase): def setUp(self): self.apiClient = self.testClient.getApiClient() - @attr(tags=["devcloud", "basic", "advanced"], required_hardware="false") + @pytest.mark.tags(tags=["devcloud", "basic", "advanced"], required_hardware="false") def test_UpdateStorageOverProvisioningFactor(self): """ test update configuration setting at storage scope http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_portable_publicip.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_portable_publicip.py b/test/integration/smoke/test_portable_publicip.py index be37773..eef0283 100644 --- a/test/integration/smoke/test_portable_publicip.py +++ b/test/integration/smoke/test_portable_publicip.py @@ -21,7 +21,7 @@ from marvin.cloudstackAPI import * from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest class TestPortablePublicIPRange(cloudstackTestCase): @@ -75,7 +75,7 @@ class TestPortablePublicIPRange(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return - @attr(tags = ["basic", "advanced", "portablepublicip"], required_hardware="false") + @pytest.mark.tags(tags = ["basic", "advanced", "portablepublicip"], required_hardware="false") def test_createPortablePublicIPRange(self): """ Test to create a portable public ip range """ @@ -161,7 +161,7 @@ class TestPortablePublicIPAcquire(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return - @attr(tags = ["advanced", "portablepublicip"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "portablepublicip"], required_hardware="false") def test_createPortablePublicIPAcquire(self): """ Test to acquire a provisioned public ip range """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_primary_storage.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_primary_storage.py b/test/integration/smoke/test_primary_storage.py index 0813d28..28362f8 100644 --- a/test/integration/smoke/test_primary_storage.py +++ b/test/integration/smoke/test_primary_storage.py @@ -23,7 +23,7 @@ from marvin.cloudstackAPI import * from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest #Import System modules import time @@ -52,7 +52,7 @@ class TestPrimaryStorageServices(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") def test_01_primary_storage_nfs(self): """Test primary storage pools - XEN, KVM, VMWare. Not Supported for hyperv """ @@ -149,7 +149,7 @@ class TestPrimaryStorageServices(cloudstackTestCase): return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") def test_01_primary_storage_iscsi(self): """Test primary storage pools - XEN. Not Supported for kvm,hyperv,vmware """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_privategw_acl.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_privategw_acl.py b/test/integration/smoke/test_privategw_acl.py index cf0f8e3..00078de 100644 --- a/test/integration/smoke/test_privategw_acl.py +++ b/test/integration/smoke/test_privategw_acl.py @@ -22,7 +22,7 @@ from marvin.cloudstackAPI import * from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest class TestPrivateGwACL(cloudstackTestCase): @@ -39,7 +39,7 @@ class TestPrivateGwACL(cloudstackTestCase): self.privateGwId = None - @attr(tags=["advanced"], required_hardware="false") + @pytest.mark.tags(tags=["advanced"], required_hardware="false") def test_privategw_acl(self): #TODO: SIMENH: add a new test to verification of ACL rules http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_public_ip_range.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_public_ip_range.py b/test/integration/smoke/test_public_ip_range.py index e09f7b4..31569ab 100644 --- a/test/integration/smoke/test_public_ip_range.py +++ b/test/integration/smoke/test_public_ip_range.py @@ -18,7 +18,7 @@ """ #Import Local Modules import marvin -from nose.plugins.attrib import attr +import pytest from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * from marvin.lib.utils import * @@ -72,7 +72,7 @@ class TestDedicatePublicIPRange(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return - @attr(tags = ["advanced", "publiciprange", "dedicate", "release"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "publiciprange", "dedicate", "release"], required_hardware="false") def test_dedicatePublicIpRange(self): """Test public IP range dedication """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_pvlan.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_pvlan.py b/test/integration/smoke/test_pvlan.py index 149a310..afce454 100644 --- a/test/integration/smoke/test_pvlan.py +++ b/test/integration/smoke/test_pvlan.py @@ -24,7 +24,7 @@ from marvin.sshClient import SshClient from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest import telnetlib #Import System modules @@ -41,7 +41,7 @@ class TestPVLAN(cloudstackTestCase): def setUp(self): self.apiClient = self.testClient.getApiClient() - @attr(tags = ["advanced"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced"], required_hardware="false") def test_create_pvlan_network(self): self.debug("Test create pvlan network") createNetworkCmd = createNetwork.createNetworkCmd() http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_regions.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_regions.py b/test/integration/smoke/test_regions.py index 7b0dec3..77da8b5 100644 --- a/test/integration/smoke/test_regions.py +++ b/test/integration/smoke/test_regions.py @@ -20,7 +20,7 @@ from marvin.cloudstackAPI import * from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest class TestRegions(cloudstackTestCase): """Test Regions - basic region creation @@ -35,7 +35,7 @@ class TestRegions(cloudstackTestCase): cls.domain = get_domain(cls.apiclient) cls.cleanup = [] - @attr(tags=["basic", "advanced"], required_hardware="false") + @pytest.mark.tags(tags=["basic", "advanced"], required_hardware="false") def test_createRegion(self): """ Test for create region """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_reset_vm_on_reboot.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_reset_vm_on_reboot.py b/test/integration/smoke/test_reset_vm_on_reboot.py index 668c77f..e7cc5ac 100644 --- a/test/integration/smoke/test_reset_vm_on_reboot.py +++ b/test/integration/smoke/test_reset_vm_on_reboot.py @@ -24,7 +24,7 @@ from marvin.cloudstackAPI import * from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest _multiprocess_shared_ = True @@ -95,8 +95,8 @@ class TestResetVmOnReboot(cloudstackTestCase): cleanup_resources(self.apiclient, self.cleanup) return - @attr(hypervisor="xenserver") - @attr(tags=["advanced", "basic"], required_hardware="false") + + @pytest.mark.tags(tags=["advanced", "basic"], required_hardware="false", hypervisors=["xenserver"]) def test_01_reset_vm_on_reboot(self): #TODO: SIMENH: add new test to check volume contents """Test reset virtual machine on reboot http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_resource_detail.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_resource_detail.py b/test/integration/smoke/test_resource_detail.py index 7103c65..912a99e 100644 --- a/test/integration/smoke/test_resource_detail.py +++ b/test/integration/smoke/test_resource_detail.py @@ -18,13 +18,13 @@ """ #Import Local Modules import marvin +import pytest from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * from marvin.sshClient import SshClient from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr #Import System modules import time @@ -34,6 +34,7 @@ class TestResourceDetail(cloudstackTestCase): @classmethod def setUpClass(cls): + testClient = super(TestResourceDetail, cls).getClsTestClient() cls.apiclient = testClient.getApiClient() cls.services = testClient.getParsedTestDataConfig() @@ -89,7 +90,7 @@ class TestResourceDetail(cloudstackTestCase): cleanup_resources(self.apiclient, self.cleanup) return - @attr(tags = ["advanced", "xenserver"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "xenserver"], required_hardware="false") def test_01_updatevolumedetail(self): """Test volume detail """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_routers.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_routers.py b/test/integration/smoke/test_routers.py index 7d5f267..784392e 100644 --- a/test/integration/smoke/test_routers.py +++ b/test/integration/smoke/test_routers.py @@ -25,7 +25,7 @@ from marvin.sshClient import SshClient from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest #Import System modules import time @@ -98,7 +98,7 @@ class TestRouterServices(cloudstackTestCase): self.hypervisor = self.testClient.getHypervisorInfo() return - @attr(tags = ["advanced", "basic", "sg", "smoke"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "basic", "sg", "smoke"], required_hardware="true") def test_01_router_internal_basic(self): """Test router internal basic zone """ @@ -184,7 +184,7 @@ class TestRouterServices(cloudstackTestCase): - @attr(tags = ["advanced", "advancedns"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns"], required_hardware="false") def test_02_router_internal_adv(self): """Test router internal advanced zone """ @@ -290,7 +290,7 @@ class TestRouterServices(cloudstackTestCase): self.debug("Haproxy process status: %s" % res) return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") def test_03_restart_network_cleanup(self): """Test restart network """ @@ -368,7 +368,7 @@ class TestRouterServices(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="true") def test_04_restart_network_wo_cleanup(self): """Test restart network without cleanup """ @@ -483,7 +483,7 @@ class TestRouterServices(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") def test_05_router_basic(self): """Test router basic setup """ @@ -549,7 +549,7 @@ class TestRouterServices(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") def test_06_router_advanced(self): """Test router advanced setup """ @@ -632,7 +632,7 @@ class TestRouterServices(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") def test_07_stop_router(self): """Test stop router """ @@ -675,7 +675,7 @@ class TestRouterServices(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") def test_08_start_router(self): """Test start router """ @@ -727,7 +727,7 @@ class TestRouterServices(cloudstackTestCase): return True return False - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") def test_09_reboot_router(self): """Test reboot router """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_scale_vm.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_scale_vm.py b/test/integration/smoke/test_scale_vm.py index 0b770c4..9948aa8 100644 --- a/test/integration/smoke/test_scale_vm.py +++ b/test/integration/smoke/test_scale_vm.py @@ -24,7 +24,7 @@ from marvin.cloudstackAPI import * from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest _multiprocess_shared_ = True @@ -102,8 +102,7 @@ class TestScaleVm(cloudstackTestCase): cleanup_resources(self.apiclient, self.cleanup) return - @attr(hypervisor="xenserver") - @attr(tags=["advanced", "basic"], required_hardware="true") + @pytest.mark.tags(tags=["advanced", "basic"], required_hardware="true", hypervisors=["xenserver"]) def test_01_scale_vm(self): """Test scale virtual machine """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_secondary_storage.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_secondary_storage.py b/test/integration/smoke/test_secondary_storage.py index 1a24239..fdec177 100644 --- a/test/integration/smoke/test_secondary_storage.py +++ b/test/integration/smoke/test_secondary_storage.py @@ -23,7 +23,7 @@ from marvin.cloudstackAPI import * from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest #Import System modules import time @@ -81,7 +81,7 @@ class TestSecStorageServices(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "eip", "sg"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "eip", "sg"], required_hardware="false") def test_01_sys_vm_start(self): """Test system VM start """ @@ -160,7 +160,7 @@ class TestSecStorageServices(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "eip", "sg"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "eip", "sg"], required_hardware="false") def test_02_sys_template_ready(self): """Test system templates are ready """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_service_offerings.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_service_offerings.py b/test/integration/smoke/test_service_offerings.py index e390f75..4e8c057 100644 --- a/test/integration/smoke/test_service_offerings.py +++ b/test/integration/smoke/test_service_offerings.py @@ -31,7 +31,7 @@ from marvin.lib.common import (list_service_offering, get_domain, get_zone, get_template) -from nose.plugins.attrib import attr +import pytest _multiprocess_shared_ = True @@ -54,7 +54,7 @@ class TestCreateServiceOffering(cloudstackTestCase): return - @attr(tags=["advanced", "advancedns", "smoke", "basic", "eip", "sg"], required_hardware="false") + @pytest.mark.tags(tags=["advanced", "advancedns", "smoke", "basic", "eip", "sg"], required_hardware="false") def test_01_create_service_offering(self): """Test to create service offering""" @@ -205,7 +205,7 @@ class TestServiceOfferings(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return - @attr(tags=["advanced", "advancedns", "smoke", "basic", "eip", "sg"], required_hardware="false") + @pytest.mark.tags(tags=["advanced", "advancedns", "smoke", "basic", "eip", "sg"], required_hardware="false") def test_02_edit_service_offering(self): """Test to update existing service offering""" @@ -256,7 +256,7 @@ class TestServiceOfferings(cloudstackTestCase): return - @attr(tags=["advanced", "advancedns", "smoke", "basic", "eip", "sg"], required_hardware="false") + @pytest.mark.tags(tags=["advanced", "advancedns", "smoke", "basic", "eip", "sg"], required_hardware="false") def test_03_delete_service_offering(self): """Test to delete service offering""" @@ -282,7 +282,7 @@ class TestServiceOfferings(cloudstackTestCase): return - @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true") + @pytest.mark.tags(tags=["advanced", "advancedns", "smoke"], required_hardware="true") def test_04_change_offering_small(self): """Test to change service to a small capacity """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_snapshots.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py index 5db3e40..17f78ee 100644 --- a/test/integration/smoke/test_snapshots.py +++ b/test/integration/smoke/test_snapshots.py @@ -16,7 +16,7 @@ # under the License. from marvin.codes import FAILED -from nose.plugins.attrib import attr +import pytest from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * from marvin.lib.utils import * @@ -102,7 +102,7 @@ class TestSnapshotRootDisk(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="true") def test_01_snapshot_root_disk(self): """Test Snapshot Root Disk """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_ssvm.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_ssvm.py b/test/integration/smoke/test_ssvm.py index 5713569..35aba50 100644 --- a/test/integration/smoke/test_ssvm.py +++ b/test/integration/smoke/test_ssvm.py @@ -24,7 +24,7 @@ from marvin.sshClient import SshClient from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest import telnetlib #Import System modules @@ -69,7 +69,7 @@ class TestSSVMs(cloudstackTestCase): timeout = timeout - 1 - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") def test_01_list_sec_storage_vm(self): """Test List secondary storage VMs """ @@ -187,7 +187,7 @@ class TestSSVMs(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") def test_02_list_cpvm_vm(self): """Test List console proxy VMs """ @@ -299,7 +299,7 @@ class TestSSVMs(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") def test_03_ssvm_internals(self): """Test SSVM Internals""" @@ -412,7 +412,7 @@ class TestSSVMs(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") def test_04_cpvm_internals(self): """Test CPVM Internals""" @@ -495,7 +495,7 @@ class TestSSVMs(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") def test_05_stop_ssvm(self): """Test stop SSVM """ @@ -571,7 +571,7 @@ class TestSSVMs(cloudstackTestCase): self.test_03_ssvm_internals() return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") def test_06_stop_cpvm(self): """Test stop CPVM """ @@ -645,7 +645,7 @@ class TestSSVMs(cloudstackTestCase): self.test_04_cpvm_internals() return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") def test_07_reboot_ssvm(self): """Test reboot SSVM """ @@ -732,7 +732,7 @@ class TestSSVMs(cloudstackTestCase): self.test_03_ssvm_internals() return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") def test_08_reboot_cpvm(self): """Test reboot CPVM """ @@ -819,7 +819,7 @@ class TestSSVMs(cloudstackTestCase): self.test_04_cpvm_internals() return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") def test_09_destroy_ssvm(self): """Test destroy SSVM """ @@ -901,7 +901,7 @@ class TestSSVMs(cloudstackTestCase): self.test_03_ssvm_internals() return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") def test_10_destroy_cpvm(self): """Test destroy CPVM """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_templates.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py index b7fe49d..427e6e3 100644 --- a/test/integration/smoke/test_templates.py +++ b/test/integration/smoke/test_templates.py @@ -35,7 +35,7 @@ from marvin.lib.base import (Account, from marvin.lib.common import (get_domain, get_zone, get_template) -from nose.plugins.attrib import attr +import pytest import urllib #Import System modules import time @@ -144,7 +144,7 @@ class TestCreateTemplate(cloudstackTestCase): return - @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke"], required_hardware="false") def test_01_create_template(self): """Test create public & private template """ @@ -338,7 +338,7 @@ class TestTemplates(cloudstackTestCase): return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") def test_02_edit_template(self): """Test Edit template """ @@ -421,7 +421,7 @@ class TestTemplates(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") def test_03_delete_template(self): """Test delete template """ @@ -450,7 +450,7 @@ class TestTemplates(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") def test_04_extract_template(self): "Test for extract template" @@ -501,7 +501,7 @@ class TestTemplates(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") def test_05_template_permissions(self): """Update & Test for template permissions""" @@ -554,7 +554,7 @@ class TestTemplates(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "multizone"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "multizone"], required_hardware="true") def test_06_copy_template(self): """Test for copy template from one zone to another""" @@ -645,7 +645,7 @@ class TestTemplates(cloudstackTestCase): self.apiclient.deleteTemplate(cmd) return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") def test_07_list_public_templates(self): """Test only public templates are visible to normal user""" @@ -677,7 +677,7 @@ class TestTemplates(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") def test_08_list_system_templates(self): """Test System templates are not visible to normal user""" http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_vm_life_cycle.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py index 0be518d..650dcf6 100644 --- a/test/integration/smoke/test_vm_life_cycle.py +++ b/test/integration/smoke/test_vm_life_cycle.py @@ -36,9 +36,9 @@ 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 +import pytest _multiprocess_shared_ = True class TestDeployVM(cloudstackTestCase): @@ -116,7 +116,7 @@ class TestDeployVM(cloudstackTestCase): self.cleanup = [] - @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") + @pytest.mark.tags(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") def test_deploy_vm(self): """Test Deploy Virtual Machine """ @@ -162,7 +162,7 @@ class TestDeployVM(cloudstackTestCase): return - @attr(tags = ["advanced"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced"], required_hardware="false") def test_advZoneVirtualRouter(self): #TODO: SIMENH: duplicate test, remove it """ @@ -185,7 +185,7 @@ class TestDeployVM(cloudstackTestCase): self.assertIsNotNone(router.guestipaddress, msg="Router has no guest ip") - @attr(mode = ["basic"], required_hardware="false") + @pytest.mark.tags(tags = ["basic"], required_hardware="false") def test_basicZoneVirtualRouter(self): #TODO: SIMENH: duplicate test, remove it """ @@ -201,7 +201,7 @@ class TestDeployVM(cloudstackTestCase): self.assertEqual(router.state, 'Running', msg="Router is not in running state") self.assertEqual(router.account, self.account.name, msg="Router does not belong to the account") - @attr(tags = ['advanced','basic','sg'], required_hardware="false") + @pytest.mark.tags(tags = ['advanced','basic','sg'], required_hardware="false") def test_deploy_vm_multiple(self): """Test Multiple Deploy Virtual Machine @@ -359,9 +359,17 @@ class TestVMLifeCycle(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return - - @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false", BugId="CLOUDSTACK-6984") - def test_01_stop_vm(self): + @pytest.mark.tags(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false", BugId="CLOUDSTACK-6984") + def test_vm_life_cycle(self): + self.stop_vm() + self.start_vm() + self.reboot_vm() + self.destroy_vm() + self.restore_vm() + self.migrate_vm() + self.attachAndDetach_iso() + + def stop_vm(self): """Test Stop Virtual Machine """ @@ -375,8 +383,7 @@ class TestVMLifeCycle(cloudstackTestCase): self.fail("Failed to stop VM: %s" % e) return - @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") - def test_02_start_vm(self): + def start_vm(self): """Test Start Virtual Machine """ # Validate the following @@ -413,8 +420,7 @@ class TestVMLifeCycle(cloudstackTestCase): ) return - @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") - def test_03_reboot_vm(self): + def reboot_vm(self): """Test Reboot Virtual Machine """ @@ -450,8 +456,7 @@ class TestVMLifeCycle(cloudstackTestCase): return - @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") - def test_06_destroy_vm(self): + def destroy_vm(self): """Test destroy Virtual Machine """ @@ -486,8 +491,7 @@ class TestVMLifeCycle(cloudstackTestCase): ) return - @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") - def test_07_restore_vm(self): + def restore_vm(self): #TODO: SIMENH: add another test the data on the restored VM. """Test recover Virtual Machine """ @@ -527,8 +531,7 @@ class TestVMLifeCycle(cloudstackTestCase): return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "multihost"], required_hardware="false") - def test_08_migrate_vm(self): + def migrate_vm(self): """Test migrate VM """ # Validate the following @@ -602,9 +605,10 @@ class TestVMLifeCycle(cloudstackTestCase): retries_cnt = retries_cnt - 1 return - @attr(configuration = "expunge.interval") - @attr(configuration = "expunge.delay") - @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") + ''' + @pytest.mark.tags(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false") + ''' + @pytest.mark.skipif(True, reason="expunge takes long time") def test_09_expunge_vm(self): """Test destroy(expunge) Virtual Machine """ @@ -649,8 +653,7 @@ class TestVMLifeCycle(cloudstackTestCase): self.assertEqual(list_vm_response,None,"Check Expunged virtual machine is in listVirtualMachines response") return - @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") - def test_10_attachAndDetach_iso(self): + def attachAndDetach_iso(self): """Test for attach and detach ISO to virtual machine""" # Validate the following http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_vm_snapshots.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_vm_snapshots.py b/test/integration/smoke/test_vm_snapshots.py index dae945c..8246188 100644 --- a/test/integration/smoke/test_vm_snapshots.py +++ b/test/integration/smoke/test_vm_snapshots.py @@ -17,7 +17,7 @@ # Import Local Modules from marvin.codes import FAILED, KVM -from nose.plugins.attrib import attr +import pytest from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackAPI import startVirtualMachine from marvin.lib.utils import random_gen, cleanup_resources @@ -112,7 +112,7 @@ class TestVmSnapshot(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return - @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true") + @pytest.mark.tags(tags=["advanced", "advancedns", "smoke"], required_hardware="true") def test_01_create_vm_snapshots(self): """Test to create VM snapshots """ @@ -156,7 +156,7 @@ class TestVmSnapshot(cloudstackTestCase): ) return - @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true") + @pytest.mark.tags(tags=["advanced", "advancedns", "smoke"], required_hardware="true") def test_02_revert_vm_snapshots(self): """Test to revert VM snapshots """ @@ -243,7 +243,7 @@ class TestVmSnapshot(cloudstackTestCase): "Check the random data is equal with the ramdom file!" ) - @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true") + @pytest.mark.tags(tags=["advanced", "advancedns", "smoke"], required_hardware="true") def test_03_delete_vm_snapshots(self): """Test to delete vm snapshots """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_volumes.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py index 1e429ec..de0905c 100644 --- a/test/integration/smoke/test_volumes.py +++ b/test/integration/smoke/test_volumes.py @@ -37,7 +37,7 @@ from marvin.lib.common import (get_domain, get_template) from marvin.lib.utils import checkVolumeSize from marvin.codes import SUCCESS, FAILED, XEN_SERVER -from nose.plugins.attrib import attr +import pytest #Import System modules import os import urllib @@ -114,7 +114,7 @@ class TestCreateVolume(cloudstackTestCase): self.dbclient = self.testClient.getDbConnection() self.cleanup = [] - @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true") def test_01_create_volume(self): """Test Volume creation for all Disk Offerings (incl. custom) """ @@ -344,7 +344,7 @@ class TestVolumes(cloudstackTestCase): cleanup_resources(self.apiClient, self.cleanup) return - @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true") def test_02_attach_volume(self): """Attach a created Volume to a Running VM """ @@ -390,7 +390,7 @@ class TestVolumes(cloudstackTestCase): (self.virtual_machine.ipaddress, e)) return - @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false") def test_03_download_attached_volume(self): """Download a Volume attached to a VM """ @@ -412,7 +412,7 @@ class TestVolumes(cloudstackTestCase): with self.assertRaises(Exception): self.apiClient.extractVolume(cmd) - @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false") def test_04_delete_attached_volume(self): """Delete a Volume attached to a VM """ @@ -433,7 +433,7 @@ class TestVolumes(cloudstackTestCase): with self.assertRaises(Exception): self.apiClient.deleteVolume(cmd) - @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false") def test_05_detach_volume(self): """Detach a Volume attached to a VM """ @@ -475,7 +475,7 @@ class TestVolumes(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true") def test_06_download_detached_volume(self): """Download a Volume unattached to an VM """ @@ -512,7 +512,7 @@ class TestVolumes(cloudstackTestCase): % (extract_vol.url, self.volume.id) ) - @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true") def test_07_resize_fail(self): """Test resize (negative) non-existent volume""" # Verify the size is the new size is what we wanted it to be. @@ -600,7 +600,7 @@ class TestVolumes(cloudstackTestCase): return - @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true") def test_08_resize_volume(self): """Test resize a volume""" # Verify the size is the new size is what we wanted it to be. @@ -718,7 +718,7 @@ class TestVolumes(cloudstackTestCase): time.sleep(30) return - @attr(tags = ["advanced", "advancedns", "smoke","basic"], required_hardware="false") + @pytest.mark.tags(tags = ["advanced", "advancedns", "smoke","basic"], required_hardware="false") def test_09_delete_detached_volume(self): """Delete a Volume unattached to an VM """ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/test/integration/smoke/test_vpc_vpn.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_vpc_vpn.py b/test/integration/smoke/test_vpc_vpn.py index 9e8f97f..7d13a2d 100644 --- a/test/integration/smoke/test_vpc_vpn.py +++ b/test/integration/smoke/test_vpc_vpn.py @@ -23,7 +23,7 @@ from marvin.cloudstackAPI import * from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * -from nose.plugins.attrib import attr +import pytest import time @@ -53,7 +53,7 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase): cls.cleanup = [cls.account] - @attr(tags=["advanced"], required_hardware="false") + @pytest.mark.tags(tags=["advanced"], required_hardware="false") def test_vpc_remote_access_vpn(self): """Test VPN in VPC""" @@ -160,7 +160,7 @@ class TestVpcSite2SiteVpn(cloudstackTestCase): cls.cleanup = [cls.account] - @attr(tags=["advanced"], required_hardware="false") + @pytest.mark.tags(tags=["advanced"], required_hardware="false") def test_vpc_site2site_vpn(self): """Test VPN in VPC""" http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/tools/marvin/marvin/config/test_data.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py index 4133aba..2f38029 100644 --- a/tools/marvin/marvin/config/test_data.py +++ b/tools/marvin/marvin/config/test_data.py @@ -788,7 +788,7 @@ test_data = { "dpd": "false" }, "ostype": "CentOS 5.6 (64-bit)", - "sleep": 90, + "sleep": 5, "timeout": 10, "page": 1, "pagesize": 2, http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9610685f/tools/marvin/marvin/pytest/pytest_marvin_plugin.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/pytest/pytest_marvin_plugin.py b/tools/marvin/marvin/pytest/pytest_marvin_plugin.py index 90c7ed1..b5a5ae4 100644 --- a/tools/marvin/marvin/pytest/pytest_marvin_plugin.py +++ b/tools/marvin/marvin/pytest/pytest_marvin_plugin.py @@ -15,24 +15,56 @@ # specific language governing permissions and limitations # under the License. import pytest +import os +import distutils from marvin.utils import initTestClass,getMarvin from .VM import (vm,tiny_service_offering,template,test_client,account,domain,zone) def pytest_configure(config): config.addinivalue_line("markers", - "attr(name): tag tests") + "tags(name): tag tests") result = getMarvin() if result is None: pytest.fail("failed to init marvin plugin") + marvin_init_tags() +g_marvin_filter = { + "tags":[], +} +def tobool(str): + if str in ["True", "true"]: + return True + else: + return False +def marvin_init_tags(): + tags = os.environ.get("MARVIN_TAGS", "advanced,required_hardware=false").split(",") + global g_marvin_filter + for t in tags: + if t.startswith("required_hardware"): + g_marvin_filter["required_hardware"] = t.split("=")[1] + else: + g_marvin_filter["tags"].append(t) def pytest_runtest_setup(item): - attrmarker = item.get_marker("attr") - if attrmarker.kwargs["required_hardware"]: - pytest.skip("doesnt have hardware") + global g_marvin_filter + attrmarker = item.get_marker("tags") + if attrmarker is None: + return + + if "required_hardware" in attrmarker.kwargs: + if attrmarker.kwargs["required_hardware"] != g_marvin_filter["required_hardware"]: + pytest.skip("doesnt match hardware") + elif "tags" in attrmarker.kwargs: + found = False + for t in attrmarker.kwargs["tags"]: + if t in g_marvin_filter["tags"]: + found = True + + if found is not True: + pytest.skip("doesn't match tags") @pytest.fixture(scope="class", autouse=True) def marvin_inject_testclass(request):