Browse Source

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
changes/68/493668/13
Andrea Frittoli 5 years ago
parent
commit
cd36841ca2
  1. 8
      HACKING.rst
  2. 5
      tempest/api/compute/admin/test_auto_allocate_network.py
  3. 8
      tempest/api/compute/admin/test_fixed_ips.py
  4. 12
      tempest/api/compute/admin/test_fixed_ips_negative.py
  5. 4
      tempest/api/compute/admin/test_flavors.py
  6. 4
      tempest/api/compute/admin/test_flavors_access.py
  7. 4
      tempest/api/compute/admin/test_flavors_access_negative.py
  8. 4
      tempest/api/compute/admin/test_flavors_extra_specs.py
  9. 4
      tempest/api/compute/admin/test_flavors_extra_specs_negative.py
  10. 4
      tempest/api/compute/admin/test_floating_ips_bulk.py
  11. 4
      tempest/api/compute/admin/test_live_migration.py
  12. 6
      tempest/api/compute/admin/test_quotas_negative.py
  13. 4
      tempest/api/compute/admin/test_security_groups.py
  14. 4
      tempest/api/compute/admin/test_volume_swap.py
  15. 4
      tempest/api/compute/flavors/test_flavors_negative.py
  16. 10
      tempest/api/compute/floating_ips/test_floating_ips_actions.py
  17. 14
      tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
  18. 8
      tempest/api/compute/floating_ips/test_list_floating_ips.py
  19. 4
      tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
  20. 4
      tempest/api/compute/security_groups/base.py
  21. 12
      tempest/api/compute/security_groups/test_security_group_rules.py
  22. 18
      tempest/api/compute/security_groups/test_security_group_rules_negative.py
  23. 12
      tempest/api/compute/security_groups/test_security_groups.py
  24. 24
      tempest/api/compute/security_groups/test_security_groups_negative.py
  25. 6
      tempest/api/compute/servers/test_attach_interfaces.py
  26. 4
      tempest/api/compute/servers/test_create_server.py
  27. 4
      tempest/api/compute/servers/test_delete_server.py
  28. 4
      tempest/api/compute/servers/test_device_tagging.py
  29. 8
      tempest/api/compute/servers/test_server_actions.py
  30. 6
      tempest/api/compute/servers/test_server_addresses.py
  31. 6
      tempest/api/compute/servers/test_server_addresses_negative.py
  32. 4
      tempest/api/compute/servers/test_server_group.py
  33. 6
      tempest/api/compute/servers/test_server_rescue_negative.py
  34. 4
      tempest/api/compute/servers/test_server_tags.py
  35. 6
      tempest/api/compute/servers/test_servers_negative.py
  36. 4
      tempest/api/compute/servers/test_virtual_interfaces.py
  37. 4
      tempest/api/compute/servers/test_virtual_interfaces_negative.py
  38. 4
      tempest/api/compute/test_extensions.py
  39. 4
      tempest/api/compute/test_quotas.py
  40. 4
      tempest/api/compute/test_tenant_networks.py
  41. 4
      tempest/api/identity/admin/v3/test_inherits.py
  42. 4
      tempest/api/identity/v2/test_ec2_credentials.py
  43. 4
      tempest/api/network/admin/test_agent_management.py
  44. 4
      tempest/api/network/admin/test_dhcp_agent_scheduler.py
  45. 4
      tempest/api/network/admin/test_floating_ips_admin_actions.py
  46. 4
      tempest/api/network/admin/test_l3_agent_scheduler.py
  47. 4
      tempest/api/network/admin/test_metering_extensions.py
  48. 4
      tempest/api/network/admin/test_negative_quotas.py
  49. 4
      tempest/api/network/admin/test_quotas.py
  50. 14
      tempest/api/network/admin/test_routers.py
  51. 6
      tempest/api/network/admin/test_routers_dvr.py
  52. 6
      tempest/api/network/admin/test_routers_negative.py
  53. 4
      tempest/api/network/test_allowed_address_pair.py
  54. 6
      tempest/api/network/test_extensions.py
  55. 4
      tempest/api/network/test_extra_dhcp_options.py
  56. 4
      tempest/api/network/test_floating_ips.py
  57. 4
      tempest/api/network/test_floating_ips_negative.py
  58. 12
      tempest/api/network/test_networks.py
  59. 8
      tempest/api/network/test_ports.py
  60. 8
      tempest/api/network/test_routers.py
  61. 6
      tempest/api/network/test_routers_negative.py
  62. 4
      tempest/api/network/test_security_groups.py
  63. 4
      tempest/api/network/test_security_groups_negative.py
  64. 4
      tempest/api/network/test_service_providers.py
  65. 4
      tempest/api/network/test_subnetpools_extensions.py
  66. 6
      tempest/api/network/test_tags.py
  67. 8
      tempest/api/object_storage/test_account_bulk.py
  68. 6
      tempest/api/object_storage/test_account_quotas.py
  69. 4
      tempest/api/object_storage/test_account_quotas_negative.py
  70. 8
      tempest/api/object_storage/test_container_quotas.py
  71. 10
      tempest/api/object_storage/test_container_staticweb.py
  72. 4
      tempest/api/object_storage/test_container_sync_middleware.py
  73. 4
      tempest/api/object_storage/test_crossdomain.py
  74. 4
      tempest/api/object_storage/test_object_formpost.py
  75. 6
      tempest/api/object_storage/test_object_formpost_negative.py
  76. 10
      tempest/api/object_storage/test_object_slo.py
  77. 12
      tempest/api/object_storage/test_object_temp_url.py
  78. 4
      tempest/api/object_storage/test_object_temp_url_negative.py
  79. 4
      tempest/api/volume/admin/test_volumes_actions.py
  80. 4
      tempest/api/volume/test_image_metadata.py
  81. 8
      tempest/api/volume/test_volumes_actions.py
  82. 6
      tempest/api/volume/test_volumes_backup.py
  83. 4
      tempest/api/volume/test_volumes_clone.py
  84. 4
      tempest/api/volume/test_volumes_get.py
  85. 8
      tempest/api/volume/test_volumes_negative.py
  86. 6
      tempest/api/volume/test_volumes_snapshots.py
  87. 4
      tempest/cmd/cleanup_service.py
  88. 92
      tempest/common/utils/__init__.py
  89. 4
      tempest/exceptions.py
  90. 2
      tempest/lib/common/dynamic_creds.py
  91. 4
      tempest/scenario/test_aggregates_basic_ops.py
  92. 6
      tempest/scenario/test_encrypted_cinder_volumes.py
  93. 4
      tempest/scenario/test_minimum_basic.py
  94. 20
      tempest/scenario/test_network_advanced_server_ops.py
  95. 30
      tempest/scenario/test_network_basic_ops.py
  96. 18
      tempest/scenario/test_network_v6.py
  97. 6
      tempest/scenario/test_object_storage_basic_ops.py
  98. 20
      tempest/scenario/test_security_groups_basic_ops.py
  99. 6
      tempest/scenario/test_server_advanced_ops.py
  100. 4
      tempest/scenario/test_server_basic_ops.py
  101. Some files were not shown because too many files have changed in this diff Show More

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

5
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')

8
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")

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

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

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

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

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

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

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

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

6
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

4
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

4
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

4
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

10
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):

14
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):

8
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()

4
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

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

12
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

18
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

12
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

24
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()

6
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()

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

4
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

4
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

8
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

6
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