From cd36841ca25b39b9c8ad1b83e0abd0a191d538a0 Mon Sep 17 00:00:00 2001 From: Andrea Frittoli Date: Mon, 14 Aug 2017 21:37:56 +0100 Subject: [PATCH] Move test decorators to common services and extension decorators are based on CONF and needed by Tempest only, so moving them to tempest.common. Since a few plugnis use them today, use debtcollector to avoid breaking all dependencies. Change-Id: Ibd52153d00b8e60fb8c89e38d94e358ddc787251 --- HACKING.rst | 8 +- .../admin/test_auto_allocate_network.py | 5 +- tempest/api/compute/admin/test_fixed_ips.py | 8 +- .../compute/admin/test_fixed_ips_negative.py | 12 +-- tempest/api/compute/admin/test_flavors.py | 4 +- .../api/compute/admin/test_flavors_access.py | 4 +- .../admin/test_flavors_access_negative.py | 4 +- .../compute/admin/test_flavors_extra_specs.py | 4 +- .../test_flavors_extra_specs_negative.py | 4 +- .../compute/admin/test_floating_ips_bulk.py | 4 +- .../api/compute/admin/test_live_migration.py | 4 +- .../api/compute/admin/test_quotas_negative.py | 6 +- .../api/compute/admin/test_security_groups.py | 4 +- tempest/api/compute/admin/test_volume_swap.py | 4 +- .../compute/flavors/test_flavors_negative.py | 4 +- .../floating_ips/test_floating_ips_actions.py | 10 +- .../test_floating_ips_actions_negative.py | 14 +-- .../floating_ips/test_list_floating_ips.py | 8 +- .../test_list_floating_ips_negative.py | 4 +- tempest/api/compute/security_groups/base.py | 4 +- .../test_security_group_rules.py | 12 +-- .../test_security_group_rules_negative.py | 18 ++-- .../security_groups/test_security_groups.py | 12 +-- .../test_security_groups_negative.py | 24 ++--- .../compute/servers/test_attach_interfaces.py | 6 +- .../api/compute/servers/test_create_server.py | 4 +- .../api/compute/servers/test_delete_server.py | 4 +- .../compute/servers/test_device_tagging.py | 4 +- .../compute/servers/test_server_actions.py | 8 +- .../compute/servers/test_server_addresses.py | 6 +- .../servers/test_server_addresses_negative.py | 6 +- .../api/compute/servers/test_server_group.py | 4 +- .../servers/test_server_rescue_negative.py | 6 +- .../api/compute/servers/test_server_tags.py | 4 +- .../compute/servers/test_servers_negative.py | 6 +- .../servers/test_virtual_interfaces.py | 4 +- .../test_virtual_interfaces_negative.py | 4 +- tempest/api/compute/test_extensions.py | 4 +- tempest/api/compute/test_quotas.py | 4 +- tempest/api/compute/test_tenant_networks.py | 4 +- .../api/identity/admin/v3/test_inherits.py | 4 +- .../api/identity/v2/test_ec2_credentials.py | 4 +- .../network/admin/test_agent_management.py | 4 +- .../admin/test_dhcp_agent_scheduler.py | 4 +- .../admin/test_floating_ips_admin_actions.py | 4 +- .../network/admin/test_l3_agent_scheduler.py | 4 +- .../network/admin/test_metering_extensions.py | 4 +- .../api/network/admin/test_negative_quotas.py | 4 +- tempest/api/network/admin/test_quotas.py | 4 +- tempest/api/network/admin/test_routers.py | 14 +-- tempest/api/network/admin/test_routers_dvr.py | 6 +- .../network/admin/test_routers_negative.py | 6 +- .../api/network/test_allowed_address_pair.py | 4 +- tempest/api/network/test_extensions.py | 6 +- .../api/network/test_extra_dhcp_options.py | 4 +- tempest/api/network/test_floating_ips.py | 4 +- .../api/network/test_floating_ips_negative.py | 4 +- tempest/api/network/test_networks.py | 12 +-- tempest/api/network/test_ports.py | 8 +- tempest/api/network/test_routers.py | 8 +- tempest/api/network/test_routers_negative.py | 6 +- tempest/api/network/test_security_groups.py | 4 +- .../network/test_security_groups_negative.py | 4 +- tempest/api/network/test_service_providers.py | 4 +- .../network/test_subnetpools_extensions.py | 4 +- tempest/api/network/test_tags.py | 6 +- .../api/object_storage/test_account_bulk.py | 8 +- .../api/object_storage/test_account_quotas.py | 6 +- .../test_account_quotas_negative.py | 4 +- .../object_storage/test_container_quotas.py | 8 +- .../test_container_staticweb.py | 10 +- .../test_container_sync_middleware.py | 4 +- .../api/object_storage/test_crossdomain.py | 4 +- .../object_storage/test_object_formpost.py | 4 +- .../test_object_formpost_negative.py | 6 +- tempest/api/object_storage/test_object_slo.py | 10 +- .../object_storage/test_object_temp_url.py | 12 +-- .../test_object_temp_url_negative.py | 4 +- .../api/volume/admin/test_volumes_actions.py | 4 +- tempest/api/volume/test_image_metadata.py | 4 +- tempest/api/volume/test_volumes_actions.py | 8 +- tempest/api/volume/test_volumes_backup.py | 6 +- tempest/api/volume/test_volumes_clone.py | 4 +- tempest/api/volume/test_volumes_get.py | 4 +- tempest/api/volume/test_volumes_negative.py | 8 +- tempest/api/volume/test_volumes_snapshots.py | 6 +- tempest/cmd/cleanup_service.py | 4 +- tempest/common/utils/__init__.py | 92 ++++++++++++++++++ tempest/exceptions.py | 4 + tempest/lib/common/dynamic_creds.py | 2 +- tempest/scenario/test_aggregates_basic_ops.py | 4 +- .../scenario/test_encrypted_cinder_volumes.py | 6 +- tempest/scenario/test_minimum_basic.py | 4 +- .../test_network_advanced_server_ops.py | 20 ++-- tempest/scenario/test_network_basic_ops.py | 30 +++--- tempest/scenario/test_network_v6.py | 18 ++-- .../scenario/test_object_storage_basic_ops.py | 6 +- .../test_security_groups_basic_ops.py | 20 ++-- tempest/scenario/test_server_advanced_ops.py | 6 +- tempest/scenario/test_server_basic_ops.py | 4 +- tempest/scenario/test_server_multinode.py | 4 +- tempest/scenario/test_shelve_instance.py | 6 +- tempest/scenario/test_snapshot_pattern.py | 4 +- tempest/scenario/test_stamp_pattern.py | 4 +- tempest/scenario/test_volume_boot_pattern.py | 10 +- .../scenario/test_volume_migrate_attached.py | 4 +- tempest/test.py | 96 ++----------------- tempest/tests/test_decorators.py | 12 ++- tempest/tests/test_hacking.py | 13 +-- 109 files changed, 462 insertions(+), 438 deletions(-) diff --git a/HACKING.rst b/HACKING.rst index 446d865665..cb9821e9c1 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -358,10 +358,10 @@ to Tempest. When adding tests for new features that were not in previous releases of the projects the new test has to be properly skipped with a feature flag. Whether -this is just as simple as using the @test.requires_ext() decorator to check -if the required extension (or discoverable optional API) is enabled or adding -a new config option to the appropriate section. If there isn't a method of -selecting the new **feature** from the config file then there won't be a +this is just as simple as using the @utils.requires_ext() decorator to +check if the required extension (or discoverable optional API) is enabled or +adding a new config option to the appropriate section. If there isn't a method +of selecting the new **feature** from the config file then there won't be a mechanism to disable the test with older stable releases and the new test won't be able to merge. diff --git a/tempest/api/compute/admin/test_auto_allocate_network.py b/tempest/api/compute/admin/test_auto_allocate_network.py index 83fe215316..ea92563289 100644 --- a/tempest/api/compute/admin/test_auto_allocate_network.py +++ b/tempest/api/compute/admin/test_auto_allocate_network.py @@ -17,11 +17,11 @@ from oslo_log import log from tempest.api.compute import base from tempest.common import compute from tempest.common import credentials_factory as credentials +from tempest.common import utils from tempest import config from tempest.lib.common.utils import test_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_excs -from tempest import test CONF = config.CONF LOG = log.getLogger(__name__) @@ -53,7 +53,8 @@ class AutoAllocateNetworkTest(base.BaseV2ComputeTest): raise cls.skipException(msg) if not CONF.service_available.neutron: raise cls.skipException('Neutron is required') - if not test.is_extension_enabled('auto-allocated-topology', 'network'): + if not utils.is_extension_enabled('auto-allocated-topology', + 'network'): raise cls.skipException( 'auto-allocated-topology extension is not available') diff --git a/tempest/api/compute/admin/test_fixed_ips.py b/tempest/api/compute/admin/test_fixed_ips.py index 1e09eeb446..69c8a82316 100644 --- a/tempest/api/compute/admin/test_fixed_ips.py +++ b/tempest/api/compute/admin/test_fixed_ips.py @@ -14,9 +14,9 @@ # under the License. from tempest.api.compute import base +from tempest.common import utils from tempest import config from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -49,17 +49,17 @@ class FixedIPsTestJson(base.BaseV2ComputeAdminTest): break @decorators.idempotent_id('16b7d848-2f7c-4709-85a3-2dfb4576cc52') - @test.services('network') + @utils.services('network') def test_list_fixed_ip_details(self): fixed_ip = self.client.show_fixed_ip(self.ip) self.assertEqual(fixed_ip['fixed_ip']['address'], self.ip) @decorators.idempotent_id('5485077b-7e46-4cec-b402-91dc3173433b') - @test.services('network') + @utils.services('network') def test_set_reserve(self): self.client.reserve_fixed_ip(self.ip, reserve="None") @decorators.idempotent_id('7476e322-b9ff-4710-bf82-49d51bac6e2e') - @test.services('network') + @utils.services('network') def test_set_unreserve(self): self.client.reserve_fixed_ip(self.ip, unreserve="None") diff --git a/tempest/api/compute/admin/test_fixed_ips_negative.py b/tempest/api/compute/admin/test_fixed_ips_negative.py index a77011e6a4..c54c86689c 100644 --- a/tempest/api/compute/admin/test_fixed_ips_negative.py +++ b/tempest/api/compute/admin/test_fixed_ips_negative.py @@ -13,10 +13,10 @@ # under the License. from tempest.api.compute import base +from tempest.common import utils from tempest import config from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -51,14 +51,14 @@ class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('9f17f47d-daad-4adc-986e-12370c93e407') - @test.services('network') + @utils.services('network') def test_list_fixed_ip_details_with_non_admin_user(self): self.assertRaises(lib_exc.Forbidden, self.non_admin_client.show_fixed_ip, self.ip) @decorators.attr(type=['negative']) @decorators.idempotent_id('ce60042c-fa60-4836-8d43-1c8e3359dc47') - @test.services('network') + @utils.services('network') def test_set_reserve_with_non_admin_user(self): self.assertRaises(lib_exc.Forbidden, self.non_admin_client.reserve_fixed_ip, @@ -66,7 +66,7 @@ class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('f1f7a35b-0390-48c5-9803-5f27461439db') - @test.services('network') + @utils.services('network') def test_set_unreserve_with_non_admin_user(self): self.assertRaises(lib_exc.Forbidden, self.non_admin_client.reserve_fixed_ip, @@ -74,7 +74,7 @@ class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('f51cf464-7fc5-4352-bc3e-e75cfa2cb717') - @test.services('network') + @utils.services('network') def test_set_reserve_with_invalid_ip(self): # NOTE(maurosr): since this exercises the same code snippet, we do it # only for reserve action @@ -87,7 +87,7 @@ class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('fd26ef50-f135-4232-9d32-281aab3f9176') - @test.services('network') + @utils.services('network') def test_fixed_ip_with_invalid_action(self): self.assertRaises(lib_exc.BadRequest, self.client.reserve_fixed_ip, diff --git a/tempest/api/compute/admin/test_flavors.py b/tempest/api/compute/admin/test_flavors.py index 36ebc252fe..1483c2e342 100644 --- a/tempest/api/compute/admin/test_flavors.py +++ b/tempest/api/compute/admin/test_flavors.py @@ -16,10 +16,10 @@ import uuid from tempest.api.compute import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest): @@ -28,7 +28,7 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest): @classmethod def skip_checks(cls): super(FlavorsAdminTestJSON, cls).skip_checks() - if not test.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'): + if not utils.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'): msg = "OS-FLV-EXT-DATA extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/compute/admin/test_flavors_access.py b/tempest/api/compute/admin/test_flavors_access.py index 2c236ec716..b8e2b42a04 100644 --- a/tempest/api/compute/admin/test_flavors_access.py +++ b/tempest/api/compute/admin/test_flavors_access.py @@ -14,8 +14,8 @@ # under the License. from tempest.api.compute import base +from tempest.common import utils from tempest.lib import decorators -from tempest import test class FlavorsAccessTestJSON(base.BaseV2ComputeAdminTest): @@ -27,7 +27,7 @@ class FlavorsAccessTestJSON(base.BaseV2ComputeAdminTest): @classmethod def skip_checks(cls): super(FlavorsAccessTestJSON, cls).skip_checks() - if not test.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'): + if not utils.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'): msg = "OS-FLV-EXT-DATA extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/compute/admin/test_flavors_access_negative.py b/tempest/api/compute/admin/test_flavors_access_negative.py index be165cb2f1..45ca10af74 100644 --- a/tempest/api/compute/admin/test_flavors_access_negative.py +++ b/tempest/api/compute/admin/test_flavors_access_negative.py @@ -14,9 +14,9 @@ # under the License. from tempest.api.compute import base +from tempest.common import utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest): @@ -30,7 +30,7 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest): @classmethod def skip_checks(cls): super(FlavorsAccessNegativeTestJSON, cls).skip_checks() - if not test.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'): + if not utils.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'): msg = "OS-FLV-EXT-DATA extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/compute/admin/test_flavors_extra_specs.py b/tempest/api/compute/admin/test_flavors_extra_specs.py index 747cb42da8..d4e7bd5703 100644 --- a/tempest/api/compute/admin/test_flavors_extra_specs.py +++ b/tempest/api/compute/admin/test_flavors_extra_specs.py @@ -14,9 +14,9 @@ # under the License. from tempest.api.compute import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test class FlavorsExtraSpecsTestJSON(base.BaseV2ComputeAdminTest): @@ -29,7 +29,7 @@ class FlavorsExtraSpecsTestJSON(base.BaseV2ComputeAdminTest): @classmethod def skip_checks(cls): super(FlavorsExtraSpecsTestJSON, cls).skip_checks() - if not test.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'): + if not utils.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'): msg = "OS-FLV-EXT-DATA extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/compute/admin/test_flavors_extra_specs_negative.py b/tempest/api/compute/admin/test_flavors_extra_specs_negative.py index f39feb9e69..bc32346b5b 100644 --- a/tempest/api/compute/admin/test_flavors_extra_specs_negative.py +++ b/tempest/api/compute/admin/test_flavors_extra_specs_negative.py @@ -15,10 +15,10 @@ # under the License. from tempest.api.compute import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class FlavorsExtraSpecsNegativeTestJSON(base.BaseV2ComputeAdminTest): @@ -30,7 +30,7 @@ class FlavorsExtraSpecsNegativeTestJSON(base.BaseV2ComputeAdminTest): @classmethod def skip_checks(cls): super(FlavorsExtraSpecsNegativeTestJSON, cls).skip_checks() - if not test.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'): + if not utils.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'): msg = "OS-FLV-EXT-DATA extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/compute/admin/test_floating_ips_bulk.py b/tempest/api/compute/admin/test_floating_ips_bulk.py index 496f119949..ba19937da5 100644 --- a/tempest/api/compute/admin/test_floating_ips_bulk.py +++ b/tempest/api/compute/admin/test_floating_ips_bulk.py @@ -16,11 +16,11 @@ import netaddr from tempest.api.compute import base +from tempest.common import utils from tempest import config from tempest.lib.common.utils import test_utils from tempest.lib import decorators from tempest.lib import exceptions -from tempest import test CONF = config.CONF @@ -57,7 +57,7 @@ class FloatingIPsBulkAdminTestJSON(base.BaseV2ComputeAdminTest): return @decorators.idempotent_id('2c8f145f-8012-4cb8-ac7e-95a587f0e4ab') - @test.services('network') + @utils.services('network') def test_create_list_delete_floating_ips_bulk(self): # Create, List and delete the Floating IPs Bulk pool = 'test_pool' diff --git a/tempest/api/compute/admin/test_live_migration.py b/tempest/api/compute/admin/test_live_migration.py index 256a2677f8..14be947648 100644 --- a/tempest/api/compute/admin/test_live_migration.py +++ b/tempest/api/compute/admin/test_live_migration.py @@ -20,10 +20,10 @@ import testtools from tempest.api.compute import base from tempest.common import compute +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib import decorators -from tempest import test CONF = config.CONF LOG = logging.getLogger(__name__) @@ -122,7 +122,7 @@ class LiveMigrationTest(base.BaseV2ComputeAdminTest): @decorators.skip_because(bug="1524898") @decorators.idempotent_id('5071cf17-3004-4257-ae61-73a84e28badd') - @test.services('volume') + @utils.services('volume') def test_volume_backed_live_migration(self): self._test_live_migration(volume_backed=True) diff --git a/tempest/api/compute/admin/test_quotas_negative.py b/tempest/api/compute/admin/test_quotas_negative.py index 747f32032a..5ef7ee4de6 100644 --- a/tempest/api/compute/admin/test_quotas_negative.py +++ b/tempest/api/compute/admin/test_quotas_negative.py @@ -13,11 +13,11 @@ # under the License. from tempest.api.compute import base +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -89,7 +89,7 @@ class QuotasAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): condition=CONF.service_available.neutron) @decorators.attr(type=['negative']) @decorators.idempotent_id('7c6c8f3b-2bf6-4918-b240-57b136a66aa0') - @test.services('network') + @utils.services('network') def test_security_groups_exceed_limit(self): # Negative test: Creation Security Groups over limit should FAIL # Set the quota to number of used security groups @@ -108,7 +108,7 @@ class QuotasAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): condition=CONF.service_available.neutron) @decorators.attr(type=['negative']) @decorators.idempotent_id('6e9f436d-f1ed-4f8e-a493-7275dfaa4b4d') - @test.services('network') + @utils.services('network') def test_security_groups_rules_exceed_limit(self): # Negative test: Creation of Security Group Rules should FAIL # when we reach limit maxSecurityGroupRules diff --git a/tempest/api/compute/admin/test_security_groups.py b/tempest/api/compute/admin/test_security_groups.py index 8abe03aace..ff9caa3b4f 100644 --- a/tempest/api/compute/admin/test_security_groups.py +++ b/tempest/api/compute/admin/test_security_groups.py @@ -14,9 +14,9 @@ # under the License. from tempest.api.compute import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test class SecurityGroupsTestAdminJSON(base.BaseV2ComputeAdminTest): @@ -34,7 +34,7 @@ class SecurityGroupsTestAdminJSON(base.BaseV2ComputeAdminTest): self.client.delete_security_group(securitygroup_id) @decorators.idempotent_id('49667619-5af9-4c63-ab5d-2cfdd1c8f7f1') - @test.services('network') + @utils.services('network') def test_list_security_groups_list_all_tenants_filter(self): # Admin can list security groups of all tenants # List of all security groups created diff --git a/tempest/api/compute/admin/test_volume_swap.py b/tempest/api/compute/admin/test_volume_swap.py index 22a5bc48e1..d715a42254 100644 --- a/tempest/api/compute/admin/test_volume_swap.py +++ b/tempest/api/compute/admin/test_volume_swap.py @@ -13,11 +13,11 @@ import time from tempest.api.compute import base +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -80,7 +80,7 @@ class TestVolumeSwap(base.BaseV2ComputeAdminTest): raise lib_exc.TimeoutException(message) @decorators.idempotent_id('1769f00d-a693-4d67-a631-6a3496773813') - @test.services('volume') + @utils.services('volume') def test_volume_swap(self): # Create two volumes. # NOTE(gmann): Volumes are created before server creation so that diff --git a/tempest/api/compute/flavors/test_flavors_negative.py b/tempest/api/compute/flavors/test_flavors_negative.py index ebb9d2ec53..efd4f0e71c 100644 --- a/tempest/api/compute/flavors/test_flavors_negative.py +++ b/tempest/api/compute/flavors/test_flavors_negative.py @@ -19,11 +19,11 @@ import six from tempest.api.compute import base from tempest.common import image as common_image +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -43,7 +43,7 @@ class FlavorsV2NegativeTest(base.BaseV2ComputeTest): '[image-feature-enabled].') @decorators.attr(type=['negative']) - @test.services('image') + @utils.services('image') @decorators.idempotent_id('90f0d93a-91c1-450c-91e6-07d18172cefe') def test_boot_with_low_ram(self): """Try boot a vm with lower than min ram diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions.py b/tempest/api/compute/floating_ips/test_floating_ips_actions.py index faa7b5d926..4001e26f47 100644 --- a/tempest/api/compute/floating_ips/test_floating_ips_actions.py +++ b/tempest/api/compute/floating_ips/test_floating_ips_actions.py @@ -16,11 +16,11 @@ import testtools from tempest.api.compute.floating_ips import base +from tempest.common import utils from tempest import config from tempest.lib.common.utils import test_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -62,7 +62,7 @@ class FloatingIPsTestJSON(base.BaseFloatingIPsTest): super(FloatingIPsTestJSON, cls).resource_cleanup() @decorators.idempotent_id('f7bfb946-297e-41b8-9e8c-aba8e9bb5194') - @test.services('network') + @utils.services('network') def test_allocate_floating_ip(self): # Positive test:Allocation of a new floating IP to a project # should be successful @@ -78,7 +78,7 @@ class FloatingIPsTestJSON(base.BaseFloatingIPsTest): self.assertIn(floating_ip_details, body) @decorators.idempotent_id('de45e989-b5ca-4a9b-916b-04a52e7bbb8b') - @test.services('network') + @utils.services('network') def test_delete_floating_ip(self): # Positive test:Deletion of valid floating IP from project # should be successful @@ -93,7 +93,7 @@ class FloatingIPsTestJSON(base.BaseFloatingIPsTest): self.client.wait_for_resource_deletion(floating_ip_body['id']) @decorators.idempotent_id('307efa27-dc6f-48a0-8cd2-162ce3ef0b52') - @test.services('network') + @utils.services('network') @testtools.skipUnless(CONF.network.public_network_id, 'The public_network_id option must be specified.') def test_associate_disassociate_floating_ip(self): @@ -116,7 +116,7 @@ class FloatingIPsTestJSON(base.BaseFloatingIPsTest): self.server_id) @decorators.idempotent_id('6edef4b2-aaf1-4abc-bbe3-993e2561e0fe') - @test.services('network') + @utils.services('network') @testtools.skipUnless(CONF.network.public_network_id, 'The public_network_id option must be specified.') def test_associate_already_associated_floating_ip(self): diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py index 483bd953af..3455a81ac3 100644 --- a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py +++ b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py @@ -16,11 +16,11 @@ import testtools from tempest.api.compute.floating_ips import base +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -58,7 +58,7 @@ class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('6e0f059b-e4dd-48fb-8207-06e3bba5b074') - @test.services('network') + @utils.services('network') def test_allocate_floating_ip_from_nonexistent_pool(self): # Negative test:Allocation of a new floating IP from a nonexistent_pool # to a project should fail @@ -68,7 +68,7 @@ class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('ae1c55a8-552b-44d4-bfb6-2a115a15d0ba') - @test.services('network') + @utils.services('network') def test_delete_nonexistent_floating_ip(self): # Negative test:Deletion of a nonexistent floating IP # from project should fail @@ -79,7 +79,7 @@ class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('595fa616-1a71-4670-9614-46564ac49a4c') - @test.services('network') + @utils.services('network') def test_associate_nonexistent_floating_ip(self): # Negative test:Association of a non existent floating IP # to specific server should fail @@ -90,7 +90,7 @@ class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('0a081a66-e568-4e6b-aa62-9587a876dca8') - @test.services('network') + @utils.services('network') def test_dissociate_nonexistent_floating_ip(self): # Negative test:Dissociation of a non existent floating IP should fail # Dissociating non existent floating IP @@ -100,7 +100,7 @@ class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('804b4fcb-bbf5-412f-925d-896672b61eb3') - @test.services('network') + @utils.services('network') def test_associate_ip_to_server_without_passing_floating_ip(self): # Negative test:Association of empty floating IP to specific server # should raise NotFound or BadRequest(In case of Nova V2.1) exception. @@ -110,7 +110,7 @@ class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('58a80596-ffb2-11e6-9393-fa163e4fa634') - @test.services('network') + @utils.services('network') @testtools.skipUnless(CONF.network.public_network_id, 'The public_network_id option must be specified.') def test_associate_ip_to_server_with_floating_ip(self): diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips.py b/tempest/api/compute/floating_ips/test_list_floating_ips.py index 913b992da5..04d18c01a3 100644 --- a/tempest/api/compute/floating_ips/test_list_floating_ips.py +++ b/tempest/api/compute/floating_ips/test_list_floating_ips.py @@ -14,9 +14,9 @@ # under the License. from tempest.api.compute import base +from tempest.common import utils from tempest import config from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -53,7 +53,7 @@ class FloatingIPDetailsTestJSON(base.BaseV2ComputeTest): super(FloatingIPDetailsTestJSON, cls).resource_cleanup() @decorators.idempotent_id('16db31c3-fb85-40c9-bbe2-8cf7b67ff99f') - @test.services('network') + @utils.services('network') def test_list_floating_ips(self): # Positive test:Should return the list of floating IPs body = self.client.list_floating_ips()['floating_ips'] @@ -64,7 +64,7 @@ class FloatingIPDetailsTestJSON(base.BaseV2ComputeTest): self.assertIn(self.floating_ip[i], floating_ips) @decorators.idempotent_id('eef497e0-8ff7-43c8-85ef-558440574f84') - @test.services('network') + @utils.services('network') def test_get_floating_ip_details(self): # Positive test:Should be able to GET the details of floatingIP # Creating a floating IP for which details are to be checked @@ -86,7 +86,7 @@ class FloatingIPDetailsTestJSON(base.BaseV2ComputeTest): self.assertEqual(floating_ip_id, body['id']) @decorators.idempotent_id('df389fc8-56f5-43cc-b290-20eda39854d3') - @test.services('network') + @utils.services('network') def test_list_floating_ip_pools(self): # Positive test:Should return the list of floating IP Pools floating_ip_pools = self.pools_client.list_floating_ip_pools() diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py b/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py index b5bbb8c69a..f0b9fa5118 100644 --- a/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py +++ b/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py @@ -14,11 +14,11 @@ # under the License. from tempest.api.compute import base +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -38,7 +38,7 @@ class FloatingIPDetailsNegativeTestJSON(base.BaseV2ComputeTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('7ab18834-4a4b-4f28-a2c5-440579866695') - @test.services('network') + @utils.services('network') def test_get_nonexistent_floating_ip_details(self): # Negative test:Should not be able to GET the details # of non-existent floating IP diff --git a/tempest/api/compute/security_groups/base.py b/tempest/api/compute/security_groups/base.py index 6148e160cd..5260a99bb7 100644 --- a/tempest/api/compute/security_groups/base.py +++ b/tempest/api/compute/security_groups/base.py @@ -14,9 +14,9 @@ # under the License. from tempest.api.compute import base +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils -from tempest import test CONF = config.CONF @@ -32,7 +32,7 @@ class BaseSecurityGroupsTest(base.BaseV2ComputeTest): @staticmethod def generate_random_security_group_id(): if (CONF.service_available.neutron and - test.is_extension_enabled('security-group', 'network')): + utils.is_extension_enabled('security-group', 'network')): return data_utils.rand_uuid() else: return data_utils.rand_int_id(start=999) diff --git a/tempest/api/compute/security_groups/test_security_group_rules.py b/tempest/api/compute/security_groups/test_security_group_rules.py index 2b5ae48ea2..06edc1ca72 100644 --- a/tempest/api/compute/security_groups/test_security_group_rules.py +++ b/tempest/api/compute/security_groups/test_security_group_rules.py @@ -14,8 +14,8 @@ # under the License. from tempest.api.compute.security_groups import base +from tempest.common import utils from tempest.lib import decorators -from tempest import test class SecurityGroupRulesTestJSON(base.BaseSecurityGroupsTest): @@ -55,7 +55,7 @@ class SecurityGroupRulesTestJSON(base.BaseSecurityGroupsTest): @decorators.attr(type='smoke') @decorators.idempotent_id('850795d7-d4d3-4e55-b527-a774c0123d3a') - @test.services('network') + @utils.services('network') def test_security_group_rules_create(self): # Positive test: Creation of Security Group rule # should be successful @@ -73,7 +73,7 @@ class SecurityGroupRulesTestJSON(base.BaseSecurityGroupsTest): self._check_expected_response(rule) @decorators.idempotent_id('7a01873e-3c38-4f30-80be-31a043cfe2fd') - @test.services('network') + @utils.services('network') def test_security_group_rules_create_with_optional_cidr(self): # Positive test: Creation of Security Group rule # with optional argument cidr @@ -96,7 +96,7 @@ class SecurityGroupRulesTestJSON(base.BaseSecurityGroupsTest): self._check_expected_response(rule) @decorators.idempotent_id('7f5d2899-7705-4d4b-8458-4505188ffab6') - @test.services('network') + @utils.services('network') def test_security_group_rules_create_with_optional_group_id(self): # Positive test: Creation of Security Group rule # with optional argument group_id @@ -125,7 +125,7 @@ class SecurityGroupRulesTestJSON(base.BaseSecurityGroupsTest): @decorators.attr(type='smoke') @decorators.idempotent_id('a6154130-5a55-4850-8be4-5e9e796dbf17') - @test.services('network') + @utils.services('network') def test_security_group_rules_list(self): # Positive test: Created Security Group rules should be # in the list of all rules @@ -163,7 +163,7 @@ class SecurityGroupRulesTestJSON(base.BaseSecurityGroupsTest): self.assertNotEmpty([i for i in rules if i['id'] == rule2_id]) @decorators.idempotent_id('fc5c5acf-2091-43a6-a6ae-e42760e9ffaf') - @test.services('network') + @utils.services('network') def test_security_group_rules_delete_when_peer_group_deleted(self): # Positive test:rule will delete when peer group deleting # Creating a Security Group to add rules to it diff --git a/tempest/api/compute/security_groups/test_security_group_rules_negative.py b/tempest/api/compute/security_groups/test_security_group_rules_negative.py index 4efb8b75c3..f344d84743 100644 --- a/tempest/api/compute/security_groups/test_security_group_rules_negative.py +++ b/tempest/api/compute/security_groups/test_security_group_rules_negative.py @@ -14,10 +14,10 @@ # under the License. from tempest.api.compute.security_groups import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class SecurityGroupRulesNegativeTestJSON(base.BaseSecurityGroupsTest): @@ -29,7 +29,7 @@ class SecurityGroupRulesNegativeTestJSON(base.BaseSecurityGroupsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('1d507e98-7951-469b-82c3-23f1e6b8c254') - @test.services('network') + @utils.services('network') def test_create_security_group_rule_with_non_existent_id(self): # Negative test: Creation of Security Group rule should FAIL # with non existent Parent group id @@ -46,7 +46,7 @@ class SecurityGroupRulesNegativeTestJSON(base.BaseSecurityGroupsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('2244d7e4-adb7-4ecb-9930-2d77e123ce4f') - @test.services('network') + @utils.services('network') def test_create_security_group_rule_with_invalid_id(self): # Negative test: Creation of Security Group rule should FAIL # with Parent group id which is not integer @@ -63,7 +63,7 @@ class SecurityGroupRulesNegativeTestJSON(base.BaseSecurityGroupsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('8bd56d02-3ffa-4d67-9933-b6b9a01d6089') - @test.services('network') + @utils.services('network') def test_create_security_group_rule_duplicate(self): # Negative test: Create Security Group rule duplicate should fail # Creating a Security Group to add rule to it @@ -88,7 +88,7 @@ class SecurityGroupRulesNegativeTestJSON(base.BaseSecurityGroupsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('84c81249-9f6e-439c-9bbf-cbb0d2cddbdf') - @test.services('network') + @utils.services('network') def test_create_security_group_rule_with_invalid_ip_protocol(self): # Negative test: Creation of Security Group rule should FAIL # with invalid ip_protocol @@ -108,7 +108,7 @@ class SecurityGroupRulesNegativeTestJSON(base.BaseSecurityGroupsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('12bbc875-1045-4f7a-be46-751277baedb9') - @test.services('network') + @utils.services('network') def test_create_security_group_rule_with_invalid_from_port(self): # Negative test: Creation of Security Group rule should FAIL # with invalid from_port @@ -127,7 +127,7 @@ class SecurityGroupRulesNegativeTestJSON(base.BaseSecurityGroupsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('ff88804d-144f-45d1-bf59-dd155838a43a') - @test.services('network') + @utils.services('network') def test_create_security_group_rule_with_invalid_to_port(self): # Negative test: Creation of Security Group rule should FAIL # with invalid to_port @@ -146,7 +146,7 @@ class SecurityGroupRulesNegativeTestJSON(base.BaseSecurityGroupsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('00296fa9-0576-496a-ae15-fbab843189e0') - @test.services('network') + @utils.services('network') def test_create_security_group_rule_with_invalid_port_range(self): # Negative test: Creation of Security Group rule should FAIL # with invalid port range. @@ -165,7 +165,7 @@ class SecurityGroupRulesNegativeTestJSON(base.BaseSecurityGroupsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('56fddcca-dbb8-4494-a0db-96e9f869527c') - @test.services('network') + @utils.services('network') def test_delete_security_group_rule_with_non_existent_id(self): # Negative test: Deletion of Security Group rule should be FAIL # with non existent id diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py index a101a19b73..01b19caab8 100644 --- a/tempest/api/compute/security_groups/test_security_groups.py +++ b/tempest/api/compute/security_groups/test_security_groups.py @@ -14,11 +14,11 @@ # under the License. from tempest.api.compute.security_groups import base +from tempest.common import utils from tempest.common import waiters from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class SecurityGroupsTestJSON(base.BaseSecurityGroupsTest): @@ -30,7 +30,7 @@ class SecurityGroupsTestJSON(base.BaseSecurityGroupsTest): @decorators.attr(type='smoke') @decorators.idempotent_id('eb2b087d-633d-4d0d-a7bd-9e6ba35b32de') - @test.services('network') + @utils.services('network') def test_security_groups_create_list_delete(self): # Positive test:Should return the list of Security Groups # Create 3 Security Groups @@ -62,7 +62,7 @@ class SecurityGroupsTestJSON(base.BaseSecurityGroupsTest): for m_group in deleted_sgs)) @decorators.idempotent_id('ecc0da4a-2117-48af-91af-993cca39a615') - @test.services('network') + @utils.services('network') def test_security_group_create_get_delete(self): # Security Group should be created, fetched and deleted # with char space between name along with @@ -83,7 +83,7 @@ class SecurityGroupsTestJSON(base.BaseSecurityGroupsTest): self.client.wait_for_resource_deletion(securitygroup['id']) @decorators.idempotent_id('fe4abc0d-83f5-4c50-ad11-57a1127297a2') - @test.services('network') + @utils.services('network') def test_server_security_groups(self): # Checks that security groups may be added and linked to a server # and not deleted if the server is active. @@ -125,7 +125,7 @@ class SecurityGroupsTestJSON(base.BaseSecurityGroupsTest): self.client.delete_security_group(sg2['id']) @decorators.idempotent_id('7d4e1d3c-3209-4d6d-b020-986304ebad1f') - @test.services('network') + @utils.services('network') def test_update_security_groups(self): # Update security group name and description # Create a security group @@ -144,7 +144,7 @@ class SecurityGroupsTestJSON(base.BaseSecurityGroupsTest): self.assertEqual(s_new_des, fetched_group['description']) @decorators.idempotent_id('79517d60-535a-438f-af3d-e6feab1cbea7') - @test.services('network') + @utils.services('network') def test_list_security_groups_by_server(self): # Create a couple security groups that we will use # for the server resource this test creates diff --git a/tempest/api/compute/security_groups/test_security_groups_negative.py b/tempest/api/compute/security_groups/test_security_groups_negative.py index c4dff153b8..e727dbbd78 100644 --- a/tempest/api/compute/security_groups/test_security_groups_negative.py +++ b/tempest/api/compute/security_groups/test_security_groups_negative.py @@ -16,11 +16,11 @@ import testtools from tempest.api.compute.security_groups import base +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -34,7 +34,7 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('673eaec1-9b3e-48ed-bdf1-2786c1b9661c') - @test.services('network') + @utils.services('network') def test_security_group_get_nonexistent_group(self): # Negative test:Should not be able to GET the details # of non-existent Security Group @@ -46,7 +46,7 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest): condition=CONF.service_available.neutron) @decorators.attr(type=['negative']) @decorators.idempotent_id('1759c3cb-b0fc-44b7-86ce-c99236be911d') - @test.services('network') + @utils.services('network') def test_security_group_create_with_invalid_group_name(self): # Negative test: Security Group should not be created with group name # as an empty string/with white spaces/chars more than 255 @@ -69,7 +69,7 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest): condition=CONF.service_available.neutron) @decorators.attr(type=['negative']) @decorators.idempotent_id('777b6f14-aca9-4758-9e84-38783cfa58bc') - @test.services('network') + @utils.services('network') def test_security_group_create_with_invalid_group_description(self): # Negative test: Security Group should not be created with description # longer than 255 chars. Empty description is allowed by the API @@ -85,7 +85,7 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest): @testtools.skipIf(CONF.service_available.neutron, "Neutron allows duplicate names for security groups") @decorators.attr(type=['negative']) - @test.services('network') + @utils.services('network') def test_security_group_create_with_duplicate_name(self): # Negative test:Security Group with duplicate name should not # be created @@ -99,7 +99,7 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('36a1629f-c6da-4a26-b8b8-55e7e5d5cd58') - @test.services('network') + @utils.services('network') def test_delete_the_default_security_group(self): # Negative test:Deletion of the "default" Security Group should Fail default_security_group_id = None @@ -115,7 +115,7 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('6727c00b-214c-4f9e-9a52-017ac3e98411') - @test.services('network') + @utils.services('network') def test_delete_nonexistent_security_group(self): # Negative test:Deletion of a non-existent Security Group should fail non_exist_id = self.generate_random_security_group_id() @@ -124,7 +124,7 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('1438f330-8fa4-4aeb-8a94-37c250106d7f') - @test.services('network') + @utils.services('network') def test_delete_security_group_without_passing_id(self): # Negative test:Deletion of a Security Group with out passing ID # should Fail @@ -135,7 +135,7 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest): @testtools.skipIf(CONF.service_available.neutron, "Neutron does not check the security group ID") @decorators.attr(type=['negative']) - @test.services('network') + @utils.services('network') def test_update_security_group_with_invalid_sg_id(self): # Update security_group with invalid sg_id should fail s_name = data_utils.rand_name('sg') @@ -150,7 +150,7 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest): @testtools.skipIf(CONF.service_available.neutron, "Neutron does not check the security group name") @decorators.attr(type=['negative']) - @test.services('network') + @utils.services('network') def test_update_security_group_with_invalid_sg_name(self): # Update security_group with invalid sg_name should fail securitygroup = self.create_security_group() @@ -165,7 +165,7 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest): @testtools.skipIf(CONF.service_available.neutron, "Neutron does not check the security group description") @decorators.attr(type=['negative']) - @test.services('network') + @utils.services('network') def test_update_security_group_with_invalid_sg_des(self): # Update security_group with invalid sg_des should fail securitygroup = self.create_security_group() @@ -178,7 +178,7 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('27edee9c-873d-4da6-a68a-3c256efebe8f') - @test.services('network') + @utils.services('network') def test_update_non_existent_security_group(self): # Update a non-existent Security Group should Fail non_exist_id = self.generate_random_security_group_id() diff --git a/tempest/api/compute/servers/test_attach_interfaces.py b/tempest/api/compute/servers/test_attach_interfaces.py index bfde847663..69b6e51520 100644 --- a/tempest/api/compute/servers/test_attach_interfaces.py +++ b/tempest/api/compute/servers/test_attach_interfaces.py @@ -19,12 +19,12 @@ import six from tempest.api.compute import base from tempest.common import compute +from tempest.common import utils from tempest.common.utils import net_utils from tempest.common import waiters from tempest import config from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -185,7 +185,7 @@ class AttachInterfacesTestJSON(base.BaseV2ComputeTest): self.assertEqual(sorted(list1), sorted(list2)) @decorators.idempotent_id('73fe8f02-590d-4bf1-b184-e9ca81065051') - @test.services('network') + @utils.services('network') def test_create_list_show_delete_interfaces(self): server, ifs = self._create_server_get_interfaces() interface_count = len(ifs) @@ -222,7 +222,7 @@ class AttachInterfacesTestJSON(base.BaseV2ComputeTest): @decorators.attr(type='smoke') @decorators.idempotent_id('c7e0e60b-ee45-43d0-abeb-8596fd42a2f9') - @test.services('network') + @utils.services('network') def test_add_remove_fixed_ip(self): # Add and Remove the fixed IP to server. server, ifs = self._create_server_get_interfaces() diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py index 1f4071fc56..d8ce7ea470 100644 --- a/tempest/api/compute/servers/test_create_server.py +++ b/tempest/api/compute/servers/test_create_server.py @@ -17,11 +17,11 @@ import netaddr import testtools from tempest.api.compute import base +from tempest.common import utils from tempest.common.utils.linux import remote_client from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -151,6 +151,6 @@ class ServersTestBootFromVolume(ServersTestJSON): @classmethod def skip_checks(cls): super(ServersTestBootFromVolume, cls).skip_checks() - if not test.get_service_list()['volume']: + if not utils.get_service_list()['volume']: msg = "Volume service not enabled." raise cls.skipException(msg) diff --git a/tempest/api/compute/servers/test_delete_server.py b/tempest/api/compute/servers/test_delete_server.py index 2b03b2be74..0093752e35 100644 --- a/tempest/api/compute/servers/test_delete_server.py +++ b/tempest/api/compute/servers/test_delete_server.py @@ -17,10 +17,10 @@ import testtools from tempest.api.compute import base from tempest.common import compute +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -104,7 +104,7 @@ class DeleteServersTestJSON(base.BaseV2ComputeTest): waiters.wait_for_server_termination(self.client, server['id']) @decorators.idempotent_id('d0f3f0d6-d9b6-4a32-8da4-23015dcab23c') - @test.services('volume') + @utils.services('volume') def test_delete_server_while_in_attached_volume(self): # Delete a server while a volume is attached to it device = '/dev/%s' % CONF.compute.volume_device_name diff --git a/tempest/api/compute/servers/test_device_tagging.py b/tempest/api/compute/servers/test_device_tagging.py index 7ee1b0259d..dbf6713d8a 100644 --- a/tempest/api/compute/servers/test_device_tagging.py +++ b/tempest/api/compute/servers/test_device_tagging.py @@ -17,13 +17,13 @@ import json from oslo_log import log as logging from tempest.api.compute import base +from tempest.common import utils from tempest.common.utils.linux import remote_client from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import test_utils from tempest.lib import decorators from tempest.lib import exceptions -from tempest import test CONF = config.CONF @@ -94,7 +94,7 @@ class DeviceTaggingTest(base.BaseV2ComputeTest): 'other'])) @decorators.idempotent_id('a2e65a6c-66f1-4442-aaa8-498c31778d96') - @test.services('network', 'volume', 'image') + @utils.services('network', 'volume', 'image') def test_device_tagging(self): # Create volumes # The create_volume methods waits for the volumes to be available and diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py index d1d29af3d5..4870a3d051 100644 --- a/tempest/api/compute/servers/test_server_actions.py +++ b/tempest/api/compute/servers/test_server_actions.py @@ -19,13 +19,13 @@ import testtools from tempest.api.compute import base from tempest.common import compute +from tempest.common import utils from tempest.common.utils.linux import remote_client from tempest.common import waiters from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -252,7 +252,7 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest): self.client.start_server(self.server_id) @decorators.idempotent_id('b68bd8d6-855d-4212-b59b-2e704044dace') - @test.services('volume') + @utils.services('volume') def test_rebuild_server_with_volume_attached(self): # create a new volume and attach it to the server volume = self.create_volume() @@ -333,7 +333,7 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest): @decorators.idempotent_id('b963d4f1-94b3-4c40-9e97-7b583f46e470') @testtools.skipUnless(CONF.compute_feature_enabled.snapshot, 'Snapshotting not available, backup not possible.') - @test.services('image') + @utils.services('image') def test_create_backup(self): # Positive test:create backup successfully and rotate backups correctly # create the first and the second backup @@ -518,7 +518,7 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest): @decorators.idempotent_id('77eba8e0-036e-4635-944b-f7a8f3b78dc9') @testtools.skipUnless(CONF.compute_feature_enabled.shelve, 'Shelve is not available.') - @test.services('image') + @utils.services('image') def test_shelve_unshelve_server(self): if CONF.image_feature_enabled.api_v2: glance_client = self.os_primary.image_client_v2 diff --git a/tempest/api/compute/servers/test_server_addresses.py b/tempest/api/compute/servers/test_server_addresses.py index 022ceba77b..0169de70c7 100644 --- a/tempest/api/compute/servers/test_server_addresses.py +++ b/tempest/api/compute/servers/test_server_addresses.py @@ -14,8 +14,8 @@ # under the License. from tempest.api.compute import base +from tempest.common import utils from tempest.lib import decorators -from tempest import test class ServerAddressesTestJSON(base.BaseV2ComputeTest): @@ -39,7 +39,7 @@ class ServerAddressesTestJSON(base.BaseV2ComputeTest): @decorators.attr(type='smoke') @decorators.idempotent_id('6eb718c0-02d9-4d5e-acd1-4e0c269cef39') - @test.services('network') + @utils.services('network') def test_list_server_addresses(self): # All public and private addresses for # a server should be returned @@ -57,7 +57,7 @@ class ServerAddressesTestJSON(base.BaseV2ComputeTest): @decorators.attr(type='smoke') @decorators.idempotent_id('87bbc374-5538-4f64-b673-2b0e4443cc30') - @test.services('network') + @utils.services('network') def test_list_server_addresses_by_network(self): # Providing a network type should filter # the addresses return by that type diff --git a/tempest/api/compute/servers/test_server_addresses_negative.py b/tempest/api/compute/servers/test_server_addresses_negative.py index 76a102bb6b..b2b3cc0965 100644 --- a/tempest/api/compute/servers/test_server_addresses_negative.py +++ b/tempest/api/compute/servers/test_server_addresses_negative.py @@ -14,9 +14,9 @@ # under the License. from tempest.api.compute import base +from tempest.common import utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class ServerAddressesNegativeTestJSON(base.BaseV2ComputeTest): @@ -38,7 +38,7 @@ class ServerAddressesNegativeTestJSON(base.BaseV2ComputeTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('02c3f645-2d2e-4417-8525-68c0407d001b') - @test.services('network') + @utils.services('network') def test_list_server_addresses_invalid_server_id(self): # List addresses request should fail if server id not in system self.assertRaises(lib_exc.NotFound, self.client.list_addresses, @@ -46,7 +46,7 @@ class ServerAddressesNegativeTestJSON(base.BaseV2ComputeTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('a2ab5144-78c0-4942-a0ed-cc8edccfd9ba') - @test.services('network') + @utils.services('network') def test_list_server_addresses_by_network_neg(self): # List addresses by network should fail if network name not valid self.assertRaises(lib_exc.NotFound, diff --git a/tempest/api/compute/servers/test_server_group.py b/tempest/api/compute/servers/test_server_group.py index f402540827..5286c8f58b 100644 --- a/tempest/api/compute/servers/test_server_group.py +++ b/tempest/api/compute/servers/test_server_group.py @@ -17,9 +17,9 @@ import testtools from tempest.api.compute import base from tempest.common import compute +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test class ServerGroupTestJSON(base.BaseV2ComputeTest): @@ -33,7 +33,7 @@ class ServerGroupTestJSON(base.BaseV2ComputeTest): @classmethod def skip_checks(cls): super(ServerGroupTestJSON, cls).skip_checks() - if not test.is_extension_enabled('os-server-groups', 'compute'): + if not utils.is_extension_enabled('os-server-groups', 'compute'): msg = "os-server-groups extension is not enabled." raise cls.skipException(msg) diff --git a/tempest/api/compute/servers/test_server_rescue_negative.py b/tempest/api/compute/servers/test_server_rescue_negative.py index 5fac433dc3..1260c6be75 100644 --- a/tempest/api/compute/servers/test_server_rescue_negative.py +++ b/tempest/api/compute/servers/test_server_rescue_negative.py @@ -16,12 +16,12 @@ import testtools from tempest.api.compute import base +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -109,7 +109,7 @@ class ServerRescueNegativeTestJSON(base.BaseV2ComputeTest): self.image_ref_alt) @decorators.idempotent_id('d0ccac79-0091-4cf4-a1ce-26162d0cc55f') - @test.services('volume') + @utils.services('volume') @decorators.attr(type=['negative']) def test_rescued_vm_attach_volume(self): volume = self.create_volume() @@ -129,7 +129,7 @@ class ServerRescueNegativeTestJSON(base.BaseV2ComputeTest): device='/dev/%s' % self.device) @decorators.idempotent_id('f56e465b-fe10-48bf-b75d-646cda3a8bc9') - @test.services('volume') + @utils.services('volume') @decorators.attr(type=['negative']) def test_rescued_vm_detach_volume(self): volume = self.create_volume() diff --git a/tempest/api/compute/servers/test_server_tags.py b/tempest/api/compute/servers/test_server_tags.py index 0370215379..8d0a4e3a31 100644 --- a/tempest/api/compute/servers/test_server_tags.py +++ b/tempest/api/compute/servers/test_server_tags.py @@ -16,9 +16,9 @@ import six from tempest.api.compute import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test class ServerTagsTestJSON(base.BaseV2ComputeTest): @@ -29,7 +29,7 @@ class ServerTagsTestJSON(base.BaseV2ComputeTest): @classmethod def skip_checks(cls): super(ServerTagsTestJSON, cls).skip_checks() - if not test.is_extension_enabled('os-server-tags', 'compute'): + if not utils.is_extension_enabled('os-server-tags', 'compute'): msg = "os-server-tags extension is not enabled." raise cls.skipException(msg) diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py index 764767b8a0..8170b28666 100644 --- a/tempest/api/compute/servers/test_servers_negative.py +++ b/tempest/api/compute/servers/test_servers_negative.py @@ -19,12 +19,12 @@ import testtools from tempest.api.compute import base from tempest.common import compute +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -217,7 +217,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest): @decorators.attr(type=['negative']) @decorators.related_bug('1651064', status_code=500) - @test.services('volume') + @utils.services('volume') @decorators.idempotent_id('12146ac1-d7df-4928-ad25-b1f99e5286cd') def test_create_server_invalid_bdm_in_2nd_dict(self): volume = self.create_volume() @@ -512,7 +512,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('74085be3-a370-4ca2-bc51-2d0e10e0f573') - @test.services('volume', 'image') + @utils.services('volume', 'image') def test_create_server_from_non_bootable_volume(self): # Create a volume volume = self.create_volume() diff --git a/tempest/api/compute/servers/test_virtual_interfaces.py b/tempest/api/compute/servers/test_virtual_interfaces.py index a42b968816..10e1f23874 100644 --- a/tempest/api/compute/servers/test_virtual_interfaces.py +++ b/tempest/api/compute/servers/test_virtual_interfaces.py @@ -17,10 +17,10 @@ import netaddr import testtools from tempest.api.compute import base +from tempest.common import utils from tempest import config from tempest.lib import decorators from tempest.lib import exceptions -from tempest import test CONF = config.CONF @@ -44,7 +44,7 @@ class VirtualInterfacesTestJSON(base.BaseV2ComputeTest): cls.server = cls.create_test_server(wait_until='ACTIVE') @decorators.idempotent_id('96c4e2ef-5e4d-4d7f-87f5-fed6dca18016') - @test.services('network') + @utils.services('network') def test_list_virtual_interfaces(self): # Positive test:Should be able to GET the virtual interfaces list # for a given server_id diff --git a/tempest/api/compute/servers/test_virtual_interfaces_negative.py b/tempest/api/compute/servers/test_virtual_interfaces_negative.py index 173784a400..20923a819e 100644 --- a/tempest/api/compute/servers/test_virtual_interfaces_negative.py +++ b/tempest/api/compute/servers/test_virtual_interfaces_negative.py @@ -14,10 +14,10 @@ # under the License. from tempest.api.compute import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class VirtualInterfacesNegativeTestJSON(base.BaseV2ComputeTest): @@ -35,7 +35,7 @@ class VirtualInterfacesNegativeTestJSON(base.BaseV2ComputeTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('64ebd03c-1089-4306-93fa-60f5eb5c803c') - @test.services('network') + @utils.services('network') def test_list_virtual_interfaces_invalid_server_id(self): # Negative test: Should not be able to GET virtual interfaces # for an invalid server_id diff --git a/tempest/api/compute/test_extensions.py b/tempest/api/compute/test_extensions.py index 42e13bdef3..cd5418f518 100644 --- a/tempest/api/compute/test_extensions.py +++ b/tempest/api/compute/test_extensions.py @@ -16,9 +16,9 @@ from oslo_log import log as logging from tempest.api.compute import base +from tempest.common import utils from tempest import config from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -48,7 +48,7 @@ class ExtensionsTestJSON(base.BaseV2ComputeTest): raise self.skipException('There are not any extensions configured') @decorators.idempotent_id('05762f39-bdfa-4cdb-9b46-b78f8e78e2fd') - @test.requires_ext(extension='os-consoles', service='compute') + @utils.requires_ext(extension='os-consoles', service='compute') def test_get_extension(self): # get the specified extensions extension = self.extensions_client.show_extension('os-consoles') diff --git a/tempest/api/compute/test_quotas.py b/tempest/api/compute/test_quotas.py index 9d83ee19bc..7cf90ae8c3 100644 --- a/tempest/api/compute/test_quotas.py +++ b/tempest/api/compute/test_quotas.py @@ -15,8 +15,8 @@ from tempest.api.compute import base from tempest.common import tempest_fixtures as fixtures +from tempest.common import utils from tempest.lib import decorators -from tempest import test class QuotasTestJSON(base.BaseV2ComputeTest): @@ -24,7 +24,7 @@ class QuotasTestJSON(base.BaseV2ComputeTest): @classmethod def skip_checks(cls): super(QuotasTestJSON, cls).skip_checks() - if not test.is_extension_enabled('os-quota-sets', 'compute'): + if not utils.is_extension_enabled('os-quota-sets', 'compute'): msg = "quotas extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/compute/test_tenant_networks.py b/tempest/api/compute/test_tenant_networks.py index 18c5d385d8..b55e2c00c3 100644 --- a/tempest/api/compute/test_tenant_networks.py +++ b/tempest/api/compute/test_tenant_networks.py @@ -13,8 +13,8 @@ # under the License. from tempest.api.compute import base +from tempest.common import utils from tempest.lib import decorators -from tempest import test class ComputeTenantNetworksTest(base.BaseV2ComputeTest): @@ -31,7 +31,7 @@ class ComputeTenantNetworksTest(base.BaseV2ComputeTest): super(ComputeTenantNetworksTest, cls).setup_credentials() @decorators.idempotent_id('edfea98e-bbe3-4c7a-9739-87b986baff26') - @test.services('network') + @utils.services('network') def test_list_show_tenant_networks(self): # Fetch all networks that are visible to the tenant: this may include # shared and external networks diff --git a/tempest/api/identity/admin/v3/test_inherits.py b/tempest/api/identity/admin/v3/test_inherits.py index e61dbc8b36..8b687cd6cc 100644 --- a/tempest/api/identity/admin/v3/test_inherits.py +++ b/tempest/api/identity/admin/v3/test_inherits.py @@ -11,9 +11,9 @@ # under the License. from tempest.api.identity import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test class InheritsV3TestJSON(base.BaseIdentityV3AdminTest): @@ -21,7 +21,7 @@ class InheritsV3TestJSON(base.BaseIdentityV3AdminTest): @classmethod def skip_checks(cls): super(InheritsV3TestJSON, cls).skip_checks() - if not test.is_extension_enabled('OS-INHERIT', 'identity'): + if not utils.is_extension_enabled('OS-INHERIT', 'identity'): raise cls.skipException("Inherits aren't enabled") @classmethod diff --git a/tempest/api/identity/v2/test_ec2_credentials.py b/tempest/api/identity/v2/test_ec2_credentials.py index 599b784d62..237e728c53 100644 --- a/tempest/api/identity/v2/test_ec2_credentials.py +++ b/tempest/api/identity/v2/test_ec2_credentials.py @@ -14,9 +14,9 @@ # under the License. from tempest.api.identity import base +from tempest.common import utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class EC2CredentialsTest(base.BaseIdentityV2Test): @@ -24,7 +24,7 @@ class EC2CredentialsTest(base.BaseIdentityV2Test): @classmethod def skip_checks(cls): super(EC2CredentialsTest, cls).skip_checks() - if not test.is_extension_enabled('OS-EC2', 'identity'): + if not utils.is_extension_enabled('OS-EC2', 'identity'): msg = "OS-EC2 identity extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/network/admin/test_agent_management.py b/tempest/api/network/admin/test_agent_management.py index 7304db92b9..5068fc4393 100644 --- a/tempest/api/network/admin/test_agent_management.py +++ b/tempest/api/network/admin/test_agent_management.py @@ -14,8 +14,8 @@ from tempest.api.network import base from tempest.common import tempest_fixtures as fixtures +from tempest.common import utils from tempest.lib import decorators -from tempest import test class AgentManagementTestJSON(base.BaseAdminNetworkTest): @@ -23,7 +23,7 @@ class AgentManagementTestJSON(base.BaseAdminNetworkTest): @classmethod def skip_checks(cls): super(AgentManagementTestJSON, cls).skip_checks() - if not test.is_extension_enabled('agent', 'network'): + if not utils.is_extension_enabled('agent', 'network'): msg = "agent extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/network/admin/test_dhcp_agent_scheduler.py b/tempest/api/network/admin/test_dhcp_agent_scheduler.py index 485c8f5ed6..8315c5d869 100644 --- a/tempest/api/network/admin/test_dhcp_agent_scheduler.py +++ b/tempest/api/network/admin/test_dhcp_agent_scheduler.py @@ -13,8 +13,8 @@ # under the License. from tempest.api.network import base +from tempest.common import utils from tempest.lib import decorators -from tempest import test class DHCPAgentSchedulersTestJSON(base.BaseAdminNetworkTest): @@ -22,7 +22,7 @@ class DHCPAgentSchedulersTestJSON(base.BaseAdminNetworkTest): @classmethod def skip_checks(cls): super(DHCPAgentSchedulersTestJSON, cls).skip_checks() - if not test.is_extension_enabled('dhcp_agent_scheduler', 'network'): + if not utils.is_extension_enabled('dhcp_agent_scheduler', 'network'): msg = "dhcp_agent_scheduler extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/network/admin/test_floating_ips_admin_actions.py b/tempest/api/network/admin/test_floating_ips_admin_actions.py index 7ee819ea7d..5aa337cc70 100644 --- a/tempest/api/network/admin/test_floating_ips_admin_actions.py +++ b/tempest/api/network/admin/test_floating_ips_admin_actions.py @@ -14,9 +14,9 @@ # under the License. from tempest.api.network import base +from tempest.common import utils from tempest import config from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -28,7 +28,7 @@ class FloatingIPAdminTestJSON(base.BaseAdminNetworkTest): @classmethod def skip_checks(cls): super(FloatingIPAdminTestJSON, cls).skip_checks() - if not test.is_extension_enabled('router', 'network'): + if not utils.is_extension_enabled('router', 'network'): msg = "router extension not enabled." raise cls.skipException(msg) if not CONF.network.public_network_id: diff --git a/tempest/api/network/admin/test_l3_agent_scheduler.py b/tempest/api/network/admin/test_l3_agent_scheduler.py index 85b2472e82..1a7b0ec3db 100644 --- a/tempest/api/network/admin/test_l3_agent_scheduler.py +++ b/tempest/api/network/admin/test_l3_agent_scheduler.py @@ -13,10 +13,10 @@ # under the License. from tempest.api.network import base +from tempest.common import utils from tempest import config from tempest.lib import decorators from tempest.lib import exceptions -from tempest import test CONF = config.CONF AGENT_TYPE = 'L3 agent' @@ -41,7 +41,7 @@ class L3AgentSchedulerTestJSON(base.BaseAdminNetworkTest): @classmethod def skip_checks(cls): super(L3AgentSchedulerTestJSON, cls).skip_checks() - if not test.is_extension_enabled('l3_agent_scheduler', 'network'): + if not utils.is_extension_enabled('l3_agent_scheduler', 'network'): msg = "L3 Agent Scheduler Extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/network/admin/test_metering_extensions.py b/tempest/api/network/admin/test_metering_extensions.py index 21a7ab4ead..fd8678247a 100644 --- a/tempest/api/network/admin/test_metering_extensions.py +++ b/tempest/api/network/admin/test_metering_extensions.py @@ -13,9 +13,9 @@ # under the License. from tempest.api.network import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test class MeteringTestJSON(base.BaseAdminNetworkTest): @@ -28,7 +28,7 @@ class MeteringTestJSON(base.BaseAdminNetworkTest): @classmethod def skip_checks(cls): super(MeteringTestJSON, cls).skip_checks() - if not test.is_extension_enabled('metering', 'network'): + if not utils.is_extension_enabled('metering', 'network'): msg = "metering extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/network/admin/test_negative_quotas.py b/tempest/api/network/admin/test_negative_quotas.py index 21688d2428..6849653be9 100644 --- a/tempest/api/network/admin/test_negative_quotas.py +++ b/tempest/api/network/admin/test_negative_quotas.py @@ -14,9 +14,9 @@ # under the License. from tempest.api.network import base +from tempest.common import utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class QuotasNegativeTest(base.BaseAdminNetworkTest): @@ -35,7 +35,7 @@ class QuotasNegativeTest(base.BaseAdminNetworkTest): @classmethod def skip_checks(cls): super(QuotasNegativeTest, cls).skip_checks() - if not test.is_extension_enabled('quotas', 'network'): + if not utils.is_extension_enabled('quotas', 'network'): msg = "quotas extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/network/admin/test_quotas.py b/tempest/api/network/admin/test_quotas.py index aa8b2dca99..f69d7c5ad1 100644 --- a/tempest/api/network/admin/test_quotas.py +++ b/tempest/api/network/admin/test_quotas.py @@ -14,10 +14,10 @@ # under the License. from tempest.api.network import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import test_utils from tempest.lib import decorators -from tempest import test class QuotasTest(base.BaseAdminNetworkTest): @@ -38,7 +38,7 @@ class QuotasTest(base.BaseAdminNetworkTest): @classmethod def skip_checks(cls): super(QuotasTest, cls).skip_checks() - if not test.is_extension_enabled('quotas', 'network'): + if not utils.is_extension_enabled('quotas', 'network'): msg = "quotas extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/network/admin/test_routers.py b/tempest/api/network/admin/test_routers.py index f180cdaea5..c97efe9f82 100644 --- a/tempest/api/network/admin/test_routers.py +++ b/tempest/api/network/admin/test_routers.py @@ -16,10 +16,10 @@ import testtools from tempest.api.network import base +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -57,7 +57,7 @@ class RoutersAdminTest(base.BaseAdminNetworkTest): @classmethod def skip_checks(cls): super(RoutersAdminTest, cls).skip_checks() - if not test.is_extension_enabled('router', 'network'): + if not utils.is_extension_enabled('router', 'network'): msg = "router extension not enabled." raise cls.skipException(msg) @@ -79,7 +79,7 @@ class RoutersAdminTest(base.BaseAdminNetworkTest): self.assertEqual(project_id, create_body['router']['tenant_id']) @decorators.idempotent_id('847257cc-6afd-4154-b8fb-af49f5670ce8') - @test.requires_ext(extension='ext-gw-mode', service='network') + @utils.requires_ext(extension='ext-gw-mode', service='network') @testtools.skipUnless(CONF.network.public_network_id, 'The public_network_id option must be specified.') def test_create_router_with_default_snat_value(self): @@ -91,7 +91,7 @@ class RoutersAdminTest(base.BaseAdminNetworkTest): 'enable_snat': True}) @decorators.idempotent_id('ea74068d-09e9-4fd7-8995-9b6a1ace920f') - @test.requires_ext(extension='ext-gw-mode', service='network') + @utils.requires_ext(extension='ext-gw-mode', service='network') @testtools.skipUnless(CONF.network.public_network_id, 'The public_network_id option must be specified.') def test_create_router_with_snat_explicit(self): @@ -153,7 +153,7 @@ class RoutersAdminTest(base.BaseAdminNetworkTest): self._verify_gateway_port(router['id']) @decorators.idempotent_id('b386c111-3b21-466d-880c-5e72b01e1a33') - @test.requires_ext(extension='ext-gw-mode', service='network') + @utils.requires_ext(extension='ext-gw-mode', service='network') @testtools.skipUnless(CONF.network.public_network_id, 'The public_network_id option must be specified.') def test_update_router_set_gateway_with_snat_explicit(self): @@ -170,7 +170,7 @@ class RoutersAdminTest(base.BaseAdminNetworkTest): self._verify_gateway_port(router['id']) @decorators.idempotent_id('96536bc7-8262-4fb2-9967-5c46940fa279') - @test.requires_ext(extension='ext-gw-mode', service='network') + @utils.requires_ext(extension='ext-gw-mode', service='network') @testtools.skipUnless(CONF.network.public_network_id, 'The public_network_id option must be specified.') def test_update_router_set_gateway_without_snat(self): @@ -202,7 +202,7 @@ class RoutersAdminTest(base.BaseAdminNetworkTest): self.assertFalse(list_body['ports']) @decorators.idempotent_id('f2faf994-97f4-410b-a831-9bc977b64374') - @test.requires_ext(extension='ext-gw-mode', service='network') + @utils.requires_ext(extension='ext-gw-mode', service='network') @testtools.skipUnless(CONF.network.public_network_id, 'The public_network_id option must be specified.') def test_update_router_reset_gateway_without_snat(self): diff --git a/tempest/api/network/admin/test_routers_dvr.py b/tempest/api/network/admin/test_routers_dvr.py index b6772b1a54..93478e6e09 100644 --- a/tempest/api/network/admin/test_routers_dvr.py +++ b/tempest/api/network/admin/test_routers_dvr.py @@ -16,9 +16,9 @@ import testtools from tempest.api.network import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test class RoutersTestDVR(base.BaseAdminNetworkTest): @@ -27,7 +27,7 @@ class RoutersTestDVR(base.BaseAdminNetworkTest): def skip_checks(cls): super(RoutersTestDVR, cls).skip_checks() for ext in ['router', 'dvr']: - if not test.is_extension_enabled(ext, 'network'): + if not utils.is_extension_enabled(ext, 'network'): msg = "%s extension not enabled." % ext raise cls.skipException(msg) # The check above will pass if api_extensions=all, which does @@ -87,7 +87,7 @@ class RoutersTestDVR(base.BaseAdminNetworkTest): self.assertFalse(router['router']['distributed']) @decorators.idempotent_id('acd43596-c1fb-439d-ada8-31ad48ae3c2e') - @testtools.skipUnless(test.is_extension_enabled('l3-ha', 'network'), + @testtools.skipUnless(utils.is_extension_enabled('l3-ha', 'network'), 'HA routers are not available.') def test_centralized_router_update_to_dvr(self): """Test centralized router update diff --git a/tempest/api/network/admin/test_routers_negative.py b/tempest/api/network/admin/test_routers_negative.py index f350a1571c..9356bcc019 100644 --- a/tempest/api/network/admin/test_routers_negative.py +++ b/tempest/api/network/admin/test_routers_negative.py @@ -16,10 +16,10 @@ import testtools from tempest.api.network import base +from tempest.common import utils from tempest import config from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -29,13 +29,13 @@ class RoutersAdminNegativeTest(base.BaseAdminNetworkTest): @classmethod def skip_checks(cls): super(RoutersAdminNegativeTest, cls).skip_checks() - if not test.is_extension_enabled('router', 'network'): + if not utils.is_extension_enabled('router', 'network'): msg = "router extension not enabled." raise cls.skipException(msg) @decorators.attr(type=['negative']) @decorators.idempotent_id('7101cc02-058a-11e7-93e1-fa163e4fa634') - @test.requires_ext(extension='ext-gw-mode', service='network') + @utils.requires_ext(extension='ext-gw-mode', service='network') @testtools.skipUnless(CONF.network.public_network_id, 'The public_network_id option must be specified.') def test_router_set_gateway_used_ip_returns_409(self): diff --git a/tempest/api/network/test_allowed_address_pair.py b/tempest/api/network/test_allowed_address_pair.py index a90e4bfe48..37f5ec256c 100644 --- a/tempest/api/network/test_allowed_address_pair.py +++ b/tempest/api/network/test_allowed_address_pair.py @@ -17,9 +17,9 @@ import netaddr import six from tempest.api.network import base +from tempest.common import utils from tempest import config from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -44,7 +44,7 @@ class AllowedAddressPairTestJSON(base.BaseNetworkTest): @classmethod def skip_checks(cls): super(AllowedAddressPairTestJSON, cls).skip_checks() - if not test.is_extension_enabled('allowed-address-pairs', 'network'): + if not utils.is_extension_enabled('allowed-address-pairs', 'network'): msg = "Allowed Address Pairs extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/network/test_extensions.py b/tempest/api/network/test_extensions.py index 014d064453..4804adaabf 100644 --- a/tempest/api/network/test_extensions.py +++ b/tempest/api/network/test_extensions.py @@ -15,8 +15,8 @@ from tempest.api.network import base +from tempest.common import utils from tempest.lib import decorators -from tempest import test class ExtensionsTestJSON(base.BaseNetworkTest): @@ -40,7 +40,7 @@ class ExtensionsTestJSON(base.BaseNetworkTest): 'allowed-address-pairs', 'extra_dhcp_opt', 'metering', 'dvr'] expected_alias = [ext for ext in expected_alias if - test.is_extension_enabled(ext, 'network')] + utils.is_extension_enabled(ext, 'network')] actual_alias = list() extensions = self.network_extensions_client.list_extensions() list_extensions = extensions['extensions'] @@ -66,5 +66,5 @@ class ExtensionsTestJSON(base.BaseNetworkTest): # of extensions returned, but only for those that have been # enabled via configuration for e in expected_alias: - if test.is_extension_enabled(e, 'network'): + if utils.is_extension_enabled(e, 'network'): self.assertIn(e, actual_alias) diff --git a/tempest/api/network/test_extra_dhcp_options.py b/tempest/api/network/test_extra_dhcp_options.py index ff66e9aa35..0d42033899 100644 --- a/tempest/api/network/test_extra_dhcp_options.py +++ b/tempest/api/network/test_extra_dhcp_options.py @@ -14,9 +14,9 @@ # under the License. from tempest.api.network import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test class ExtraDHCPOptionsTestJSON(base.BaseNetworkTest): @@ -35,7 +35,7 @@ class ExtraDHCPOptionsTestJSON(base.BaseNetworkTest): @classmethod def skip_checks(cls): super(ExtraDHCPOptionsTestJSON, cls).skip_checks() - if not test.is_extension_enabled('extra_dhcp_opt', 'network'): + if not utils.is_extension_enabled('extra_dhcp_opt', 'network'): msg = "Extra DHCP Options extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/network/test_floating_ips.py b/tempest/api/network/test_floating_ips.py index c799b15a3c..ef4a23aff7 100644 --- a/tempest/api/network/test_floating_ips.py +++ b/tempest/api/network/test_floating_ips.py @@ -14,10 +14,10 @@ # under the License. from tempest.api.network import base +from tempest.common import utils from tempest.common.utils import net_utils from tempest import config from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -43,7 +43,7 @@ class FloatingIPTestJSON(base.BaseNetworkTest): @classmethod def skip_checks(cls): super(FloatingIPTestJSON, cls).skip_checks() - if not test.is_extension_enabled('router', 'network'): + if not utils.is_extension_enabled('router', 'network'): msg = "router extension not enabled." raise cls.skipException(msg) if not CONF.network.public_network_id: diff --git a/tempest/api/network/test_floating_ips_negative.py b/tempest/api/network/test_floating_ips_negative.py index 5ca17fec06..e904a81eb8 100644 --- a/tempest/api/network/test_floating_ips_negative.py +++ b/tempest/api/network/test_floating_ips_negative.py @@ -15,10 +15,10 @@ # under the License. from tempest.api.network import base +from tempest.common import utils from tempest import config from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -34,7 +34,7 @@ class FloatingIPNegativeTestJSON(base.BaseNetworkTest): @classmethod def skip_checks(cls): super(FloatingIPNegativeTestJSON, cls).skip_checks() - if not test.is_extension_enabled('router', 'network'): + if not utils.is_extension_enabled('router', 'network'): msg = "router extension not enabled." raise cls.skipException(msg) if not CONF.network.public_network_id: diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py index 269f2c2d6c..206d1a8466 100644 --- a/tempest/api/network/test_networks.py +++ b/tempest/api/network/test_networks.py @@ -18,12 +18,12 @@ import testtools from tempest.api.network import base from tempest.common import custom_matchers +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import test_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -209,7 +209,7 @@ class NetworksTest(BaseNetworkTestResources): def test_show_network_fields(self): # Verify specific fields of a network fields = ['id', 'name'] - if test.is_extension_enabled('net-mtu', 'network'): + if utils.is_extension_enabled('net-mtu', 'network'): fields.append('mtu') body = self.networks_client.show_network(self.network['id'], fields=fields) @@ -233,7 +233,7 @@ class NetworksTest(BaseNetworkTestResources): def test_list_networks_fields(self): # Verify specific fields of the networks fields = ['id', 'name'] - if test.is_extension_enabled('net-mtu', 'network'): + if utils.is_extension_enabled('net-mtu', 'network'): fields.append('mtu') body = self.networks_client.list_networks(fields=fields) networks = body['networks'] @@ -370,7 +370,7 @@ class NetworksTest(BaseNetworkTestResources): @decorators.attr(type='smoke') @decorators.idempotent_id('af774677-42a9-4e4b-bb58-16fe6a5bc1ec') - @test.requires_ext(extension='external-net', service='network') + @utils.requires_ext(extension='external-net', service='network') @testtools.skipUnless(CONF.network.public_network_id, 'The public_network_id option must be specified.') def test_external_network_visibility(self): @@ -392,8 +392,8 @@ class NetworksTest(BaseNetworkTestResources): self.assertEmpty(body['subnets'], "Public subnets visible") @decorators.idempotent_id('c72c1c0c-2193-4aca-ccc4-b1442640bbbb') - @test.requires_ext(extension="standard-attr-description", - service="network") + @utils.requires_ext(extension="standard-attr-description", + service="network") def test_create_update_network_description(self): body = self.create_network(description='d1') self.assertEqual('d1', body['description']) diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py index f81927d7ad..5c36747914 100644 --- a/tempest/api/network/test_ports.py +++ b/tempest/api/network/test_ports.py @@ -18,11 +18,11 @@ import testtools from tempest.api.network import base_security_groups as sec_base from tempest.common import custom_matchers +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions -from tempest import test CONF = config.CONF @@ -307,7 +307,7 @@ class PortsTestJSON(sec_base.BaseSecGroupTest): @decorators.idempotent_id('58091b66-4ff4-4cc1-a549-05d60c7acd1a') @testtools.skipUnless( - test.is_extension_enabled('security-group', 'network'), + utils.is_extension_enabled('security-group', 'network'), 'security-group extension not enabled.') def test_update_port_with_security_group_and_extra_attributes(self): self._update_port_with_security_groups( @@ -315,7 +315,7 @@ class PortsTestJSON(sec_base.BaseSecGroupTest): @decorators.idempotent_id('edf6766d-3d40-4621-bc6e-2521a44c257d') @testtools.skipUnless( - test.is_extension_enabled('security-group', 'network'), + utils.is_extension_enabled('security-group', 'network'), 'security-group extension not enabled.') def test_update_port_with_two_security_groups_and_extra_attributes(self): self._update_port_with_security_groups( @@ -342,7 +342,7 @@ class PortsTestJSON(sec_base.BaseSecGroupTest): @decorators.attr(type='smoke') @decorators.idempotent_id('4179dcb9-1382-4ced-84fe-1b91c54f5735') @testtools.skipUnless( - test.is_extension_enabled('security-group', 'network'), + utils.is_extension_enabled('security-group', 'network'), 'security-group extension not enabled.') def test_create_port_with_no_securitygroups(self): network = self.create_network() diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py index 128544b1b4..3883cc2443 100644 --- a/tempest/api/network/test_routers.py +++ b/tempest/api/network/test_routers.py @@ -17,10 +17,10 @@ import netaddr import testtools from tempest.api.network import base +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -55,7 +55,7 @@ class RoutersTest(base.BaseNetworkTest): @classmethod def skip_checks(cls): super(RoutersTest, cls).skip_checks() - if not test.is_extension_enabled('router', 'network'): + if not utils.is_extension_enabled('router', 'network'): msg = "router extension not enabled." raise cls.skipException(msg) @@ -167,7 +167,7 @@ class RoutersTest(base.BaseNetworkTest): self.assertIn(subnet_id, public_subnet_ids) @decorators.idempotent_id('cbe42f84-04c2-11e7-8adb-fa163e4fa634') - @test.requires_ext(extension='ext-gw-mode', service='network') + @utils.requires_ext(extension='ext-gw-mode', service='network') @testtools.skipUnless(CONF.network.public_network_id, 'The public_network_id option must be specified.') @decorators.skip_because(bug='1676207') @@ -198,7 +198,7 @@ class RoutersTest(base.BaseNetworkTest): fixed_ip['ip_address']) @decorators.idempotent_id('c86ac3a8-50bd-4b00-a6b8-62af84a0765c') - @test.requires_ext(extension='extraroute', service='network') + @utils.requires_ext(extension='extraroute', service='network') def test_update_delete_extra_route(self): # Create different cidr for each subnet to avoid cidr duplicate # The cidr starts from project_cidr diff --git a/tempest/api/network/test_routers_negative.py b/tempest/api/network/test_routers_negative.py index db165abb8b..60b9de7c9e 100644 --- a/tempest/api/network/test_routers_negative.py +++ b/tempest/api/network/test_routers_negative.py @@ -16,11 +16,11 @@ import netaddr from tempest.api.network import base +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -30,7 +30,7 @@ class RoutersNegativeTest(base.BaseNetworkTest): @classmethod def skip_checks(cls): super(RoutersNegativeTest, cls).skip_checks() - if not test.is_extension_enabled('router', 'network'): + if not utils.is_extension_enabled('router', 'network'): msg = "router extension not enabled." raise cls.skipException(msg) @@ -124,7 +124,7 @@ class DvrRoutersNegativeTest(base.BaseNetworkTest): @classmethod def skip_checks(cls): super(DvrRoutersNegativeTest, cls).skip_checks() - if not test.is_extension_enabled('dvr', 'network'): + if not utils.is_extension_enabled('dvr', 'network'): msg = "DVR extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/network/test_security_groups.py b/tempest/api/network/test_security_groups.py index a1218644da..97ccee94e4 100644 --- a/tempest/api/network/test_security_groups.py +++ b/tempest/api/network/test_security_groups.py @@ -14,10 +14,10 @@ # under the License. from tempest.api.network import base_security_groups as base +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -28,7 +28,7 @@ class SecGroupTest(base.BaseSecGroupTest): @classmethod def skip_checks(cls): super(SecGroupTest, cls).skip_checks() - if not test.is_extension_enabled('security-group', 'network'): + if not utils.is_extension_enabled('security-group', 'network'): msg = "security-group extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/network/test_security_groups_negative.py b/tempest/api/network/test_security_groups_negative.py index f51fb33023..435673bc7e 100644 --- a/tempest/api/network/test_security_groups_negative.py +++ b/tempest/api/network/test_security_groups_negative.py @@ -14,11 +14,11 @@ # under the License. from tempest.api.network import base_security_groups as base +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -29,7 +29,7 @@ class NegativeSecGroupTest(base.BaseSecGroupTest): @classmethod def skip_checks(cls): super(NegativeSecGroupTest, cls).skip_checks() - if not test.is_extension_enabled('security-group', 'network'): + if not utils.is_extension_enabled('security-group', 'network'): msg = "security-group extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/network/test_service_providers.py b/tempest/api/network/test_service_providers.py index b90c81b7fc..9ebcd89ee4 100644 --- a/tempest/api/network/test_service_providers.py +++ b/tempest/api/network/test_service_providers.py @@ -13,15 +13,15 @@ import testtools from tempest.api.network import base +from tempest.common import utils from tempest.lib import decorators -from tempest import test class ServiceProvidersTest(base.BaseNetworkTest): @decorators.idempotent_id('2cbbeea9-f010-40f6-8df5-4eaa0c918ea6') @testtools.skipUnless( - test.is_extension_enabled('service-type', 'network'), + utils.is_extension_enabled('service-type', 'network'), 'service-type extension not enabled.') def test_service_providers_list(self): body = self.service_providers_client.list_service_providers() diff --git a/tempest/api/network/test_subnetpools_extensions.py b/tempest/api/network/test_subnetpools_extensions.py index 01d7db254d..bfc26098ea 100644 --- a/tempest/api/network/test_subnetpools_extensions.py +++ b/tempest/api/network/test_subnetpools_extensions.py @@ -13,12 +13,12 @@ # under the License. from tempest.api.network import base +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import test_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -42,7 +42,7 @@ class SubnetPoolsTestJSON(base.BaseNetworkTest): @classmethod def skip_checks(cls): super(SubnetPoolsTestJSON, cls).skip_checks() - if not test.is_extension_enabled('subnet_allocation', 'network'): + if not utils.is_extension_enabled('subnet_allocation', 'network'): msg = "subnet_allocation extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/network/test_tags.py b/tempest/api/network/test_tags.py index 567a4621f2..409d556eb4 100644 --- a/tempest/api/network/test_tags.py +++ b/tempest/api/network/test_tags.py @@ -14,11 +14,11 @@ # under the License. from tempest.api.network import base +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -40,7 +40,7 @@ class TagsTest(base.BaseNetworkTest): @classmethod def skip_checks(cls): super(TagsTest, cls).skip_checks() - if not test.is_extension_enabled('tag', 'network'): + if not utils.is_extension_enabled('tag', 'network'): msg = "tag extension not enabled." raise cls.skipException(msg) @@ -115,7 +115,7 @@ class TagsExtTest(base.BaseNetworkTest): @classmethod def skip_checks(cls): super(TagsExtTest, cls).skip_checks() - if not test.is_extension_enabled('tag-ext', 'network'): + if not utils.is_extension_enabled('tag-ext', 'network'): msg = "tag-ext extension not enabled." raise cls.skipException(msg) diff --git a/tempest/api/object_storage/test_account_bulk.py b/tempest/api/object_storage/test_account_bulk.py index 7c538e8f33..9abd59e2dd 100644 --- a/tempest/api/object_storage/test_account_bulk.py +++ b/tempest/api/object_storage/test_account_bulk.py @@ -17,8 +17,8 @@ import tempfile from tempest.api.object_storage import base from tempest.common import custom_matchers +from tempest.common import utils from tempest.lib import decorators -from tempest import test class BulkTest(base.BaseObjectTest): @@ -69,7 +69,7 @@ class BulkTest(base.BaseObjectTest): self.assertNotIn(container_name, body) @decorators.idempotent_id('a407de51-1983-47cc-9f14-47c2b059413c') - @test.requires_ext(extension='bulk_upload', service='object') + @utils.requires_ext(extension='bulk_upload', service='object') def test_extract_archive(self): # Test bulk operation of file upload with an archived file filepath, container_name, object_name = self._create_archive() @@ -104,7 +104,7 @@ class BulkTest(base.BaseObjectTest): self.assertIn(object_name, [c['name'] for c in contents_list]) @decorators.idempotent_id('c075e682-0d2a-43b2-808d-4116200d736d') - @test.requires_ext(extension='bulk_delete', service='object') + @utils.requires_ext(extension='bulk_delete', service='object') def test_bulk_delete(self): # Test bulk operation of deleting multiple files filepath, container_name, object_name = self._create_archive() @@ -129,7 +129,7 @@ class BulkTest(base.BaseObjectTest): self._check_contents_deleted(container_name) @decorators.idempotent_id('dbea2bcb-efbb-4674-ac8a-a5a0e33d1d79') - @test.requires_ext(extension='bulk_delete', service='object') + @utils.requires_ext(extension='bulk_delete', service='object') def test_bulk_delete_by_POST(self): # Test bulk operation of deleting multiple files filepath, container_name, object_name = self._create_archive() diff --git a/tempest/api/object_storage/test_account_quotas.py b/tempest/api/object_storage/test_account_quotas.py index f46c2564f3..48f42ec57d 100644 --- a/tempest/api/object_storage/test_account_quotas.py +++ b/tempest/api/object_storage/test_account_quotas.py @@ -13,10 +13,10 @@ # under the License. from tempest.api.object_storage import base +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -77,7 +77,7 @@ class AccountQuotasTest(base.BaseObjectTest): @decorators.attr(type="smoke") @decorators.idempotent_id('a22ef352-a342-4587-8f47-3bbdb5b039c4') - @test.requires_ext(extension='account_quotas', service='object') + @utils.requires_ext(extension='account_quotas', service='object') def test_upload_valid_object(self): object_name = data_utils.rand_name(name="TestObject") data = data_utils.arbitrary_string() @@ -88,7 +88,7 @@ class AccountQuotasTest(base.BaseObjectTest): @decorators.attr(type=["smoke"]) @decorators.idempotent_id('63f51f9f-5f1d-4fc6-b5be-d454d70949d6') - @test.requires_ext(extension='account_quotas', service='object') + @utils.requires_ext(extension='account_quotas', service='object') def test_admin_modify_quota(self): """Test ResellerAdmin can modify/remove the quota on a user's account diff --git a/tempest/api/object_storage/test_account_quotas_negative.py b/tempest/api/object_storage/test_account_quotas_negative.py index 431bbe9a83..798926b81a 100644 --- a/tempest/api/object_storage/test_account_quotas_negative.py +++ b/tempest/api/object_storage/test_account_quotas_negative.py @@ -13,10 +13,10 @@ # under the License. from tempest.api.object_storage import base +from tempest.common import utils from tempest import config from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -76,7 +76,7 @@ class AccountQuotasNegativeTest(base.BaseObjectTest): @decorators.attr(type=["negative"]) @decorators.idempotent_id('d1dc5076-555e-4e6d-9697-28f1fe976324') - @test.requires_ext(extension='account_quotas', service='object') + @utils.requires_ext(extension='account_quotas', service='object') def test_user_modify_quota(self): """Test that a user cannot modify or remove a quota on its account.""" diff --git a/tempest/api/object_storage/test_container_quotas.py b/tempest/api/object_storage/test_container_quotas.py index 8266341af3..c87bed568a 100644 --- a/tempest/api/object_storage/test_container_quotas.py +++ b/tempest/api/object_storage/test_container_quotas.py @@ -14,10 +14,10 @@ # under the License. from tempest.api.object_storage import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test QUOTA_BYTES = 10 QUOTA_COUNT = 3 @@ -49,7 +49,7 @@ class ContainerQuotasTest(base.BaseObjectTest): super(ContainerQuotasTest, self).tearDown() @decorators.idempotent_id('9a0fb034-86af-4df0-86fa-f8bd7db21ae0') - @test.requires_ext(extension='container_quotas', service='object') + @utils.requires_ext(extension='container_quotas', service='object') @decorators.attr(type="smoke") def test_upload_valid_object(self): """Attempts to uploads an object smaller than the bytes quota.""" @@ -66,7 +66,7 @@ class ContainerQuotasTest(base.BaseObjectTest): self.assertEqual(nbefore + len(data), nafter) @decorators.idempotent_id('22eeeb2b-3668-4160-baef-44790f65a5a0') - @test.requires_ext(extension='container_quotas', service='object') + @utils.requires_ext(extension='container_quotas', service='object') @decorators.attr(type="smoke") def test_upload_large_object(self): """Attempts to upload an object larger than the bytes quota.""" @@ -83,7 +83,7 @@ class ContainerQuotasTest(base.BaseObjectTest): self.assertEqual(nbefore, nafter) @decorators.idempotent_id('3a387039-697a-44fc-a9c0-935de31f426b') - @test.requires_ext(extension='container_quotas', service='object') + @utils.requires_ext(extension='container_quotas', service='object') @decorators.attr(type="smoke") def test_upload_too_many_objects(self): """Attempts to upload many objects that exceeds the count limit.""" diff --git a/tempest/api/object_storage/test_container_staticweb.py b/tempest/api/object_storage/test_container_staticweb.py index 943011dfb5..92fa6906ac 100644 --- a/tempest/api/object_storage/test_container_staticweb.py +++ b/tempest/api/object_storage/test_container_staticweb.py @@ -14,10 +14,10 @@ from tempest.api.object_storage import base from tempest.common import custom_matchers +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class StaticWebTest(base.BaseObjectTest): @@ -45,7 +45,7 @@ class StaticWebTest(base.BaseObjectTest): super(StaticWebTest, cls).resource_cleanup() @decorators.idempotent_id('c1f055ab-621d-4a6a-831f-846fcb578b8b') - @test.requires_ext(extension='staticweb', service='object') + @utils.requires_ext(extension='staticweb', service='object') def test_web_index(self): headers = {'web-index': self.object_name} @@ -76,7 +76,7 @@ class StaticWebTest(base.BaseObjectTest): self.assertNotIn('x-container-meta-web-index', body) @decorators.idempotent_id('941814cf-db9e-4b21-8112-2b6d0af10ee5') - @test.requires_ext(extension='staticweb', service='object') + @utils.requires_ext(extension='staticweb', service='object') def test_web_listing(self): headers = {'web-listings': 'true'} @@ -108,7 +108,7 @@ class StaticWebTest(base.BaseObjectTest): self.assertNotIn('x-container-meta-web-listings', body) @decorators.idempotent_id('bc37ec94-43c8-4990-842e-0e5e02fc8926') - @test.requires_ext(extension='staticweb', service='object') + @utils.requires_ext(extension='staticweb', service='object') def test_web_listing_css(self): headers = {'web-listings': 'true', 'web-listings-css': 'listings.css'} @@ -131,7 +131,7 @@ class StaticWebTest(base.BaseObjectTest): self.assertIn(css, body.decode()) @decorators.idempotent_id('f18b4bef-212e-45e7-b3ca-59af3a465f82') - @test.requires_ext(extension='staticweb', service='object') + @utils.requires_ext(extension='staticweb', service='object') def test_web_error(self): headers = {'web-listings': 'true', 'web-error': self.object_name} diff --git a/tempest/api/object_storage/test_container_sync_middleware.py b/tempest/api/object_storage/test_container_sync_middleware.py index 9eae13874e..e77b079290 100644 --- a/tempest/api/object_storage/test_container_sync_middleware.py +++ b/tempest/api/object_storage/test_container_sync_middleware.py @@ -13,9 +13,9 @@ # under the License. from tempest.api.object_storage import test_container_sync +from tempest.common import utils from tempest import config from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -39,7 +39,7 @@ class ContainerSyncMiddlewareTest(test_container_sync.ContainerSyncTest): @decorators.attr(type='slow') @decorators.idempotent_id('ea4645a1-d147-4976-82f7-e5a7a3065f80') - @test.requires_ext(extension='container_sync', service='object') + @utils.requires_ext(extension='container_sync', service='object') def test_container_synchronization(self): def make_headers(cont, cont_client): # tell first container to synchronize to a second diff --git a/tempest/api/object_storage/test_crossdomain.py b/tempest/api/object_storage/test_crossdomain.py index c47aa93eb6..f61d9f8911 100644 --- a/tempest/api/object_storage/test_crossdomain.py +++ b/tempest/api/object_storage/test_crossdomain.py @@ -14,8 +14,8 @@ from tempest.api.object_storage import base from tempest.common import custom_matchers +from tempest.common import utils from tempest.lib import decorators -from tempest import test class CrossdomainTest(base.BaseObjectTest): @@ -38,7 +38,7 @@ class CrossdomainTest(base.BaseObjectTest): self.account_client.skip_path() @decorators.idempotent_id('d1b8b031-b622-4010-82f9-ff78a9e915c7') - @test.requires_ext(extension='crossdomain', service='object') + @utils.requires_ext(extension='crossdomain', service='object') def test_get_crossdomain_policy(self): resp, body = self.account_client.get("crossdomain.xml", {}) body = body.decode() diff --git a/tempest/api/object_storage/test_object_formpost.py b/tempest/api/object_storage/test_object_formpost.py index 3a2233a6ef..cd834bf488 100644 --- a/tempest/api/object_storage/test_object_formpost.py +++ b/tempest/api/object_storage/test_object_formpost.py @@ -19,9 +19,9 @@ import time from six.moves.urllib import parse as urlparse from tempest.api.object_storage import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test class ObjectFormPostTest(base.BaseObjectTest): @@ -108,7 +108,7 @@ class ObjectFormPostTest(base.BaseObjectTest): return body, content_type @decorators.idempotent_id('80fac02b-6e54-4f7b-be0d-a965b5cbef76') - @test.requires_ext(extension='formpost', service='object') + @utils.requires_ext(extension='formpost', service='object') def test_post_object_using_form(self): body, content_type = self.get_multipart_form() diff --git a/tempest/api/object_storage/test_object_formpost_negative.py b/tempest/api/object_storage/test_object_formpost_negative.py index c56d91a005..df6a0fda48 100644 --- a/tempest/api/object_storage/test_object_formpost_negative.py +++ b/tempest/api/object_storage/test_object_formpost_negative.py @@ -19,10 +19,10 @@ import time from six.moves.urllib import parse as urlparse from tempest.api.object_storage import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class ObjectFormPostNegativeTest(base.BaseObjectTest): @@ -109,7 +109,7 @@ class ObjectFormPostNegativeTest(base.BaseObjectTest): return body, content_type @decorators.idempotent_id('d3fb3c4d-e627-48ce-9379-a1631f21336d') - @test.requires_ext(extension='formpost', service='object') + @utils.requires_ext(extension='formpost', service='object') @decorators.attr(type=['negative']) def test_post_object_using_form_expired(self): body, content_type = self.get_multipart_form(expires=1) @@ -126,7 +126,7 @@ class ObjectFormPostNegativeTest(base.BaseObjectTest): self.assertIn('FormPost: Form Expired', str(exc)) @decorators.idempotent_id('b277257f-113c-4499-b8d1-5fead79f7360') - @test.requires_ext(extension='formpost', service='object') + @utils.requires_ext(extension='formpost', service='object') @decorators.attr(type=['negative']) def test_post_object_using_form_invalid_signature(self): self.key = "Wrong" diff --git a/tempest/api/object_storage/test_object_slo.py b/tempest/api/object_storage/test_object_slo.py index 894e42d5b0..65da63dcba 100644 --- a/tempest/api/object_storage/test_object_slo.py +++ b/tempest/api/object_storage/test_object_slo.py @@ -18,10 +18,10 @@ from oslo_serialization import jsonutils as json from tempest.api.object_storage import base from tempest.common import custom_matchers +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import test_utils from tempest.lib import decorators -from tempest import test # Each segment, except for the final one, must be at least 1 megabyte MIN_SEGMENT_SIZE = 1024 * 1024 @@ -107,7 +107,7 @@ class ObjectSloTest(base.BaseObjectTest): self.assertHeaders(resp, 'Object', method) @decorators.idempotent_id('2c3f24a6-36e8-4711-9aa2-800ee1fc7b5b') - @test.requires_ext(extension='slo', service='object') + @utils.requires_ext(extension='slo', service='object') def test_upload_manifest(self): # create static large object from multipart manifest manifest = self._create_manifest() @@ -122,7 +122,7 @@ class ObjectSloTest(base.BaseObjectTest): self._assertHeadersSLO(resp, 'PUT') @decorators.idempotent_id('e69ad766-e1aa-44a2-bdd2-bf62c09c1456') - @test.requires_ext(extension='slo', service='object') + @utils.requires_ext(extension='slo', service='object') def test_list_large_object_metadata(self): # list static large object metadata using multipart manifest object_name = self._create_large_object() @@ -134,7 +134,7 @@ class ObjectSloTest(base.BaseObjectTest): self._assertHeadersSLO(resp, 'HEAD') @decorators.idempotent_id('49bc49bc-dd1b-4c0f-904e-d9f10b830ee8') - @test.requires_ext(extension='slo', service='object') + @utils.requires_ext(extension='slo', service='object') def test_retrieve_large_object(self): # list static large object using multipart manifest object_name = self._create_large_object() @@ -149,7 +149,7 @@ class ObjectSloTest(base.BaseObjectTest): self.assertEqual(body, sum_data) @decorators.idempotent_id('87b6dfa1-abe9-404d-8bf0-6c3751e6aa77') - @test.requires_ext(extension='slo', service='object') + @utils.requires_ext(extension='slo', service='object') def test_delete_large_object(self): # delete static large object using multipart manifest object_name = self._create_large_object() diff --git a/tempest/api/object_storage/test_object_temp_url.py b/tempest/api/object_storage/test_object_temp_url.py index 217dead364..b99f93a40c 100644 --- a/tempest/api/object_storage/test_object_temp_url.py +++ b/tempest/api/object_storage/test_object_temp_url.py @@ -19,9 +19,9 @@ import time from six.moves.urllib import parse as urlparse from tempest.api.object_storage import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test class ObjectTempUrlTest(base.BaseObjectTest): @@ -88,7 +88,7 @@ class ObjectTempUrlTest(base.BaseObjectTest): return url @decorators.idempotent_id('f91c96d4-1230-4bba-8eb9-84476d18d991') - @test.requires_ext(extension='tempurl', service='object') + @utils.requires_ext(extension='tempurl', service='object') def test_get_object_using_temp_url(self): expires = self._get_expiry_date() @@ -107,7 +107,7 @@ class ObjectTempUrlTest(base.BaseObjectTest): self.assertHeaders(resp, 'Object', 'HEAD') @decorators.idempotent_id('671f9583-86bd-4128-a034-be282a68c5d8') - @test.requires_ext(extension='tempurl', service='object') + @utils.requires_ext(extension='tempurl', service='object') def test_get_object_using_temp_url_key_2(self): key2 = 'Meta2-' metadata = {'Temp-URL-Key-2': key2} @@ -132,7 +132,7 @@ class ObjectTempUrlTest(base.BaseObjectTest): self.assertEqual(body, self.content) @decorators.idempotent_id('9b08dade-3571-4152-8a4f-a4f2a873a735') - @test.requires_ext(extension='tempurl', service='object') + @utils.requires_ext(extension='tempurl', service='object') def test_put_object_using_temp_url(self): new_data = data_utils.random_bytes(size=len(self.object_name)) @@ -158,7 +158,7 @@ class ObjectTempUrlTest(base.BaseObjectTest): self.assertEqual(body, new_data) @decorators.idempotent_id('249a0111-5ad3-4534-86a7-1993d55f9185') - @test.requires_ext(extension='tempurl', service='object') + @utils.requires_ext(extension='tempurl', service='object') def test_head_object_using_temp_url(self): expires = self._get_expiry_date() @@ -172,7 +172,7 @@ class ObjectTempUrlTest(base.BaseObjectTest): self.assertHeaders(resp, 'Object', 'HEAD') @decorators.idempotent_id('9d9cfd90-708b-465d-802c-e4a8090b823d') - @test.requires_ext(extension='tempurl', service='object') + @utils.requires_ext(extension='tempurl', service='object') def test_get_object_using_temp_url_with_inline_query_parameter(self): expires = self._get_expiry_date() diff --git a/tempest/api/object_storage/test_object_temp_url_negative.py b/tempest/api/object_storage/test_object_temp_url_negative.py index c7d1fd5ab2..17ae6c10bd 100644 --- a/tempest/api/object_storage/test_object_temp_url_negative.py +++ b/tempest/api/object_storage/test_object_temp_url_negative.py @@ -19,10 +19,10 @@ import time from six.moves.urllib import parse as urlparse from tempest.api.object_storage import base +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class ObjectTempUrlNegativeTest(base.BaseObjectTest): @@ -94,7 +94,7 @@ class ObjectTempUrlNegativeTest(base.BaseObjectTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('5a583aca-c804-41ba-9d9a-e7be132bdf0b') - @test.requires_ext(extension='tempurl', service='object') + @utils.requires_ext(extension='tempurl', service='object') def test_get_object_after_expiration_time(self): expires = self._get_expiry_date(1) diff --git a/tempest/api/volume/admin/test_volumes_actions.py b/tempest/api/volume/admin/test_volumes_actions.py index b81a477a61..f99e03d0ff 100644 --- a/tempest/api/volume/admin/test_volumes_actions.py +++ b/tempest/api/volume/admin/test_volumes_actions.py @@ -14,10 +14,10 @@ # under the License. from tempest.api.volume import base +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -67,7 +67,7 @@ class VolumesActionsTest(base.BaseVolumeAdminTest): self._create_reset_and_force_delete_temp_volume('maintenance') @decorators.idempotent_id('d38285d9-929d-478f-96a5-00e66a115b81') - @test.services('compute') + @utils.services('compute') def test_force_detach_volume(self): # Create a server and a volume server_id = self.create_server()['id'] diff --git a/tempest/api/volume/test_image_metadata.py b/tempest/api/volume/test_image_metadata.py index 129981b61e..53b3acc20f 100644 --- a/tempest/api/volume/test_image_metadata.py +++ b/tempest/api/volume/test_image_metadata.py @@ -16,9 +16,9 @@ from testtools import matchers from tempest.api.volume import base +from tempest.common import utils from tempest import config from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -39,7 +39,7 @@ class VolumesImageMetadata(base.BaseVolumeTest): cls.volume = cls.create_volume(imageRef=CONF.compute.image_ref) @decorators.idempotent_id('03efff0b-5c75-4822-8f10-8789ac15b13e') - @test.services('image') + @utils.services('image') def test_update_show_delete_image_metadata(self): # Update image metadata image_metadata = {'image_id': '5137a025-3c5f-43c1-bc64-5f41270040a5', diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py index c4d10c3d1a..eea65f1cd9 100644 --- a/tempest/api/volume/test_volumes_actions.py +++ b/tempest/api/volume/test_volumes_actions.py @@ -14,12 +14,12 @@ # under the License. from tempest.api.volume import base +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import test_utils from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -35,7 +35,7 @@ class VolumesActionsTest(base.BaseVolumeTest): @decorators.idempotent_id('fff42874-7db5-4487-a8e1-ddda5fb5288d') @decorators.attr(type='smoke') - @test.services('compute') + @utils.services('compute') def test_attach_detach_volume_to_instance(self): # Create a server server = self.create_server() @@ -66,7 +66,7 @@ class VolumesActionsTest(base.BaseVolumeTest): fetched_volume['bootable']) @decorators.idempotent_id('9516a2c8-9135-488c-8dd6-5677a7e5f371') - @test.services('compute') + @utils.services('compute') def test_get_volume_attachment(self): # Create a server server = self.create_server() @@ -94,7 +94,7 @@ class VolumesActionsTest(base.BaseVolumeTest): self.assertEqual(self.volume['id'], attachment['volume_id']) @decorators.idempotent_id('d8f1ca95-3d5b-44a3-b8ca-909691c9532d') - @test.services('image') + @utils.services('image') def test_volume_upload(self): # NOTE(gfidente): the volume uploaded in Glance comes from setUpClass, # it is shared with the other tests. After it is uploaded in Glance, diff --git a/tempest/api/volume/test_volumes_backup.py b/tempest/api/volume/test_volumes_backup.py index 1f91db67d3..f2d880149d 100644 --- a/tempest/api/volume/test_volumes_backup.py +++ b/tempest/api/volume/test_volumes_backup.py @@ -17,11 +17,11 @@ import testtools from testtools import matchers from tempest.api.volume import base +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -97,7 +97,7 @@ class VolumesBackupsTest(base.BaseVolumeTest): matchers.ContainsAll(metadata.items())) @decorators.idempotent_id('07af8f6d-80af-44c9-a5dc-c8427b1b62e6') - @test.services('compute') + @utils.services('compute') def test_backup_create_attached_volume(self): """Test backup create using force flag. @@ -119,7 +119,7 @@ class VolumesBackupsTest(base.BaseVolumeTest): self.assertEqual(backup_name, backup['name']) @decorators.idempotent_id('2a8ba340-dff2-4511-9db7-646f07156b15') - @test.services('image') + @utils.services('image') def test_bootable_volume_backup_and_restore(self): # Create volume from image img_uuid = CONF.compute.image_ref diff --git a/tempest/api/volume/test_volumes_clone.py b/tempest/api/volume/test_volumes_clone.py index 927bfa5a26..ea39a21c79 100644 --- a/tempest/api/volume/test_volumes_clone.py +++ b/tempest/api/volume/test_volumes_clone.py @@ -14,9 +14,9 @@ # under the License. from tempest.api.volume import base +from tempest.common import utils from tempest import config from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -56,7 +56,7 @@ class VolumesCloneTest(base.BaseVolumeTest): self._verify_volume_clone(src_vol, dst_vol, extra_size=1) @decorators.idempotent_id('cbbcd7c6-5a6c-481a-97ac-ca55ab715d16') - @test.services('image') + @utils.services('image') def test_create_from_bootable_volume(self): # Create volume from image img_uuid = CONF.compute.image_ref diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py index ec9a0dd9fd..71db95cbed 100644 --- a/tempest/api/volume/test_volumes_get.py +++ b/tempest/api/volume/test_volumes_get.py @@ -17,11 +17,11 @@ import testtools from testtools import matchers from tempest.api.volume import base +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -122,7 +122,7 @@ class VolumesGetTest(base.BaseVolumeTest): @decorators.attr(type='smoke') @decorators.idempotent_id('54a01030-c7fc-447c-86ee-c1182beae638') - @test.services('image') + @utils.services('image') def test_volume_create_get_update_delete_from_image(self): image = self.images_client.show_image(CONF.compute.image_ref) min_disk = image['min_disk'] diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py index 4e19e620fd..7d745f20ca 100644 --- a/tempest/api/volume/test_volumes_negative.py +++ b/tempest/api/volume/test_volumes_negative.py @@ -16,13 +16,13 @@ import six from tempest.api.volume import base +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import test_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -168,7 +168,7 @@ class VolumesNegativeTest(base.BaseVolumeTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('f5e56b0a-5d02-43c1-a2a7-c9b792c2e3f6') - @test.services('compute') + @utils.services('compute') def test_attach_volumes_with_nonexistent_volume_id(self): server = self.create_server() @@ -292,7 +292,7 @@ class VolumesNegativeTest(base.BaseVolumeTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('5b810c91-0ad1-47ce-aee8-615f789be78f') - @test.services('image') + @utils.services('image') def test_create_volume_from_image_with_decreasing_size(self): # Create image image = self.create_image() @@ -307,7 +307,7 @@ class VolumesNegativeTest(base.BaseVolumeTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('d15e7f35-2cfc-48c8-9418-c8223a89bcbb') - @test.services('image') + @utils.services('image') def test_create_volume_from_deactivated_image(self): # Create image image = self.create_image() diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py index e68ab7e2a2..dcd351864e 100644 --- a/tempest/api/volume/test_volumes_snapshots.py +++ b/tempest/api/volume/test_volumes_snapshots.py @@ -14,11 +14,11 @@ import testtools from testtools import matchers from tempest.api.volume import base +from tempest.common import utils from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -37,7 +37,7 @@ class VolumesSnapshotTestJSON(base.BaseVolumeTest): cls.volume_origin = cls.create_volume() @decorators.idempotent_id('8567b54c-4455-446d-a1cf-651ddeaa3ff2') - @test.services('compute') + @utils.services('compute') def test_snapshot_create_delete_with_volume_in_use(self): # Create a test instance server = self.create_server() @@ -59,7 +59,7 @@ class VolumesSnapshotTestJSON(base.BaseVolumeTest): self.delete_snapshot(snapshot2['id']) @decorators.idempotent_id('5210a1de-85a0-11e6-bb21-641c676a5d61') - @test.services('compute') + @utils.services('compute') def test_snapshot_create_offline_delete_online(self): # Create a snapshot while it is not attached diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py index c3222138c2..c75bc859c3 100644 --- a/tempest/cmd/cleanup_service.py +++ b/tempest/cmd/cleanup_service.py @@ -19,9 +19,9 @@ from oslo_log import log as logging from tempest import clients from tempest.common import credentials_factory as credentials from tempest.common import identity +from tempest.common import utils from tempest.common.utils import net_info from tempest import config -from tempest import test LOG = logging.getLogger(__name__) CONF = config.CONF @@ -964,7 +964,7 @@ def get_tenant_cleanup_services(): tenant_services.append(StackService) if IS_NEUTRON: tenant_services.append(NetworkFloatingIpService) - if test.is_extension_enabled('metering', 'network'): + if utils.is_extension_enabled('metering', 'network'): tenant_services.append(NetworkMeteringLabelRuleService) tenant_services.append(NetworkMeteringLabelService) tenant_services.append(NetworkRouterService) diff --git a/tempest/common/utils/__init__.py b/tempest/common/utils/__init__.py index 84e31d0d4a..5a86caaee7 100644 --- a/tempest/common/utils/__init__.py +++ b/tempest/common/utils/__init__.py @@ -12,10 +12,16 @@ # License for the specific language governing permissions and limitations # under the License. +import functools from functools import partial +import testtools + from tempest import config +from tempest.exceptions import InvalidServiceTag from tempest.lib.common.utils import data_utils as lib_data_utils +from tempest.lib import decorators + CONF = config.CONF @@ -36,3 +42,89 @@ class DataUtils(object): return attr_obj data_utils = DataUtils() + + +def get_service_list(): + service_list = { + 'compute': CONF.service_available.nova, + 'image': CONF.service_available.glance, + 'volume': CONF.service_available.cinder, + # NOTE(masayukig): We have two network services which are neutron and + # nova-network. And we have no way to know whether nova-network is + # available or not. After the pending removal of nova-network from + # nova, we can treat the network/neutron case in the same manner as + # the other services. + 'network': True, + # NOTE(masayukig): Tempest tests always require the identity service. + # So we should set this True here. + 'identity': True, + 'object_storage': CONF.service_available.swift, + } + return service_list + + +def services(*args): + """A decorator used to set an attr for each service used in a test case + + This decorator applies a testtools attr for each service that gets + exercised by a test case. + """ + def decorator(f): + known_services = get_service_list() + + for service in args: + if service not in known_services: + raise InvalidServiceTag('%s is not a valid service' % service) + decorators.attr(type=list(args))(f) + + @functools.wraps(f) + def wrapper(self, *func_args, **func_kwargs): + service_list = get_service_list() + + for service in args: + if not service_list[service]: + msg = 'Skipped because the %s service is not available' % ( + service) + raise testtools.TestCase.skipException(msg) + return f(self, *func_args, **func_kwargs) + return wrapper + return decorator + + +def requires_ext(**kwargs): + """A decorator to skip tests if an extension is not enabled + + @param extension + @param service + """ + def decorator(func): + @functools.wraps(func) + def wrapper(*func_args, **func_kwargs): + if not is_extension_enabled(kwargs['extension'], + kwargs['service']): + msg = "Skipped because %s extension: %s is not enabled" % ( + kwargs['service'], kwargs['extension']) + raise testtools.TestCase.skipException(msg) + return func(*func_args, **func_kwargs) + return wrapper + return decorator + + +def is_extension_enabled(extension_name, service): + """A function that will check the list of enabled extensions from config + + """ + config_dict = { + 'compute': CONF.compute_feature_enabled.api_extensions, + 'volume': CONF.volume_feature_enabled.api_extensions, + 'network': CONF.network_feature_enabled.api_extensions, + 'object': CONF.object_storage_feature_enabled.discoverable_apis, + 'identity': CONF.identity_feature_enabled.api_extensions + } + if not config_dict[service]: + return False + if config_dict[service][0] == 'all': + return True + if extension_name in config_dict[service]: + return True + return False diff --git a/tempest/exceptions.py b/tempest/exceptions.py index b5b2d71cfb..a8a6ff0730 100644 --- a/tempest/exceptions.py +++ b/tempest/exceptions.py @@ -54,3 +54,7 @@ class ServerUnreachable(exceptions.TempestException): class RFCViolation(exceptions.RestClientException): message = "RFC Violation" + + +class InvalidServiceTag(exceptions.TempestException): + message = "Invalid service tag" diff --git a/tempest/lib/common/dynamic_creds.py b/tempest/lib/common/dynamic_creds.py index 90e67b4d49..9a6c8f510c 100644 --- a/tempest/lib/common/dynamic_creds.py +++ b/tempest/lib/common/dynamic_creds.py @@ -451,7 +451,7 @@ class DynamicCredentialProvider(cred_provider.CredentialProvider): creds.username) # NOTE(zhufl): Only when neutron's security_group ext is # enabled, _cleanup_default_secgroup will not raise error. But - # here cannot use test.is_extension_enabled for it will cause + # here cannot use test_utils.is_extension_enabled for it will cause # "circular dependency". So here just use try...except to # ensure tenant deletion without big changes. try: diff --git a/tempest/scenario/test_aggregates_basic_ops.py b/tempest/scenario/test_aggregates_basic_ops.py index 25227be747..9ff6227c3b 100644 --- a/tempest/scenario/test_aggregates_basic_ops.py +++ b/tempest/scenario/test_aggregates_basic_ops.py @@ -14,10 +14,10 @@ # under the License. from tempest.common import tempest_fixtures as fixtures +from tempest.common import utils from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.scenario import manager -from tempest import test class TestAggregatesBasicOps(manager.ScenarioTest): @@ -97,7 +97,7 @@ class TestAggregatesBasicOps(manager.ScenarioTest): @decorators.idempotent_id('cb2b4c4f-0c7c-4164-bdde-6285b302a081') @decorators.attr(type='slow') - @test.services('compute') + @utils.services('compute') def test_aggregate_basic_ops(self): self.useFixture(fixtures.LockFixture('availability_zone')) az = 'foo_zone' diff --git a/tempest/scenario/test_encrypted_cinder_volumes.py b/tempest/scenario/test_encrypted_cinder_volumes.py index cbdf30766c..b5220e9a4c 100644 --- a/tempest/scenario/test_encrypted_cinder_volumes.py +++ b/tempest/scenario/test_encrypted_cinder_volumes.py @@ -13,10 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. +from tempest.common import utils from tempest import config from tempest.lib import decorators from tempest.scenario import manager -from tempest import test CONF = config.CONF @@ -54,7 +54,7 @@ class TestEncryptedCinderVolumes(manager.EncryptionScenarioTest): @decorators.idempotent_id('79165fb4-5534-4b9d-8429-97ccffb8f86e') @decorators.attr(type='slow') - @test.services('compute', 'volume', 'image') + @utils.services('compute', 'volume', 'image') def test_encrypted_cinder_volumes_luks(self): server = self.launch_instance() volume = self.create_encrypted_volume('nova.volume.encryptors.' @@ -64,7 +64,7 @@ class TestEncryptedCinderVolumes(manager.EncryptionScenarioTest): @decorators.idempotent_id('cbc752ed-b716-4717-910f-956cce965722') @decorators.attr(type='slow') - @test.services('compute', 'volume', 'image') + @utils.services('compute', 'volume', 'image') def test_encrypted_cinder_volumes_cryptsetup(self): server = self.launch_instance() volume = self.create_encrypted_volume('nova.volume.encryptors.' diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py index 26a834b942..29f17430fa 100644 --- a/tempest/scenario/test_minimum_basic.py +++ b/tempest/scenario/test_minimum_basic.py @@ -16,13 +16,13 @@ import testtools from tempest.common import custom_matchers +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib.common.utils import test_utils from tempest.lib import decorators from tempest.lib import exceptions from tempest.scenario import manager -from tempest import test CONF = config.CONF @@ -105,7 +105,7 @@ class TestMinimumBasicScenario(manager.ScenarioTest): 'The public_network_id option must be specified.') @testtools.skipUnless(CONF.network_feature_enabled.floating_ips, 'Floating ips are not available') - @test.services('compute', 'volume', 'image', 'network') + @utils.services('compute', 'volume', 'image', 'network') def test_minimum_basic_scenario(self): image = self.glance_image_create() keypair = self.create_keypair() diff --git a/tempest/scenario/test_network_advanced_server_ops.py b/tempest/scenario/test_network_advanced_server_ops.py index c8add8b61a..340c3c997a 100644 --- a/tempest/scenario/test_network_advanced_server_ops.py +++ b/tempest/scenario/test_network_advanced_server_ops.py @@ -15,11 +15,11 @@ import testtools +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib import decorators from tempest.scenario import manager -from tempest import test CONF = config.CONF @@ -59,7 +59,7 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest): def _setup_server(self, keypair): security_groups = [] - if test.is_extension_enabled('security-group', 'network'): + if utils.is_extension_enabled('security-group', 'network'): security_group = self._create_security_group() security_groups = [{'name': security_group['name']}] network, _, _ = self.create_networks() @@ -107,7 +107,7 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest): @decorators.idempotent_id('61f1aa9a-1573-410e-9054-afa557cab021') @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_server_connectivity_stop_start(self): keypair = self.create_keypair() server = self._setup_server(keypair) @@ -122,7 +122,7 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest): server, keypair, floating_ip) @decorators.idempotent_id('7b6860c2-afa3-4846-9522-adeb38dfbe08') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_server_connectivity_reboot(self): keypair = self.create_keypair() server = self._setup_server(keypair) @@ -133,7 +133,7 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest): @decorators.idempotent_id('88a529c2-1daa-4c85-9aec-d541ba3eb699') @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_server_connectivity_rebuild(self): keypair = self.create_keypair() server = self._setup_server(keypair) @@ -148,7 +148,7 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest): @testtools.skipUnless(CONF.compute_feature_enabled.pause, 'Pause is not available.') @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_server_connectivity_pause_unpause(self): keypair = self.create_keypair() server = self._setup_server(keypair) @@ -166,7 +166,7 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest): @testtools.skipUnless(CONF.compute_feature_enabled.suspend, 'Suspend is not available.') @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_server_connectivity_suspend_resume(self): keypair = self.create_keypair() server = self._setup_server(keypair) @@ -184,7 +184,7 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest): @testtools.skipUnless(CONF.compute_feature_enabled.resize, 'Resize is not available.') @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_server_connectivity_resize(self): resize_flavor = CONF.compute.flavor_ref_alt keypair = self.create_keypair() @@ -205,7 +205,7 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest): 'Less than 2 compute nodes, skipping multinode ' 'tests.') @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_server_connectivity_cold_migration(self): keypair = self.create_keypair() server = self._setup_server(keypair) @@ -231,7 +231,7 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest): 'Less than 2 compute nodes, skipping multinode ' 'tests.') @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_server_connectivity_cold_migration_revert(self): keypair = self.create_keypair() server = self._setup_server(keypair) diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py index 48ddac6842..2d38b06d83 100644 --- a/tempest/scenario/test_network_basic_ops.py +++ b/tempest/scenario/test_network_basic_ops.py @@ -19,13 +19,13 @@ import re from oslo_log import log as logging import testtools +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib.common.utils import test_utils from tempest.lib import decorators from tempest.lib import exceptions from tempest.scenario import manager -from tempest import test CONF = config.CONF LOG = logging.getLogger(__name__) @@ -87,7 +87,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest): 'public_network_id must be defined.') raise cls.skipException(msg) for ext in ['router', 'security-group']: - if not test.is_extension_enabled(ext, 'network'): + if not utils.is_extension_enabled(ext, 'network'): msg = "%s extension not enabled." % ext raise cls.skipException(msg) if not CONF.network_feature_enabled.floating_ips: @@ -357,7 +357,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest): @decorators.attr(type='smoke') @decorators.idempotent_id('f323b3ba-82f8-4db7-8ea6-6a895869ec49') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_network_basic_ops(self): """Basic network operation test @@ -409,10 +409,10 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest): "floating ip") @decorators.idempotent_id('b158ea55-472e-4086-8fa9-c64ac0c6c1d0') - @testtools.skipUnless(test.is_extension_enabled('net-mtu', 'network'), + @testtools.skipUnless(utils.is_extension_enabled('net-mtu', 'network'), 'No way to calculate MTU for networks') @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_mtu_sized_frames(self): """Validate that network MTU sized frames fit through.""" self._setup_network_and_servers() @@ -425,7 +425,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest): 'multitenant network environment') @decorators.skip_because(bug="1610994") @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_connectivity_between_vms_on_different_networks(self): """Test connectivity between VMs on different networks @@ -479,7 +479,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest): @testtools.skipIf(CONF.network.port_vnic_type in ['direct', 'macvtap'], 'NIC hotplug not supported for ' 'vnic_type direct or macvtap') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_hotplug_nic(self): """Test hotplug network interface @@ -501,7 +501,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest): 'Router state can be altered only with multitenant ' 'networks capabilities') @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_update_router_admin_state(self): """Test to update admin state up of router @@ -535,7 +535,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest): @testtools.skipUnless(CONF.scenario.dhcp_client, "DHCP client is not available.") @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_subnet_details(self): """Tests that subnet's extra configuration details are affecting VMs. @@ -619,7 +619,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest): "Changing a port's admin state is not supported " "by the test environment") @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_update_instance_port_admin_state(self): """Test to update admin_state_up attribute of instance port @@ -666,7 +666,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest): @decorators.idempotent_id('759462e1-8535-46b0-ab3a-33aa45c55aaa') @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_preserve_preexisting_port(self): """Test preserve pre-existing port @@ -715,10 +715,10 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest): 'server %s.' % server['id']) self.assertEqual(port['id'], port_list[0]['id']) - @test.requires_ext(service='network', extension='l3_agent_scheduler') + @utils.requires_ext(service='network', extension='l3_agent_scheduler') @decorators.idempotent_id('2e788c46-fb3f-4ac9-8f82-0561555bea73') @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_router_rescheduling(self): """Tests that router can be removed from agent and add to a new agent. @@ -793,12 +793,12 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest): should_connect=True, msg='After router rescheduling') - @test.requires_ext(service='network', extension='port-security') + @utils.requires_ext(service='network', extension='port-security') @testtools.skipUnless(CONF.compute_feature_enabled.interface_attach, 'NIC hotplug not available') @decorators.idempotent_id('7c0bb1a2-d053-49a4-98f9-ca1a1d849f63') @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_port_security_macspoofing_port(self): """Tests port_security extension enforces mac spoofing diff --git a/tempest/scenario/test_network_v6.py b/tempest/scenario/test_network_v6.py index bf26c2ef8e..b687aa08b0 100644 --- a/tempest/scenario/test_network_v6.py +++ b/tempest/scenario/test_network_v6.py @@ -14,11 +14,11 @@ # under the License. import functools +from tempest.common import utils from tempest import config from tempest.lib.common.utils import test_utils from tempest.lib import decorators from tempest.scenario import manager -from tempest import test CONF = config.CONF @@ -210,49 +210,49 @@ class TestGettingAddress(manager.NetworkScenarioTest): @decorators.attr(type='slow') @decorators.idempotent_id('2c92df61-29f0-4eaa-bee3-7c65bef62a43') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_slaac_from_os(self): self._prepare_and_test(address6_mode='slaac') @decorators.attr(type='slow') @decorators.idempotent_id('d7e1f858-187c-45a6-89c9-bdafde619a9f') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_dhcp6_stateless_from_os(self): self._prepare_and_test(address6_mode='dhcpv6-stateless') @decorators.attr(type='slow') @decorators.idempotent_id('7ab23f41-833b-4a16-a7c9-5b42fe6d4123') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_multi_prefix_dhcpv6_stateless(self): self._prepare_and_test(address6_mode='dhcpv6-stateless', n_subnets6=2) @decorators.attr(type='slow') @decorators.idempotent_id('dec222b1-180c-4098-b8c5-cc1b8342d611') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_multi_prefix_slaac(self): self._prepare_and_test(address6_mode='slaac', n_subnets6=2) @decorators.attr(type='slow') @decorators.idempotent_id('b6399d76-4438-4658-bcf5-0d6c8584fde2') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_dualnet_slaac_from_os(self): self._prepare_and_test(address6_mode='slaac', dualnet=True) @decorators.attr(type='slow') @decorators.idempotent_id('76f26acd-9688-42b4-bc3e-cd134c4cb09e') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_dualnet_dhcp6_stateless_from_os(self): self._prepare_and_test(address6_mode='dhcpv6-stateless', dualnet=True) @decorators.attr(type='slow') @decorators.idempotent_id('cf1c4425-766b-45b8-be35-e2959728eb00') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_dualnet_multi_prefix_dhcpv6_stateless(self): self._prepare_and_test(address6_mode='dhcpv6-stateless', n_subnets6=2, dualnet=True) @decorators.idempotent_id('9178ad42-10e4-47e9-8987-e02b170cc5cd') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_dualnet_multi_prefix_slaac(self): self._prepare_and_test(address6_mode='slaac', n_subnets6=2, dualnet=True) diff --git a/tempest/scenario/test_object_storage_basic_ops.py b/tempest/scenario/test_object_storage_basic_ops.py index 25e9f5c56a..da0b1e84f7 100644 --- a/tempest/scenario/test_object_storage_basic_ops.py +++ b/tempest/scenario/test_object_storage_basic_ops.py @@ -13,14 +13,14 @@ # License for the specific language governing permissions and limitations # under the License. +from tempest.common import utils from tempest.lib import decorators from tempest.scenario import manager -from tempest import test class TestObjectStorageBasicOps(manager.ObjectStorageScenarioTest): @decorators.idempotent_id('b920faf1-7b8a-4657-b9fe-9c4512bfb381') - @test.services('object_storage') + @utils.services('object_storage') def test_swift_basic_ops(self): """Test swift basic ops. @@ -47,7 +47,7 @@ class TestObjectStorageBasicOps(manager.ObjectStorageScenarioTest): @decorators.idempotent_id('916c7111-cb1f-44b2-816d-8f760e4ea910') @decorators.attr(type='slow') - @test.services('object_storage') + @utils.services('object_storage') def test_swift_acl_anonymous_download(self): """This test will cover below steps: diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py index 51716e83b6..e39afe0212 100644 --- a/tempest/scenario/test_security_groups_basic_ops.py +++ b/tempest/scenario/test_security_groups_basic_ops.py @@ -16,12 +16,12 @@ from oslo_log import log import testtools from tempest.common import compute +from tempest.common import utils from tempest.common.utils import net_info from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.scenario import manager -from tempest import test CONF = config.CONF LOG = log.getLogger(__name__) @@ -142,7 +142,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): msg = ('Either project_networks_reachable must be "true", or ' 'public_network_id must be defined.') raise cls.skipException(msg) - if not test.is_extension_enabled('security-group', 'network'): + if not utils.is_extension_enabled('security-group', 'network'): msg = "security-group extension not enabled." raise cls.skipException(msg) if CONF.network.shared_physical_network: @@ -471,7 +471,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): servers=[tenant.access_point], client=client) @decorators.idempotent_id('e79f879e-debb-440c-a7e4-efeda05b6848') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_cross_tenant_traffic(self): if not self.credentials_provider.is_multi_tenant(): raise self.skipException("No secondary tenant defined") @@ -491,7 +491,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): raise @decorators.idempotent_id('63163892-bbf6-4249-aa12-d5ea1f8f421b') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_in_tenant_traffic(self): try: self._create_tenant_servers(self.primary_tenant, num=1) @@ -505,7 +505,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): @decorators.idempotent_id('f4d556d7-1526-42ad-bafb-6bebf48568f6') @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_port_update_new_security_group(self): """Verifies the traffic after updating the vm port @@ -559,7 +559,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): @decorators.idempotent_id('d2f77418-fcc4-439d-b935-72eca704e293') @decorators.attr(type='slow') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_multiple_security_groups(self): """Verify multiple security groups and checks that rules @@ -591,9 +591,9 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): should_connect=True) @decorators.attr(type='slow') - @test.requires_ext(service='network', extension='port-security') + @utils.requires_ext(service='network', extension='port-security') @decorators.idempotent_id('7c811dcc-263b-49a3-92d2-1b4d8405f50c') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_port_security_disable_security_group(self): """Verify the default security group rules is disabled.""" new_tenant = self.primary_tenant @@ -631,7 +631,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): raise @decorators.attr(type='slow') - @test.requires_ext(service='network', extension='port-security') + @utils.requires_ext(service='network', extension='port-security') @decorators.idempotent_id('13ccf253-e5ad-424b-9c4a-97b88a026699') # TODO(mriedem): We shouldn't actually need to check this since neutron # disables the port_security extension by default, but the problem is nova @@ -641,7 +641,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): @testtools.skipUnless( CONF.network_feature_enabled.port_security, 'Port security must be enabled.') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_boot_into_disabled_port_security_network_without_secgroup(self): tenant = self.primary_tenant self._create_tenant_network(tenant, port_security_enabled=False) diff --git a/tempest/scenario/test_server_advanced_ops.py b/tempest/scenario/test_server_advanced_ops.py index 6d6318caae..d4f29ad07a 100644 --- a/tempest/scenario/test_server_advanced_ops.py +++ b/tempest/scenario/test_server_advanced_ops.py @@ -16,11 +16,11 @@ from oslo_log import log as logging import testtools +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib import decorators from tempest.scenario import manager -from tempest import test CONF = config.CONF @@ -45,7 +45,7 @@ class TestServerAdvancedOps(manager.ScenarioTest): @decorators.idempotent_id('e6c28180-7454-4b59-b188-0257af08a63b') @testtools.skipUnless(CONF.compute_feature_enabled.resize, 'Resize is not available.') - @test.services('compute', 'volume') + @utils.services('compute', 'volume') def test_resize_volume_backed_server_confirm(self): # We create an instance for use in this test instance = self.create_server(volume_backed=True) @@ -67,7 +67,7 @@ class TestServerAdvancedOps(manager.ScenarioTest): @decorators.idempotent_id('949da7d5-72c8-4808-8802-e3d70df98e2c') @testtools.skipUnless(CONF.compute_feature_enabled.suspend, 'Suspend is not available.') - @test.services('compute') + @utils.services('compute') def test_server_sequence_suspend_resume(self): # We create an instance for use in this test instance_id = self.create_server()['id'] diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py index 0c441ab416..d5c378eeef 100644 --- a/tempest/scenario/test_server_basic_ops.py +++ b/tempest/scenario/test_server_basic_ops.py @@ -16,6 +16,7 @@ import json import re +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib.common.utils import data_utils @@ -23,7 +24,6 @@ from tempest.lib.common.utils import test_utils from tempest.lib import decorators from tempest.lib import exceptions from tempest.scenario import manager -from tempest import test CONF = config.CONF @@ -132,7 +132,7 @@ class TestServerBasicOps(manager.ScenarioTest): @decorators.idempotent_id('7fff3fb3-91d8-4fd0-bd7d-0204f1f180ba') @decorators.attr(type='smoke') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_server_basic_ops(self): keypair = self.create_keypair() security_group = self._create_security_group() diff --git a/tempest/scenario/test_server_multinode.py b/tempest/scenario/test_server_multinode.py index 552ab27c0b..fdf875c4a0 100644 --- a/tempest/scenario/test_server_multinode.py +++ b/tempest/scenario/test_server_multinode.py @@ -13,11 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. +from tempest.common import utils from tempest import config from tempest.lib import decorators from tempest.lib import exceptions from tempest.scenario import manager -from tempest import test CONF = config.CONF @@ -36,7 +36,7 @@ class TestServerMultinode(manager.ScenarioTest): @decorators.idempotent_id('9cecbe35-b9d4-48da-a37e-7ce70aa43d30') @decorators.attr(type='smoke') - @test.services('compute', 'network') + @utils.services('compute', 'network') def test_schedule_to_all_nodes(self): available_zone = \ self.os_admin.availability_zone_client.list_availability_zones( diff --git a/tempest/scenario/test_shelve_instance.py b/tempest/scenario/test_shelve_instance.py index fc04b449ae..68f18d1947 100644 --- a/tempest/scenario/test_shelve_instance.py +++ b/tempest/scenario/test_shelve_instance.py @@ -16,11 +16,11 @@ import testtools from tempest.common import compute +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib import decorators from tempest.scenario import manager -from tempest import test CONF = config.CONF @@ -78,7 +78,7 @@ class TestShelveInstance(manager.ScenarioTest): @decorators.idempotent_id('1164e700-0af0-4a4c-8792-35909a88743c') @testtools.skipUnless(CONF.network.public_network_id, 'The public_network_id option must be specified.') - @test.services('compute', 'network', 'image') + @utils.services('compute', 'network', 'image') def test_shelve_instance(self): self._create_server_then_shelve_and_unshelve() @@ -86,6 +86,6 @@ class TestShelveInstance(manager.ScenarioTest): @decorators.idempotent_id('c1b6318c-b9da-490b-9c67-9339b627271f') @testtools.skipUnless(CONF.network.public_network_id, 'The public_network_id option must be specified.') - @test.services('compute', 'volume', 'network', 'image') + @utils.services('compute', 'volume', 'network', 'image') def test_shelve_volume_backed_instance(self): self._create_server_then_shelve_and_unshelve(boot_from_volume=True) diff --git a/tempest/scenario/test_snapshot_pattern.py b/tempest/scenario/test_snapshot_pattern.py index 52767dc340..b51a7814bf 100644 --- a/tempest/scenario/test_snapshot_pattern.py +++ b/tempest/scenario/test_snapshot_pattern.py @@ -15,10 +15,10 @@ import testtools +from tempest.common import utils from tempest import config from tempest.lib import decorators from tempest.scenario import manager -from tempest import test CONF = config.CONF @@ -44,7 +44,7 @@ class TestSnapshotPattern(manager.ScenarioTest): @decorators.attr(type='slow') @testtools.skipUnless(CONF.network.public_network_id, 'The public_network_id option must be specified.') - @test.services('compute', 'network', 'image') + @utils.services('compute', 'network', 'image') def test_snapshot_pattern(self): # prepare for booting an instance keypair = self.create_keypair() diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py index 363264859c..ef369d6ff9 100644 --- a/tempest/scenario/test_stamp_pattern.py +++ b/tempest/scenario/test_stamp_pattern.py @@ -16,12 +16,12 @@ from oslo_log import log as logging import testtools +from tempest.common import utils from tempest import config from tempest.lib.common.utils import test_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc from tempest.scenario import manager -from tempest import test CONF = config.CONF LOG = logging.getLogger(__name__) @@ -76,7 +76,7 @@ class TestStampPattern(manager.ScenarioTest): 'Snapshotting is not available.') @testtools.skipUnless(CONF.network.public_network_id, 'The public_network_id option must be specified.') - @test.services('compute', 'network', 'volume', 'image') + @utils.services('compute', 'network', 'volume', 'image') def test_stamp_pattern(self): # prepare for booting an instance keypair = self.create_keypair() diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py index b6f3b38cff..64ea8f676d 100644 --- a/tempest/scenario/test_volume_boot_pattern.py +++ b/tempest/scenario/test_volume_boot_pattern.py @@ -13,12 +13,12 @@ from oslo_log import log as logging import testtools +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.scenario import manager -from tempest import test CONF = config.CONF LOG = logging.getLogger(__name__) @@ -76,7 +76,7 @@ class TestVolumeBootPattern(manager.EncryptionScenarioTest): @decorators.idempotent_id('557cd2c2-4eb8-4dce-98be-f86765ff311b') @testtools.skipUnless(CONF.network.public_network_id, 'The public_network_id option must be specified.') - @test.services('compute', 'volume', 'image') + @utils.services('compute', 'volume', 'image') def test_volume_boot_pattern(self): """This test case attempts to reproduce the following steps: @@ -156,7 +156,7 @@ class TestVolumeBootPattern(manager.EncryptionScenarioTest): @decorators.idempotent_id('05795fb2-b2a7-4c9f-8fac-ff25aedb1489') @decorators.attr(type='slow') - @test.services('compute', 'image', 'volume') + @utils.services('compute', 'image', 'volume') def test_create_server_from_volume_snapshot(self): # Create a volume from an image boot_volume = self._create_volume_from_image() @@ -192,7 +192,7 @@ class TestVolumeBootPattern(manager.EncryptionScenarioTest): created_volume_info['attachments'][0]['volume_id']) @decorators.idempotent_id('36c34c67-7b54-4b59-b188-02a2f458a63b') - @test.services('compute', 'volume', 'image') + @utils.services('compute', 'volume', 'image') def test_create_ebs_image_and_check_boot(self): # create an instance from volume volume_origin = self._create_volume_from_image() @@ -216,7 +216,7 @@ class TestVolumeBootPattern(manager.EncryptionScenarioTest): @decorators.idempotent_id('cb78919a-e553-4bab-b73b-10cf4d2eb125') @testtools.skipUnless(CONF.compute_feature_enabled.attach_encrypted_volume, 'Encrypted volume attach is not supported') - @test.services('compute', 'volume') + @utils.services('compute', 'volume') def test_boot_server_from_encrypted_volume_luks(self): # Create an encrypted volume volume = self.create_encrypted_volume('nova.volume.encryptors.' diff --git a/tempest/scenario/test_volume_migrate_attached.py b/tempest/scenario/test_volume_migrate_attached.py index 5667fbb746..61bbe2bd2c 100644 --- a/tempest/scenario/test_volume_migrate_attached.py +++ b/tempest/scenario/test_volume_migrate_attached.py @@ -12,11 +12,11 @@ from oslo_log import log as logging +from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib import decorators from tempest.scenario import manager -from tempest import test CONF = config.CONF LOG = logging.getLogger(__name__) @@ -90,7 +90,7 @@ class TestVolumeMigrateRetypeAttached(manager.ScenarioTest): @decorators.attr(type='slow') @decorators.idempotent_id('deadd2c2-beef-4dce-98be-f86765ff311b') - @test.services('compute', 'volume') + @utils.services('compute', 'volume') def test_volume_migrate_attached(self): LOG.info("Creating keypair and security group") keypair = self.create_keypair() diff --git a/tempest/test.py b/tempest/test.py index 78db8e18d2..f390ae4d88 100644 --- a/tempest/test.py +++ b/tempest/test.py @@ -14,7 +14,6 @@ # under the License. import atexit -import functools import os import sys @@ -26,6 +25,7 @@ import testtools from tempest import clients from tempest.common import credentials_factory as credentials +from tempest.common import utils import tempest.common.validation_resources as vresources from tempest import config from tempest.lib.common import cred_client @@ -49,95 +49,19 @@ attr = debtcollector.moves.moved_function( version='Pike', removal_version='?') -class InvalidServiceTag(lib_exc.TempestException): - message = "Invalid service tag" +services = debtcollector.moves.moved_function( + utils.services, 'services', __name__, + version='Pike', removal_version='?') -def get_service_list(): - service_list = { - 'compute': CONF.service_available.nova, - 'image': CONF.service_available.glance, - 'volume': CONF.service_available.cinder, - # NOTE(masayukig): We have two network services which are neutron and - # nova-network. And we have no way to know whether nova-network is - # available or not. After the pending removal of nova-network from - # nova, we can treat the network/neutron case in the same manner as - # the other services. - 'network': True, - # NOTE(masayukig): Tempest tests always require the identity service. - # So we should set this True here. - 'identity': True, - 'object_storage': CONF.service_available.swift, - } - return service_list +requires_ext = debtcollector.moves.moved_function( + utils.requires_ext, 'requires_ext', __name__, + version='Pike', removal_version='?') -def services(*args): - """A decorator used to set an attr for each service used in a test case - - This decorator applies a testtools attr for each service that gets - exercised by a test case. - """ - def decorator(f): - known_services = get_service_list() - - for service in args: - if service not in known_services: - raise InvalidServiceTag('%s is not a valid service' % service) - decorators.attr(type=list(args))(f) - - @functools.wraps(f) - def wrapper(self, *func_args, **func_kwargs): - service_list = get_service_list() - - for service in args: - if not service_list[service]: - msg = 'Skipped because the %s service is not available' % ( - service) - raise testtools.TestCase.skipException(msg) - return f(self, *func_args, **func_kwargs) - return wrapper - return decorator - - -def requires_ext(**kwargs): - """A decorator to skip tests if an extension is not enabled - - @param extension - @param service - """ - def decorator(func): - @functools.wraps(func) - def wrapper(*func_args, **func_kwargs): - if not is_extension_enabled(kwargs['extension'], - kwargs['service']): - msg = "Skipped because %s extension: %s is not enabled" % ( - kwargs['service'], kwargs['extension']) - raise testtools.TestCase.skipException(msg) - return func(*func_args, **func_kwargs) - return wrapper - return decorator - - -def is_extension_enabled(extension_name, service): - """A function that will check the list of enabled extensions from config - - """ - config_dict = { - 'compute': CONF.compute_feature_enabled.api_extensions, - 'volume': CONF.volume_feature_enabled.api_extensions, - 'network': CONF.network_feature_enabled.api_extensions, - 'object': CONF.object_storage_feature_enabled.discoverable_apis, - 'identity': CONF.identity_feature_enabled.api_extensions - } - if not config_dict[service]: - return False - if config_dict[service][0] == 'all': - return True - if extension_name in config_dict[service]: - return True - return False - +is_extension_enabled = debtcollector.moves.moved_function( + utils.is_extension_enabled, 'is_extension_enabled', __name__, + version='Pike', removal_version='?') at_exit_set = set() diff --git a/tempest/tests/test_decorators.py b/tempest/tests/test_decorators.py index e3e21f9616..bf0428081d 100644 --- a/tempest/tests/test_decorators.py +++ b/tempest/tests/test_decorators.py @@ -16,7 +16,9 @@ import fixtures from oslo_config import cfg import testtools +from tempest.common import utils from tempest import config +from tempest import exceptions from tempest.lib.common.utils import data_utils from tempest import test from tempest.tests import base @@ -75,7 +77,7 @@ class TestIdempotentIdDecorator(BaseDecoratorsTest): class TestServicesDecorator(BaseDecoratorsTest): def _test_services_helper(self, *decorator_args): class TestFoo(test.BaseTestCase): - @test.services(*decorator_args) + @utils.services(*decorator_args) def test_bar(self): return 0 @@ -94,7 +96,7 @@ class TestServicesDecorator(BaseDecoratorsTest): self._test_services_helper('compute', 'compute') def test_services_decorator_with_invalid_service(self): - self.assertRaises(test.InvalidServiceTag, + self.assertRaises(exceptions.InvalidServiceTag, self._test_services_helper, 'compute', 'bad_service') @@ -106,11 +108,11 @@ class TestServicesDecorator(BaseDecoratorsTest): 'volume') def test_services_list(self): - service_list = test.get_service_list() + service_list = utils.get_service_list() for service in service_list: try: self._test_services_helper(service) - except test.InvalidServiceTag: + except exceptions.InvalidServiceTag: self.fail('%s is not listed in the valid service tag list' % service) except KeyError: @@ -137,7 +139,7 @@ class TestRequiresExtDecorator(BaseDecoratorsTest): def _test_requires_ext_helper(self, expected_to_skip=True, **decorator_args): class TestFoo(test.BaseTestCase): - @test.requires_ext(**decorator_args) + @utils.requires_ext(**decorator_args) def test_bar(self): return 0 diff --git a/tempest/tests/test_hacking.py b/tempest/tests/test_hacking.py index c04d933cd9..bc3a753f32 100644 --- a/tempest/tests/test_hacking.py +++ b/tempest/tests/test_hacking.py @@ -86,13 +86,13 @@ class HackingTestCase(base.TestCase): def test_scenario_tests_need_service_tags(self): self.assertFalse(checks.scenario_tests_need_service_tags( 'def test_fake:', './tempest/scenario/test_fake.py', - "@test.services('compute')")) + "@utils.services('compute')")) self.assertFalse(checks.scenario_tests_need_service_tags( 'def test_fake_test:', './tempest/api/compute/test_fake.py', - "@test.services('image')")) + "@utils.services('image')")) self.assertFalse(checks.scenario_tests_need_service_tags( 'def test_fake:', './tempest/scenario/orchestration/test_fake.py', - "@test.services('compute')")) + "@utils.services('compute')")) self.assertTrue(checks.scenario_tests_need_service_tags( 'def test_fake_test:', './tempest/scenario/test_fake.py', '\n')) @@ -113,12 +113,13 @@ class HackingTestCase(base.TestCase): def test_service_tags_not_in_module_path(self): self.assertTrue(checks.service_tags_not_in_module_path( - "@test.services('compute')", './tempest/api/compute/fake_test.py')) + "@utils.services('compute')", + './tempest/api/compute/fake_test.py')) self.assertFalse(checks.service_tags_not_in_module_path( - "@test.services('compute')", + "@utils.services('compute')", './tempest/scenario/compute/fake_test.py')) self.assertFalse(checks.service_tags_not_in_module_path( - "@test.services('compute')", './tempest/api/image/fake_test.py')) + "@utils.services('compute')", './tempest/api/image/fake_test.py')) def test_no_hyphen_at_end_of_rand_name(self): self.assertIsNone(checks.no_hyphen_at_end_of_rand_name(