Switch to decorators.idempotent_id on compute.admin

So many modules are using test.idempotent_id and this is the first
step for switching to decorators.idempotent_id.

Change-Id: I55a61d40f18f8fa0fea8423ad65302c1e3559205
Related-Bug: #1616913
This commit is contained in:
Ken'ichi Ohmichi 2017-01-27 16:37:00 -08:00 committed by Ken'ichi Ohmichi
parent f805dcba7a
commit ebbfd1c74d
39 changed files with 220 additions and 195 deletions

View File

@ -14,7 +14,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import test
from tempest.lib import decorators
class AgentsAdminTestJSON(base.BaseV2ComputeAdminTest):
@ -44,7 +44,7 @@ class AgentsAdminTestJSON(base.BaseV2ComputeAdminTest):
kwargs[rand_key] = data_utils.rand_name(kwargs[rand_key])
return kwargs
@test.idempotent_id('1fc6bdc8-0b6d-4cc7-9f30-9b04fabe5b90')
@decorators.idempotent_id('1fc6bdc8-0b6d-4cc7-9f30-9b04fabe5b90')
def test_create_agent(self):
# Create an agent.
params = self._param_helper(
@ -56,7 +56,7 @@ class AgentsAdminTestJSON(base.BaseV2ComputeAdminTest):
for expected_item, value in params.items():
self.assertEqual(value, body[expected_item])
@test.idempotent_id('dc9ffd51-1c50-4f0e-a820-ae6d2a568a9e')
@decorators.idempotent_id('dc9ffd51-1c50-4f0e-a820-ae6d2a568a9e')
def test_update_agent(self):
# Create and update an agent.
body = self.client.create_agent(**self.params_agent)['agent']
@ -69,7 +69,7 @@ class AgentsAdminTestJSON(base.BaseV2ComputeAdminTest):
for expected_item, value in params.items():
self.assertEqual(value, body[expected_item])
@test.idempotent_id('470e0b89-386f-407b-91fd-819737d0b335')
@decorators.idempotent_id('470e0b89-386f-407b-91fd-819737d0b335')
def test_delete_agent(self):
# Create an agent and delete it.
body = self.client.create_agent(**self.params_agent)['agent']
@ -80,7 +80,7 @@ class AgentsAdminTestJSON(base.BaseV2ComputeAdminTest):
self.assertNotIn(body['agent_id'], map(lambda x: x['agent_id'],
agents))
@test.idempotent_id('6a326c69-654b-438a-80a3-34bcc454e138')
@decorators.idempotent_id('6a326c69-654b-438a-80a3-34bcc454e138')
def test_list_agents(self):
# Create an agent and list all agents.
body = self.client.create_agent(**self.params_agent)['agent']
@ -90,7 +90,7 @@ class AgentsAdminTestJSON(base.BaseV2ComputeAdminTest):
'Cannot get any agents.(%s)' % agents)
self.assertIn(body['agent_id'], map(lambda x: x['agent_id'], agents))
@test.idempotent_id('eabadde4-3cd7-4ec4-a4b5-5a936d2d4408')
@decorators.idempotent_id('eabadde4-3cd7-4ec4-a4b5-5a936d2d4408')
def test_list_agents_with_filter(self):
# Create agents and list the agent builds by the filter.
body = self.client.create_agent(**self.params_agent)['agent']

View File

@ -20,7 +20,7 @@ from tempest.common import tempest_fixtures as fixtures
from tempest.common.utils import data_utils
from tempest import config
from tempest.lib.common.utils import test_utils
from tempest import test
from tempest.lib import decorators
CONF = config.CONF
@ -59,7 +59,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
msg += " for hypervisor_type %s" % CONF.compute.hypervisor_type
raise testtools.TestCase.failureException(msg)
@test.idempotent_id('0d148aa3-d54c-4317-aa8d-42040a475e20')
@decorators.idempotent_id('0d148aa3-d54c-4317-aa8d-42040a475e20')
def test_aggregate_create_delete(self):
# Create and delete an aggregate.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
@ -73,7 +73,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
self.client.delete_aggregate(aggregate['id'])
self.client.wait_for_resource_deletion(aggregate['id'])
@test.idempotent_id('5873a6f8-671a-43ff-8838-7ce430bb6d0b')
@decorators.idempotent_id('5873a6f8-671a-43ff-8838-7ce430bb6d0b')
def test_aggregate_create_delete_with_az(self):
# Create and delete an aggregate.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
@ -88,7 +88,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
self.client.delete_aggregate(aggregate['id'])
self.client.wait_for_resource_deletion(aggregate['id'])
@test.idempotent_id('68089c38-04b1-4758-bdf0-cf0daec4defd')
@decorators.idempotent_id('68089c38-04b1-4758-bdf0-cf0daec4defd')
def test_aggregate_create_verify_entry_in_list(self):
# Create an aggregate and ensure it is listed.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
@ -101,7 +101,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
map(lambda x: (x['id'], x['availability_zone']),
aggregates))
@test.idempotent_id('36ec92ca-7a73-43bc-b920-7531809e8540')
@decorators.idempotent_id('36ec92ca-7a73-43bc-b920-7531809e8540')
def test_aggregate_create_update_metadata_get_details(self):
# Create an aggregate and ensure its details are returned.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
@ -124,7 +124,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
body = self.client.show_aggregate(aggregate['id'])['aggregate']
self.assertEqual(meta, body["metadata"])
@test.idempotent_id('4d2b2004-40fa-40a1-aab2-66f4dab81beb')
@decorators.idempotent_id('4d2b2004-40fa-40a1-aab2-66f4dab81beb')
def test_aggregate_create_update_with_az(self):
# Update an aggregate and ensure properties are updated correctly
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
@ -154,7 +154,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
(x['id'], x['name'], x['availability_zone']),
aggregates))
@test.idempotent_id('c8e85064-e79b-4906-9931-c11c24294d02')
@decorators.idempotent_id('c8e85064-e79b-4906-9931-c11c24294d02')
def test_aggregate_add_remove_host(self):
# Add a host to the given aggregate and remove.
self.useFixture(fixtures.LockFixture('availability_zone'))
@ -177,7 +177,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
body['availability_zone'])
self.assertNotIn(self.host, body['hosts'])
@test.idempotent_id('7f6a1cc5-2446-4cdb-9baa-b6ae0a919b72')
@decorators.idempotent_id('7f6a1cc5-2446-4cdb-9baa-b6ae0a919b72')
def test_aggregate_add_host_list(self):
# Add a host to the given aggregate and list.
self.useFixture(fixtures.LockFixture('availability_zone'))
@ -197,7 +197,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
self.assertIsNone(agg['availability_zone'])
self.assertIn(self.host, agg['hosts'])
@test.idempotent_id('eeef473c-7c52-494d-9f09-2ed7fc8fc036')
@decorators.idempotent_id('eeef473c-7c52-494d-9f09-2ed7fc8fc036')
def test_aggregate_add_host_get_details(self):
# Add a host to the given aggregate and get details.
self.useFixture(fixtures.LockFixture('availability_zone'))
@ -214,7 +214,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
self.assertIsNone(body['availability_zone'])
self.assertIn(self.host, body['hosts'])
@test.idempotent_id('96be03c7-570d-409c-90f8-e4db3c646996')
@decorators.idempotent_id('96be03c7-570d-409c-90f8-e4db3c646996')
def test_aggregate_add_host_create_server_with_az(self):
# Add a host to the given aggregate and create a server.
self.useFixture(fixtures.LockFixture('availability_zone'))

View File

@ -16,6 +16,7 @@
from tempest.api.compute import base
from tempest.common import tempest_fixtures as fixtures
from tempest.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest import test
@ -48,7 +49,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
return aggregate
@test.attr(type=['negative'])
@test.idempotent_id('86a1cb14-da37-4a70-b056-903fd56dfe29')
@decorators.idempotent_id('86a1cb14-da37-4a70-b056-903fd56dfe29')
def test_aggregate_create_as_user(self):
# Regular user is not allowed to create an aggregate.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
@ -57,7 +58,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
name=aggregate_name)
@test.attr(type=['negative'])
@test.idempotent_id('3b8a1929-3793-4e92-bcb4-dfa572ee6c1d')
@decorators.idempotent_id('3b8a1929-3793-4e92-bcb4-dfa572ee6c1d')
def test_aggregate_create_aggregate_name_length_less_than_1(self):
# the length of aggregate name should >= 1 and <=255
self.assertRaises(lib_exc.BadRequest,
@ -65,7 +66,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
name='')
@test.attr(type=['negative'])
@test.idempotent_id('4c194563-543b-4e70-a719-557bbe947fac')
@decorators.idempotent_id('4c194563-543b-4e70-a719-557bbe947fac')
def test_aggregate_create_aggregate_name_length_exceeds_255(self):
# the length of aggregate name should >= 1 and <=255
aggregate_name = 'a' * 256
@ -74,7 +75,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
name=aggregate_name)
@test.attr(type=['negative'])
@test.idempotent_id('9c23a291-b0b1-487b-b464-132e061151b3')
@decorators.idempotent_id('9c23a291-b0b1-487b-b464-132e061151b3')
def test_aggregate_create_with_existent_aggregate_name(self):
# creating an aggregate with existent aggregate name is forbidden
aggregate = self._create_test_aggregate()
@ -83,7 +84,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
name=aggregate['name'])
@test.attr(type=['negative'])
@test.idempotent_id('cd6de795-c15d-45f1-8d9e-813c6bb72a3d')
@decorators.idempotent_id('cd6de795-c15d-45f1-8d9e-813c6bb72a3d')
def test_aggregate_delete_as_user(self):
# Regular user is not allowed to delete an aggregate.
aggregate = self._create_test_aggregate()
@ -92,14 +93,14 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
aggregate['id'])
@test.attr(type=['negative'])
@test.idempotent_id('b7d475a6-5dcd-4ff4-b70a-cd9de66a6672')
@decorators.idempotent_id('b7d475a6-5dcd-4ff4-b70a-cd9de66a6672')
def test_aggregate_list_as_user(self):
# Regular user is not allowed to list aggregates.
self.assertRaises(lib_exc.Forbidden,
self.user_client.list_aggregates)
@test.attr(type=['negative'])
@test.idempotent_id('557cad12-34c9-4ff4-95f0-22f0dfbaf7dc')
@decorators.idempotent_id('557cad12-34c9-4ff4-95f0-22f0dfbaf7dc')
def test_aggregate_get_details_as_user(self):
# Regular user is not allowed to get aggregate details.
aggregate = self._create_test_aggregate()
@ -108,21 +109,21 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
aggregate['id'])
@test.attr(type=['negative'])
@test.idempotent_id('c74f4bf1-4708-4ff2-95a0-f49eaca951bd')
@decorators.idempotent_id('c74f4bf1-4708-4ff2-95a0-f49eaca951bd')
def test_aggregate_delete_with_invalid_id(self):
# Delete an aggregate with invalid id should raise exceptions.
self.assertRaises(lib_exc.NotFound,
self.client.delete_aggregate, -1)
@test.attr(type=['negative'])
@test.idempotent_id('3c916244-2c46-49a4-9b55-b20bb0ae512c')
@decorators.idempotent_id('3c916244-2c46-49a4-9b55-b20bb0ae512c')
def test_aggregate_get_details_with_invalid_id(self):
# Get aggregate details with invalid id should raise exceptions.
self.assertRaises(lib_exc.NotFound,
self.client.show_aggregate, -1)
@test.attr(type=['negative'])
@test.idempotent_id('0ef07828-12b4-45ba-87cc-41425faf5711')
@decorators.idempotent_id('0ef07828-12b4-45ba-87cc-41425faf5711')
def test_aggregate_add_non_exist_host(self):
# Adding a non-exist host to an aggregate should raise exceptions.
hosts_all = self.os_adm.hosts_client.list_hosts()['hosts']
@ -136,7 +137,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
aggregate['id'], host=non_exist_host)
@test.attr(type=['negative'])
@test.idempotent_id('7324c334-bd13-4c93-8521-5877322c3d51')
@decorators.idempotent_id('7324c334-bd13-4c93-8521-5877322c3d51')
def test_aggregate_add_host_as_user(self):
# Regular user is not allowed to add a host to an aggregate.
aggregate = self._create_test_aggregate()
@ -145,7 +146,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
aggregate['id'], host=self.host)
@test.attr(type=['negative'])
@test.idempotent_id('19dd44e1-c435-4ee1-a402-88c4f90b5950')
@decorators.idempotent_id('19dd44e1-c435-4ee1-a402-88c4f90b5950')
def test_aggregate_add_existent_host(self):
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate = self._create_test_aggregate()
@ -158,7 +159,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
aggregate['id'], host=self.host)
@test.attr(type=['negative'])
@test.idempotent_id('7a53af20-137a-4e44-a4ae-e19260e626d9')
@decorators.idempotent_id('7a53af20-137a-4e44-a4ae-e19260e626d9')
def test_aggregate_remove_host_as_user(self):
# Regular user is not allowed to remove a host from an aggregate.
self.useFixture(fixtures.LockFixture('availability_zone'))
@ -173,7 +174,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
aggregate['id'], host=self.host)
@test.attr(type=['negative'])
@test.idempotent_id('95d6a6fa-8da9-4426-84d0-eec0329f2e4d')
@decorators.idempotent_id('95d6a6fa-8da9-4426-84d0-eec0329f2e4d')
def test_aggregate_remove_nonexistent_host(self):
aggregate = self._create_test_aggregate()

View File

@ -19,6 +19,7 @@ from tempest.common import compute
from tempest.common import credentials_factory as credentials
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
@ -145,7 +146,7 @@ class AutoAllocateNetworkTest(base.BaseV2ComputeTest):
test_utils.call_and_ignore_notfound_exc(
cls.networks_client.delete_network, network['id'])
@test.idempotent_id('5eb7b8fa-9c23-47a2-9d7d-02ed5809dd34')
@decorators.idempotent_id('5eb7b8fa-9c23-47a2-9d7d-02ed5809dd34')
def test_server_create_no_allocate(self):
"""Tests that no networking is allocated for the server."""
# create the server with no networking
@ -158,7 +159,7 @@ class AutoAllocateNetworkTest(base.BaseV2ComputeTest):
# assert that there is no networking
self.assertEqual({}, addresses)
@test.idempotent_id('2e6cf129-9e28-4e8a-aaaa-045ea826b2a6')
@decorators.idempotent_id('2e6cf129-9e28-4e8a-aaaa-045ea826b2a6')
def test_server_multi_create_auto_allocate(self):
"""Tests that networking is auto-allocated for multiple servers."""

View File

@ -14,7 +14,7 @@
# under the License.
from tempest.api.compute import base
from tempest import test
from tempest.lib import decorators
class AZAdminV2TestJSON(base.BaseV2ComputeAdminTest):
@ -25,13 +25,13 @@ class AZAdminV2TestJSON(base.BaseV2ComputeAdminTest):
super(AZAdminV2TestJSON, cls).setup_clients()
cls.client = cls.availability_zone_admin_client
@test.idempotent_id('d3431479-8a09-4f76-aa2d-26dc580cb27c')
@decorators.idempotent_id('d3431479-8a09-4f76-aa2d-26dc580cb27c')
def test_get_availability_zone_list(self):
# List of availability zone
availability_zone = self.client.list_availability_zones()
self.assertGreater(len(availability_zone['availabilityZoneInfo']), 0)
@test.idempotent_id('ef726c58-530f-44c2-968c-c7bed22d5b8c')
@decorators.idempotent_id('ef726c58-530f-44c2-968c-c7bed22d5b8c')
def test_get_availability_zone_list_detail(self):
# List of availability zones and available services
availability_zone = self.client.list_availability_zones(detail=True)

View File

@ -13,6 +13,7 @@
# under the License.
from tempest.api.compute import base
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest import test
@ -26,7 +27,7 @@ class AZAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
cls.non_adm_client = cls.availability_zone_client
@test.attr(type=['negative'])
@test.idempotent_id('bf34dca2-fdc3-4073-9c02-7648d9eae0d7')
@decorators.idempotent_id('bf34dca2-fdc3-4073-9c02-7648d9eae0d7')
def test_get_availability_zone_list_detail_with_non_admin_user(self):
# List of availability zones and available services with
# non-administrator user

View File

@ -14,6 +14,7 @@
from tempest.api.compute import base
from tempest import config
from tempest.lib import decorators
from tempest import test
CONF = config.CONF
@ -32,7 +33,7 @@ class BaremetalNodesAdminTestJSON(base.BaseV2ComputeAdminTest):
cls.ironic_client = cls.os_adm.baremetal_client
@test.attr(type=['baremetal'])
@test.idempotent_id('e475aa6e-416d-4fa4-b3af-28d5e84250fb')
@decorators.idempotent_id('e475aa6e-416d-4fa4-b3af-28d5e84250fb')
def test_list_get_baremetal_nodes(self):
# Create some test nodes in Ironic directly
test_nodes = []

View File

@ -15,6 +15,7 @@
from tempest.api.compute import base
from tempest import config
from tempest.lib import decorators
from tempest import test
CONF = config.CONF
@ -47,18 +48,18 @@ class FixedIPsTestJson(base.BaseV2ComputeAdminTest):
if cls.ip:
break
@test.idempotent_id('16b7d848-2f7c-4709-85a3-2dfb4576cc52')
@decorators.idempotent_id('16b7d848-2f7c-4709-85a3-2dfb4576cc52')
@test.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)
@test.idempotent_id('5485077b-7e46-4cec-b402-91dc3173433b')
@decorators.idempotent_id('5485077b-7e46-4cec-b402-91dc3173433b')
@test.services('network')
def test_set_reserve(self):
self.client.reserve_fixed_ip(self.ip, reserve="None")
@test.idempotent_id('7476e322-b9ff-4710-bf82-49d51bac6e2e')
@decorators.idempotent_id('7476e322-b9ff-4710-bf82-49d51bac6e2e')
@test.services('network')
def test_set_unreserve(self):
self.client.reserve_fixed_ip(self.ip, unreserve="None")

View File

@ -14,6 +14,7 @@
from tempest.api.compute import base
from tempest import config
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest import test
@ -49,14 +50,14 @@ class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest):
break
@test.attr(type=['negative'])
@test.idempotent_id('9f17f47d-daad-4adc-986e-12370c93e407')
@decorators.idempotent_id('9f17f47d-daad-4adc-986e-12370c93e407')
@test.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)
@test.attr(type=['negative'])
@test.idempotent_id('ce60042c-fa60-4836-8d43-1c8e3359dc47')
@decorators.idempotent_id('ce60042c-fa60-4836-8d43-1c8e3359dc47')
@test.services('network')
def test_set_reserve_with_non_admin_user(self):
self.assertRaises(lib_exc.Forbidden,
@ -64,7 +65,7 @@ class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest):
self.ip, reserve="None")
@test.attr(type=['negative'])
@test.idempotent_id('f1f7a35b-0390-48c5-9803-5f27461439db')
@decorators.idempotent_id('f1f7a35b-0390-48c5-9803-5f27461439db')
@test.services('network')
def test_set_unreserve_with_non_admin_user(self):
self.assertRaises(lib_exc.Forbidden,
@ -72,7 +73,7 @@ class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest):
self.ip, unreserve="None")
@test.attr(type=['negative'])
@test.idempotent_id('f51cf464-7fc5-4352-bc3e-e75cfa2cb717')
@decorators.idempotent_id('f51cf464-7fc5-4352-bc3e-e75cfa2cb717')
@test.services('network')
def test_set_reserve_with_invalid_ip(self):
# NOTE(maurosr): since this exercises the same code snippet, we do it
@ -85,7 +86,7 @@ class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest):
"my.invalid.ip", reserve="None")
@test.attr(type=['negative'])
@test.idempotent_id('fd26ef50-f135-4232-9d32-281aab3f9176')
@decorators.idempotent_id('fd26ef50-f135-4232-9d32-281aab3f9176')
@test.services('network')
def test_fixed_ip_with_invalid_action(self):
self.assertRaises(lib_exc.BadRequest,

View File

@ -17,6 +17,7 @@ import uuid
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest import test
@ -83,19 +84,19 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
return flavor['id']
@test.idempotent_id('8b4330e1-12c4-4554-9390-e6639971f086')
@decorators.idempotent_id('8b4330e1-12c4-4554-9390-e6639971f086')
def test_create_flavor_with_int_id(self):
flavor_id = data_utils.rand_int_id(start=1000)
new_flavor_id = self._create_flavor(flavor_id)
self.assertEqual(new_flavor_id, str(flavor_id))
@test.idempotent_id('94c9bb4e-2c2a-4f3c-bb1f-5f0daf918e6d')
@decorators.idempotent_id('94c9bb4e-2c2a-4f3c-bb1f-5f0daf918e6d')
def test_create_flavor_with_uuid_id(self):
flavor_id = data_utils.rand_uuid()
new_flavor_id = self._create_flavor(flavor_id)
self.assertEqual(new_flavor_id, flavor_id)
@test.idempotent_id('f83fe669-6758-448a-a85e-32d351f36fe0')
@decorators.idempotent_id('f83fe669-6758-448a-a85e-32d351f36fe0')
def test_create_flavor_with_none_id(self):
# If nova receives a request with None as flavor_id,
# nova generates flavor_id of uuid.
@ -103,7 +104,7 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
new_flavor_id = self._create_flavor(flavor_id)
self.assertEqual(new_flavor_id, str(uuid.UUID(new_flavor_id)))
@test.idempotent_id('8261d7b0-be58-43ec-a2e5-300573c3f6c5')
@decorators.idempotent_id('8261d7b0-be58-43ec-a2e5-300573c3f6c5')
def test_create_flavor_verify_entry_in_list_details(self):
# Create a flavor and ensure it's details are listed
# This operation requires the user to have 'admin' role
@ -127,7 +128,7 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
flag = True
self.assertTrue(flag)
@test.idempotent_id('63dc64e6-2e79-4fdf-868f-85500d308d66')
@decorators.idempotent_id('63dc64e6-2e79-4fdf-868f-85500d308d66')
def test_create_list_flavor_without_extra_data(self):
# Create a flavor and ensure it is listed
# This operation requires the user to have 'admin' role
@ -169,7 +170,7 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
flag = True
self.assertTrue(flag)
@test.idempotent_id('be6cc18c-7c5d-48c0-ac16-17eaf03c54eb')
@decorators.idempotent_id('be6cc18c-7c5d-48c0-ac16-17eaf03c54eb')
def test_list_non_public_flavor(self):
# Create a flavor with os-flavor-access:is_public false.
# The flavor should not be present in list_details as the
@ -201,7 +202,7 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
flag = True
self.assertFalse(flag)
@test.idempotent_id('bcc418ef-799b-47cc-baa1-ce01368b8987')
@decorators.idempotent_id('bcc418ef-799b-47cc-baa1-ce01368b8987')
def test_create_server_with_non_public_flavor(self):
# Create a flavor with os-flavor-access:is_public false
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
@ -221,7 +222,7 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
name='test', imageRef=self.image_ref,
flavorRef=flavor['id'])
@test.idempotent_id('b345b196-bfbd-4231-8ac1-6d7fe15ff3a3')
@decorators.idempotent_id('b345b196-bfbd-4231-8ac1-6d7fe15ff3a3')
def test_list_public_flavor_with_other_user(self):
# Create a Flavor with public access.
# Try to List/Get flavor with another user
@ -244,7 +245,7 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
flag = True
self.assertTrue(flag)
@test.idempotent_id('fb9cbde6-3a0e-41f2-a983-bdb0a823c44e')
@decorators.idempotent_id('fb9cbde6-3a0e-41f2-a983-bdb0a823c44e')
def test_is_public_string_variations(self):
flavor_id_not_public = data_utils.rand_int_id(start=1000)
flavor_name_not_public = data_utils.rand_name(self.flavor_name_prefix)
@ -287,7 +288,7 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
_test_string_variations(['t', 'true', 'yes', '1'],
flavor_name_public)
@test.idempotent_id('3b541a2e-2ac2-4b42-8b8d-ba6e22fcd4da')
@decorators.idempotent_id('3b541a2e-2ac2-4b42-8b8d-ba6e22fcd4da')
def test_create_flavor_using_string_ram(self):
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)

View File

@ -15,6 +15,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.lib import decorators
from tempest import test
@ -47,7 +48,7 @@ class FlavorsAccessTestJSON(base.BaseV2ComputeAdminTest):
cls.vcpus = 1
cls.disk = 10
@test.idempotent_id('ea2c2211-29fa-4db9-97c3-906d36fad3e0')
@decorators.idempotent_id('ea2c2211-29fa-4db9-97c3-906d36fad3e0')
def test_flavor_access_list_with_private_flavor(self):
# Test to make sure that list flavor access on a newly created
# private flavor will return an empty access list
@ -63,7 +64,7 @@ class FlavorsAccessTestJSON(base.BaseV2ComputeAdminTest):
['flavor_access'])
self.assertEqual(len(flavor_access), 0, str(flavor_access))
@test.idempotent_id('59e622f6-bdf6-45e3-8ba8-fedad905a6b4')
@decorators.idempotent_id('59e622f6-bdf6-45e3-8ba8-fedad905a6b4')
def test_flavor_access_add_remove(self):
# Test to add and remove flavor access to a given tenant.
flavor_name = data_utils.rand_name(self.flavor_name_prefix)

View File

@ -15,6 +15,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest import test
@ -48,7 +49,7 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest):
cls.disk = 10
@test.attr(type=['negative'])
@test.idempotent_id('0621c53e-d45d-40e7-951d-43e5e257b272')
@decorators.idempotent_id('0621c53e-d45d-40e7-951d-43e5e257b272')
def test_flavor_access_list_with_public_flavor(self):
# Test to list flavor access with exceptions by querying public flavor
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
@ -64,7 +65,7 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest):
new_flavor_id)
@test.attr(type=['negative'])
@test.idempotent_id('41eaaade-6d37-4f28-9c74-f21b46ca67bd')
@decorators.idempotent_id('41eaaade-6d37-4f28-9c74-f21b46ca67bd')
def test_flavor_non_admin_add(self):
# Test to add flavor access as a user without admin privileges.
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
@ -81,7 +82,7 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest):
self.tenant_id)
@test.attr(type=['negative'])
@test.idempotent_id('073e79a6-c311-4525-82dc-6083d919cb3a')
@decorators.idempotent_id('073e79a6-c311-4525-82dc-6083d919cb3a')
def test_flavor_non_admin_remove(self):
# Test to remove flavor access as a user without admin privileges.
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
@ -102,7 +103,7 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest):
self.tenant_id)
@test.attr(type=['negative'])
@test.idempotent_id('f3592cc0-0306-483c-b210-9a7b5346eddc')
@decorators.idempotent_id('f3592cc0-0306-483c-b210-9a7b5346eddc')
def test_add_flavor_access_duplicate(self):
# Create a new flavor.
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
@ -127,7 +128,7 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest):
self.tenant_id)
@test.attr(type=['negative'])
@test.idempotent_id('1f710927-3bc7-4381-9f82-0ca6e42644b7')
@decorators.idempotent_id('1f710927-3bc7-4381-9f82-0ca6e42644b7')
def test_remove_flavor_access_not_found(self):
# Create a new flavor.
flavor_name = data_utils.rand_name(self.flavor_name_prefix)

View File

@ -15,6 +15,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.lib import decorators
from tempest import test
@ -63,7 +64,7 @@ class FlavorsExtraSpecsTestJSON(base.BaseV2ComputeAdminTest):
cls.client.wait_for_resource_deletion(cls.flavor['id'])
super(FlavorsExtraSpecsTestJSON, cls).resource_cleanup()
@test.idempotent_id('0b2f9d4b-1ca2-4b99-bb40-165d4bb94208')
@decorators.idempotent_id('0b2f9d4b-1ca2-4b99-bb40-165d4bb94208')
def test_flavor_set_get_update_show_unset_keys(self):
# Test to SET, GET, UPDATE, SHOW, UNSET flavor extra
# spec as a user with admin privileges.
@ -95,7 +96,7 @@ class FlavorsExtraSpecsTestJSON(base.BaseV2ComputeAdminTest):
self.client.unset_flavor_extra_spec(self.flavor['id'], "key1")
self.client.unset_flavor_extra_spec(self.flavor['id'], "key2")
@test.idempotent_id('a99dad88-ae1c-4fba-aeb4-32f898218bd0')
@decorators.idempotent_id('a99dad88-ae1c-4fba-aeb4-32f898218bd0')
def test_flavor_non_admin_get_all_keys(self):
specs = {"key1": "value1", "key2": "value2"}
self.client.set_flavor_extra_spec(self.flavor['id'], **specs)
@ -105,7 +106,7 @@ class FlavorsExtraSpecsTestJSON(base.BaseV2ComputeAdminTest):
for key in specs:
self.assertEqual(body[key], specs[key])
@test.idempotent_id('12805a7f-39a3-4042-b989-701d5cad9c90')
@decorators.idempotent_id('12805a7f-39a3-4042-b989-701d5cad9c90')
def test_flavor_non_admin_get_specific_key(self):
body = self.client.set_flavor_extra_spec(self.flavor['id'],
key1="value1",

View File

@ -16,6 +16,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest import test
@ -66,7 +67,7 @@ class FlavorsExtraSpecsNegativeTestJSON(base.BaseV2ComputeAdminTest):
super(FlavorsExtraSpecsNegativeTestJSON, cls).resource_cleanup()
@test.attr(type=['negative'])
@test.idempotent_id('a00a3b81-5641-45a8-ab2b-4a8ec41e1d7d')
@decorators.idempotent_id('a00a3b81-5641-45a8-ab2b-4a8ec41e1d7d')
def test_flavor_non_admin_set_keys(self):
# Test to SET flavor extra spec as a user without admin privileges.
self.assertRaises(lib_exc.Forbidden,
@ -75,7 +76,7 @@ class FlavorsExtraSpecsNegativeTestJSON(base.BaseV2ComputeAdminTest):
key1="value1", key2="value2")
@test.attr(type=['negative'])
@test.idempotent_id('1ebf4ef8-759e-48fe-a801-d451d80476fb')
@decorators.idempotent_id('1ebf4ef8-759e-48fe-a801-d451d80476fb')
def test_flavor_non_admin_update_specific_key(self):
# non admin user is not allowed to update flavor extra spec
body = self.client.set_flavor_extra_spec(
@ -89,7 +90,7 @@ class FlavorsExtraSpecsNegativeTestJSON(base.BaseV2ComputeAdminTest):
key1='value1_new')
@test.attr(type=['negative'])
@test.idempotent_id('28f12249-27c7-44c1-8810-1f382f316b11')
@decorators.idempotent_id('28f12249-27c7-44c1-8810-1f382f316b11')
def test_flavor_non_admin_unset_keys(self):
self.client.set_flavor_extra_spec(self.flavor['id'],
key1="value1", key2="value2")
@ -100,7 +101,7 @@ class FlavorsExtraSpecsNegativeTestJSON(base.BaseV2ComputeAdminTest):
'key1')
@test.attr(type=['negative'])
@test.idempotent_id('440b9f3f-3c7f-4293-a106-0ceda350f8de')
@decorators.idempotent_id('440b9f3f-3c7f-4293-a106-0ceda350f8de')
def test_flavor_unset_nonexistent_key(self):
self.assertRaises(lib_exc.NotFound,
self.client.unset_flavor_extra_spec,
@ -108,7 +109,7 @@ class FlavorsExtraSpecsNegativeTestJSON(base.BaseV2ComputeAdminTest):
'nonexistent_key')
@test.attr(type=['negative'])
@test.idempotent_id('329a7be3-54b2-48be-8052-bf2ce4afd898')
@decorators.idempotent_id('329a7be3-54b2-48be-8052-bf2ce4afd898')
def test_flavor_get_nonexistent_key(self):
self.assertRaises(lib_exc.NotFound,
self.flavors_client.show_flavor_extra_spec,
@ -116,7 +117,7 @@ class FlavorsExtraSpecsNegativeTestJSON(base.BaseV2ComputeAdminTest):
"nonexistent_key")
@test.attr(type=['negative'])
@test.idempotent_id('25b822b8-9f49-44f6-80de-d99f0482e5cb')
@decorators.idempotent_id('25b822b8-9f49-44f6-80de-d99f0482e5cb')
def test_flavor_update_mismatch_key(self):
# the key will be updated should be match the key in the body
self.assertRaises(lib_exc.BadRequest,
@ -126,7 +127,7 @@ class FlavorsExtraSpecsNegativeTestJSON(base.BaseV2ComputeAdminTest):
key1="value")
@test.attr(type=['negative'])
@test.idempotent_id('f5889590-bf66-41cc-b4b1-6e6370cfd93f')
@decorators.idempotent_id('f5889590-bf66-41cc-b4b1-6e6370cfd93f')
def test_flavor_update_more_key(self):
# there should be just one item in the request body
self.assertRaises(lib_exc.BadRequest,

View File

@ -18,6 +18,7 @@ import netaddr
from tempest.api.compute import base
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
@ -55,7 +56,7 @@ class FloatingIPsBulkAdminTestJSON(base.BaseV2ComputeAdminTest):
raise exceptions.InvalidConfiguration(msg)
return
@test.idempotent_id('2c8f145f-8012-4cb8-ac7e-95a587f0e4ab')
@decorators.idempotent_id('2c8f145f-8012-4cb8-ac7e-95a587f0e4ab')
@test.services('network')
def test_create_list_delete_floating_ips_bulk(self):
# Create, List and delete the Floating IPs Bulk

View File

@ -14,7 +14,7 @@
from tempest.api.compute import base
from tempest.common import tempest_fixtures as fixtures
from tempest import test
from tempest.lib import decorators
class HostsAdminTestJSON(base.BaseV2ComputeAdminTest):
@ -25,12 +25,12 @@ class HostsAdminTestJSON(base.BaseV2ComputeAdminTest):
super(HostsAdminTestJSON, cls).setup_clients()
cls.client = cls.os_adm.hosts_client
@test.idempotent_id('9bfaf98d-e2cb-44b0-a07e-2558b2821e4f')
@decorators.idempotent_id('9bfaf98d-e2cb-44b0-a07e-2558b2821e4f')
def test_list_hosts(self):
hosts = self.client.list_hosts()['hosts']
self.assertGreaterEqual(len(hosts), 2, str(hosts))
@test.idempotent_id('5dc06f5b-d887-47a2-bb2a-67762ef3c6de')
@decorators.idempotent_id('5dc06f5b-d887-47a2-bb2a-67762ef3c6de')
def test_list_hosts_with_zone(self):
self.useFixture(fixtures.LockFixture('availability_zone'))
hosts = self.client.list_hosts()['hosts']
@ -39,21 +39,21 @@ class HostsAdminTestJSON(base.BaseV2ComputeAdminTest):
self.assertGreaterEqual(len(hosts), 1)
self.assertIn(host, hosts)
@test.idempotent_id('9af3c171-fbf4-4150-a624-22109733c2a6')
@decorators.idempotent_id('9af3c171-fbf4-4150-a624-22109733c2a6')
def test_list_hosts_with_a_blank_zone(self):
# If send the request with a blank zone, the request will be successful
# and it will return all the hosts list
hosts = self.client.list_hosts(zone='')['hosts']
self.assertNotEqual(0, len(hosts))
@test.idempotent_id('c6ddbadb-c94e-4500-b12f-8ffc43843ff8')
@decorators.idempotent_id('c6ddbadb-c94e-4500-b12f-8ffc43843ff8')
def test_list_hosts_with_nonexistent_zone(self):
# If send the request with a nonexistent zone, the request will be
# successful and no hosts will be returned
hosts = self.client.list_hosts(zone='xxx')['hosts']
self.assertEqual(0, len(hosts))
@test.idempotent_id('38adbb12-aee2-4498-8aec-329c72423aa4')
@decorators.idempotent_id('38adbb12-aee2-4498-8aec-329c72423aa4')
def test_show_host_detail(self):
hosts = self.client.list_hosts()['hosts']

View File

@ -13,6 +13,7 @@
# under the License.
from tempest.api.compute import base
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest import test
@ -35,26 +36,26 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
cls.hostname = hosts[0]['host_name']
@test.attr(type=['negative'])
@test.idempotent_id('dd032027-0210-4d9c-860e-69b1b8deed5f')
@decorators.idempotent_id('dd032027-0210-4d9c-860e-69b1b8deed5f')
def test_list_hosts_with_non_admin_user(self):
self.assertRaises(lib_exc.Forbidden,
self.non_admin_client.list_hosts)
@test.attr(type=['negative'])
@test.idempotent_id('e75b0a1a-041f-47a1-8b4a-b72a6ff36d3f')
@decorators.idempotent_id('e75b0a1a-041f-47a1-8b4a-b72a6ff36d3f')
def test_show_host_detail_with_nonexistent_hostname(self):
self.assertRaises(lib_exc.NotFound,
self.client.show_host, 'nonexistent_hostname')
@test.attr(type=['negative'])
@test.idempotent_id('19ebe09c-bfd4-4b7c-81a2-e2e0710f59cc')
@decorators.idempotent_id('19ebe09c-bfd4-4b7c-81a2-e2e0710f59cc')
def test_show_host_detail_with_non_admin_user(self):
self.assertRaises(lib_exc.Forbidden,
self.non_admin_client.show_host,
self.hostname)
@test.attr(type=['negative'])
@test.idempotent_id('e40c72b1-0239-4ed6-ba21-81a184df1f7c')
@decorators.idempotent_id('e40c72b1-0239-4ed6-ba21-81a184df1f7c')
def test_update_host_with_non_admin_user(self):
self.assertRaises(lib_exc.Forbidden,
self.non_admin_client.update_host,
@ -63,7 +64,7 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
maintenance_mode='enable')
@test.attr(type=['negative'])
@test.idempotent_id('fbe2bf3e-3246-4a95-a59f-94e4e298ec77')
@decorators.idempotent_id('fbe2bf3e-3246-4a95-a59f-94e4e298ec77')
def test_update_host_with_invalid_status(self):
# 'status' can only be 'enable' or 'disable'
self.assertRaises(lib_exc.BadRequest,
@ -73,7 +74,7 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
maintenance_mode='enable')
@test.attr(type=['negative'])
@test.idempotent_id('ab1e230e-5e22-41a9-8699-82b9947915d4')
@decorators.idempotent_id('ab1e230e-5e22-41a9-8699-82b9947915d4')
def test_update_host_with_invalid_maintenance_mode(self):
# 'maintenance_mode' can only be 'enable' or 'disable'
self.assertRaises(lib_exc.BadRequest,
@ -83,7 +84,7 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
maintenance_mode='invalid')
@test.attr(type=['negative'])
@test.idempotent_id('0cd85f75-6992-4a4a-b1bd-d11e37fd0eee')
@decorators.idempotent_id('0cd85f75-6992-4a4a-b1bd-d11e37fd0eee')
def test_update_host_without_param(self):
# 'status' or 'maintenance_mode' needed for host update
self.assertRaises(lib_exc.BadRequest,
@ -91,7 +92,7 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
self.hostname)
@test.attr(type=['negative'])
@test.idempotent_id('23c92146-2100-4d68-b2d6-c7ade970c9c1')
@decorators.idempotent_id('23c92146-2100-4d68-b2d6-c7ade970c9c1')
def test_update_nonexistent_host(self):
self.assertRaises(lib_exc.NotFound,
self.client.update_host,
@ -100,42 +101,42 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
maintenance_mode='enable')
@test.attr(type=['negative'])
@test.idempotent_id('0d981ac3-4320-4898-b674-82b61fbb60e4')
@decorators.idempotent_id('0d981ac3-4320-4898-b674-82b61fbb60e4')
def test_startup_nonexistent_host(self):
self.assertRaises(lib_exc.NotFound,
self.client.startup_host,
'nonexistent_hostname')
@test.attr(type=['negative'])
@test.idempotent_id('9f4ebb7e-b2ae-4e5b-a38f-0fd1bb0ddfca')
@decorators.idempotent_id('9f4ebb7e-b2ae-4e5b-a38f-0fd1bb0ddfca')
def test_startup_host_with_non_admin_user(self):
self.assertRaises(lib_exc.Forbidden,
self.non_admin_client.startup_host,
self.hostname)
@test.attr(type=['negative'])
@test.idempotent_id('9e637444-29cf-4244-88c8-831ae82c31b6')
@decorators.idempotent_id('9e637444-29cf-4244-88c8-831ae82c31b6')
def test_shutdown_nonexistent_host(self):
self.assertRaises(lib_exc.NotFound,
self.client.shutdown_host,
'nonexistent_hostname')
@test.attr(type=['negative'])
@test.idempotent_id('a803529c-7e3f-4d3c-a7d6-8e1c203d27f6')
@decorators.idempotent_id('a803529c-7e3f-4d3c-a7d6-8e1c203d27f6')
def test_shutdown_host_with_non_admin_user(self):
self.assertRaises(lib_exc.Forbidden,
self.non_admin_client.shutdown_host,
self.hostname)
@test.attr(type=['negative'])
@test.idempotent_id('f86bfd7b-0b13-4849-ae29-0322e83ee58b')
@decorators.idempotent_id('f86bfd7b-0b13-4849-ae29-0322e83ee58b')
def test_reboot_nonexistent_host(self):
self.assertRaises(lib_exc.NotFound,
self.client.reboot_host,
'nonexistent_hostname')
@test.attr(type=['negative'])
@test.idempotent_id('02d79bb9-eb57-4612-abf6-2cb38897d2f8')
@decorators.idempotent_id('02d79bb9-eb57-4612-abf6-2cb38897d2f8')
def test_reboot_host_with_non_admin_user(self):
self.assertRaises(lib_exc.Forbidden,
self.non_admin_client.reboot_host,

View File

@ -14,7 +14,7 @@
# under the License.
from tempest.api.compute import base
from tempest import test
from tempest.lib import decorators
class HypervisorAdminTestJSON(base.BaseV2ComputeAdminTest):
@ -33,19 +33,19 @@ class HypervisorAdminTestJSON(base.BaseV2ComputeAdminTest):
def assertHypervisors(self, hypers):
self.assertGreater(len(hypers), 0, "No hypervisors found: %s" % hypers)
@test.idempotent_id('7f0ceacd-c64d-4e96-b8ee-d02943142cc5')
@decorators.idempotent_id('7f0ceacd-c64d-4e96-b8ee-d02943142cc5')
def test_get_hypervisor_list(self):
# List of hypervisor and available hypervisors hostname
hypers = self._list_hypervisors()
self.assertHypervisors(hypers)
@test.idempotent_id('1e7fdac2-b672-4ad1-97a4-bad0e3030118')
@decorators.idempotent_id('1e7fdac2-b672-4ad1-97a4-bad0e3030118')
def test_get_hypervisor_list_details(self):
# Display the details of the all hypervisor
hypers = self.client.list_hypervisors(detail=True)['hypervisors']
self.assertHypervisors(hypers)
@test.idempotent_id('94ff9eae-a183-428e-9cdb-79fde71211cc')
@decorators.idempotent_id('94ff9eae-a183-428e-9cdb-79fde71211cc')
def test_get_hypervisor_show_details(self):
# Display the details of the specified hypervisor
hypers = self._list_hypervisors()
@ -56,7 +56,7 @@ class HypervisorAdminTestJSON(base.BaseV2ComputeAdminTest):
self.assertEqual(details['hypervisor_hostname'],
hypers[0]['hypervisor_hostname'])
@test.idempotent_id('e81bba3f-6215-4e39-a286-d52d2f906862')
@decorators.idempotent_id('e81bba3f-6215-4e39-a286-d52d2f906862')
def test_get_hypervisor_show_servers(self):
# Show instances about the specific hypervisors
hypers = self._list_hypervisors()
@ -67,14 +67,14 @@ class HypervisorAdminTestJSON(base.BaseV2ComputeAdminTest):
['hypervisors'])
self.assertGreater(len(hypervisors), 0)
@test.idempotent_id('797e4f28-b6e0-454d-a548-80cc77c00816')
@decorators.idempotent_id('797e4f28-b6e0-454d-a548-80cc77c00816')
def test_get_hypervisor_stats(self):
# Verify the stats of the all hypervisor
stats = (self.client.show_hypervisor_statistics()
['hypervisor_statistics'])
self.assertGreater(len(stats), 0)
@test.idempotent_id('91a50d7d-1c2b-4f24-b55a-a1fe20efca70')
@decorators.idempotent_id('91a50d7d-1c2b-4f24-b55a-a1fe20efca70')
def test_get_hypervisor_uptime(self):
# Verify that GET shows the specified hypervisor uptime
hypers = self._list_hypervisors()
@ -113,7 +113,7 @@ class HypervisorAdminTestJSON(base.BaseV2ComputeAdminTest):
has_valid_uptime,
"None of the hypervisors had a valid uptime: %s" % hypers)
@test.idempotent_id('d7e1805b-3b14-4a3b-b6fd-50ec6d9f361f')
@decorators.idempotent_id('d7e1805b-3b14-4a3b-b6fd-50ec6d9f361f')
def test_search_hypervisor(self):
hypers = self._list_hypervisors()
self.assertHypervisors(hypers)

View File

@ -15,6 +15,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest import test
@ -34,7 +35,7 @@ class HypervisorAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
return hypers
@test.attr(type=['negative'])
@test.idempotent_id('c136086a-0f67-4b2b-bc61-8482bd68989f')
@decorators.idempotent_id('c136086a-0f67-4b2b-bc61-8482bd68989f')
def test_show_nonexistent_hypervisor(self):
nonexistent_hypervisor_id = data_utils.rand_uuid()
@ -44,7 +45,7 @@ class HypervisorAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
nonexistent_hypervisor_id)
@test.attr(type=['negative'])
@test.idempotent_id('51e663d0-6b89-4817-a465-20aca0667d03')
@decorators.idempotent_id('51e663d0-6b89-4817-a465-20aca0667d03')
def test_show_hypervisor_with_non_admin_user(self):
hypers = self._list_hypervisors()
self.assertGreater(len(hypers), 0)
@ -55,7 +56,7 @@ class HypervisorAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
hypers[0]['id'])
@test.attr(type=['negative'])
@test.idempotent_id('2a0a3938-832e-4859-95bf-1c57c236b924')
@decorators.idempotent_id('2a0a3938-832e-4859-95bf-1c57c236b924')
def test_show_servers_with_non_admin_user(self):
hypers = self._list_hypervisors()
self.assertGreater(len(hypers), 0)
@ -66,7 +67,7 @@ class HypervisorAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
hypers[0]['id'])
@test.attr(type=['negative'])
@test.idempotent_id('02463d69-0ace-4d33-a4a8-93d7883a2bba')
@decorators.idempotent_id('02463d69-0ace-4d33-a4a8-93d7883a2bba')
def test_show_servers_with_nonexistent_hypervisor(self):
nonexistent_hypervisor_id = data_utils.rand_uuid()
@ -76,14 +77,14 @@ class HypervisorAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
nonexistent_hypervisor_id)
@test.attr(type=['negative'])
@test.idempotent_id('e2b061bb-13f9-40d8-9d6e-d5bf17595849')
@decorators.idempotent_id('e2b061bb-13f9-40d8-9d6e-d5bf17595849')
def test_get_hypervisor_stats_with_non_admin_user(self):
self.assertRaises(
lib_exc.Forbidden,
self.non_adm_client.show_hypervisor_statistics)
@test.attr(type=['negative'])
@test.idempotent_id('f60aa680-9a3a-4c7d-90e1-fae3a4891303')
@decorators.idempotent_id('f60aa680-9a3a-4c7d-90e1-fae3a4891303')
def test_get_nonexistent_hypervisor_uptime(self):
nonexistent_hypervisor_id = data_utils.rand_uuid()
@ -93,7 +94,7 @@ class HypervisorAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
nonexistent_hypervisor_id)
@test.attr(type=['negative'])
@test.idempotent_id('6c3461f9-c04c-4e2a-bebb-71dc9cb47df2')
@decorators.idempotent_id('6c3461f9-c04c-4e2a-bebb-71dc9cb47df2')
def test_get_hypervisor_uptime_with_non_admin_user(self):
hypers = self._list_hypervisors()
self.assertGreater(len(hypers), 0)
@ -104,7 +105,7 @@ class HypervisorAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
hypers[0]['id'])
@test.attr(type=['negative'])
@test.idempotent_id('51b3d536-9b14-409c-9bce-c6f7c794994e')
@decorators.idempotent_id('51b3d536-9b14-409c-9bce-c6f7c794994e')
def test_get_hypervisor_list_with_non_admin_user(self):
# List of hypervisor and available services with non admin user
self.assertRaises(
@ -112,7 +113,7 @@ class HypervisorAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
self.non_adm_client.list_hypervisors)
@test.attr(type=['negative'])
@test.idempotent_id('dc02db05-e801-4c5f-bc8e-d915290ab345')
@decorators.idempotent_id('dc02db05-e801-4c5f-bc8e-d915290ab345')
def test_get_hypervisor_list_details_with_non_admin_user(self):
# List of hypervisor details and available services with non admin user
self.assertRaises(
@ -120,7 +121,7 @@ class HypervisorAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
self.non_adm_client.list_hypervisors, detail=True)
@test.attr(type=['negative'])
@test.idempotent_id('19a45cc1-1000-4055-b6d2-28e8b2ec4faa')
@decorators.idempotent_id('19a45cc1-1000-4055-b6d2-28e8b2ec4faa')
def test_search_nonexistent_hypervisor(self):
self.assertRaises(
lib_exc.NotFound,
@ -128,7 +129,7 @@ class HypervisorAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
'nonexistent_hypervisor_name')
@test.attr(type=['negative'])
@test.idempotent_id('5b6a6c79-5dc1-4fa5-9c58-9c8085948e74')
@decorators.idempotent_id('5b6a6c79-5dc1-4fa5-9c58-9c8085948e74')
def test_search_hypervisor_with_non_admin_user(self):
hypers = self._list_hypervisors()
self.assertGreater(len(hypers), 0)

View File

@ -18,7 +18,7 @@ import datetime
from six.moves.urllib import parse as urllib
from tempest.api.compute import base
from tempest import test
from tempest.lib import decorators
class InstanceUsageAuditLogTestJSON(base.BaseV2ComputeAdminTest):
@ -28,7 +28,7 @@ class InstanceUsageAuditLogTestJSON(base.BaseV2ComputeAdminTest):
super(InstanceUsageAuditLogTestJSON, cls).setup_clients()
cls.adm_client = cls.os_adm.instance_usages_audit_log_client
@test.idempotent_id('25319919-33d9-424f-9f99-2c203ee48b9d')
@decorators.idempotent_id('25319919-33d9-424f-9f99-2c203ee48b9d')
def test_list_instance_usage_audit_logs(self):
# list instance usage audit logs
body = (self.adm_client.list_instance_usage_audit_logs()
@ -41,7 +41,7 @@ class InstanceUsageAuditLogTestJSON(base.BaseV2ComputeAdminTest):
for item in expected_items:
self.assertIn(item, body)
@test.idempotent_id('6e40459d-7c5f-400b-9e83-449fbc8e7feb')
@decorators.idempotent_id('6e40459d-7c5f-400b-9e83-449fbc8e7feb')
def test_get_instance_usage_audit_log(self):
# Get instance usage audit log before specified time
now = datetime.datetime.now()

View File

@ -18,6 +18,7 @@ import datetime
from six.moves.urllib import parse as urllib
from tempest.api.compute import base
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest import test
@ -30,7 +31,7 @@ class InstanceUsageAuditLogNegativeTestJSON(base.BaseV2ComputeAdminTest):
cls.adm_client = cls.os_adm.instance_usages_audit_log_client
@test.attr(type=['negative'])
@test.idempotent_id('a9d33178-d2c9-4131-ad3b-f4ca8d0308a2')
@decorators.idempotent_id('a9d33178-d2c9-4131-ad3b-f4ca8d0308a2')
def test_instance_usage_audit_logs_with_nonadmin_user(self):
# the instance_usage_audit_logs API just can be accessed by admin user
self.assertRaises(lib_exc.Forbidden,
@ -43,7 +44,7 @@ class InstanceUsageAuditLogNegativeTestJSON(base.BaseV2ComputeAdminTest):
urllib.quote(now.strftime("%Y-%m-%d %H:%M:%S")))
@test.attr(type=['negative'])
@test.idempotent_id('9b952047-3641-41c7-ba91-a809fc5974c8')
@decorators.idempotent_id('9b952047-3641-41c7-ba91-a809fc5974c8')
def test_get_instance_usage_audit_logs_with_invalid_time(self):
self.assertRaises(lib_exc.BadRequest,
self.adm_client.show_instance_usage_audit_log,

View File

@ -15,7 +15,7 @@
from tempest.api.compute.keypairs import base
from tempest.common.utils import data_utils
from tempest import test
from tempest.lib import decorators
class KeyPairsV210TestJSON(base.BaseKeypairTest):
@ -45,7 +45,7 @@ class KeyPairsV210TestJSON(base.BaseKeypairTest):
key_list.append(keypair)
return key_list
@test.idempotent_id('3c8484af-cfb3-48f6-b8ba-d5d58bbf3eac')
@decorators.idempotent_id('3c8484af-cfb3-48f6-b8ba-d5d58bbf3eac')
def test_admin_manage_keypairs_for_other_users(self):
user_id = self.non_admin_client.user_id
key_list = self._create_and_check_keypairs(user_id)

View File

@ -117,23 +117,23 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
self.assertEqual(target_host, self._get_host_for_server(server_id),
msg)
@test.idempotent_id('1dce86b8-eb04-4c03-a9d8-9c1dc3ee0c7b')
@decorators.idempotent_id('1dce86b8-eb04-4c03-a9d8-9c1dc3ee0c7b')
def test_live_block_migration(self):
self._test_live_migration()
@test.idempotent_id('1e107f21-61b2-4988-8f22-b196e938ab88')
@decorators.idempotent_id('1e107f21-61b2-4988-8f22-b196e938ab88')
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
'Pause is not available.')
def test_live_block_migration_paused(self):
self._test_live_migration(state='PAUSED')
@decorators.skip_because(bug="1524898")
@test.idempotent_id('5071cf17-3004-4257-ae61-73a84e28badd')
@decorators.idempotent_id('5071cf17-3004-4257-ae61-73a84e28badd')
@test.services('volume')
def test_volume_backed_live_migration(self):
self._test_live_migration(volume_backed=True)
@test.idempotent_id('e19c0cc6-6720-4ed8-be83-b6603ed5c812')
@decorators.idempotent_id('e19c0cc6-6720-4ed8-be83-b6603ed5c812')
@testtools.skipIf(not CONF.compute_feature_enabled.
block_migration_for_live_migration,
'Block Live migration not available')

View File

@ -18,8 +18,8 @@ from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.common import waiters
from tempest import config
from tempest.lib import decorators
from tempest.lib import exceptions
from tempest import test
CONF = config.CONF
@ -33,12 +33,12 @@ class MigrationsAdminTest(base.BaseV2ComputeAdminTest):
cls.flavors_admin_client = cls.os_adm.flavors_client
cls.admin_servers_client = cls.os_adm.servers_client
@test.idempotent_id('75c0b83d-72a0-4cf8-a153-631e83e7d53f')
@decorators.idempotent_id('75c0b83d-72a0-4cf8-a153-631e83e7d53f')
def test_list_migrations(self):
# Admin can get the migrations list
self.client.list_migrations()
@test.idempotent_id('1b512062-8093-438e-b47a-37d2f597cd64')
@decorators.idempotent_id('1b512062-8093-438e-b47a-37d2f597cd64')
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
'Resize not available.')
def test_list_migrations_in_flavor_resize_situation(self):
@ -60,7 +60,7 @@ class MigrationsAdminTest(base.BaseV2ComputeAdminTest):
except exceptions.NotFound:
pass
@test.idempotent_id('33f1fec3-ba18-4470-8e4e-1d888e7c3593')
@decorators.idempotent_id('33f1fec3-ba18-4470-8e4e-1d888e7c3593')
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
'Resize not available.')
def test_resize_server_revert_deleted_flavor(self):
@ -127,13 +127,13 @@ class MigrationsAdminTest(base.BaseV2ComputeAdminTest):
server['id'])['server']['OS-EXT-SRV-ATTR:host']
assert_func(src_host, dst_host)
@test.idempotent_id('4bf0be52-3b6f-4746-9a27-3143636fe30d')
@decorators.idempotent_id('4bf0be52-3b6f-4746-9a27-3143636fe30d')
@testtools.skipUnless(CONF.compute_feature_enabled.cold_migration,
'Cold migration not available.')
def test_cold_migration(self):
self._test_cold_migrate_server(revert=False)
@test.idempotent_id('caa1aa8b-f4ef-4374-be0d-95f001c2ac2d')
@decorators.idempotent_id('caa1aa8b-f4ef-4374-be0d-95f001c2ac2d')
@testtools.skipUnless(CONF.compute_feature_enabled.cold_migration,
'Cold migration not available.')
def test_revert_cold_migration(self):

View File

@ -15,7 +15,7 @@
from tempest.api.compute import base
from tempest import config
from tempest import test
from tempest.lib import decorators
CONF = config.CONF
@ -32,7 +32,7 @@ class NetworksTest(base.BaseV2ComputeAdminTest):
super(NetworksTest, cls).setup_clients()
cls.client = cls.os_adm.compute_networks_client
@test.idempotent_id('d206d211-8912-486f-86e2-a9d090d1f416')
@decorators.idempotent_id('d206d211-8912-486f-86e2-a9d090d1f416')
def test_get_network(self):
networks = self.client.list_networks()['networks']
if CONF.compute.fixed_network_name:
@ -53,7 +53,7 @@ class NetworksTest(base.BaseV2ComputeAdminTest):
['network'])
self.assertEqual(configured_network['label'], network['label'])
@test.idempotent_id('df3d1046-6fa5-4b2c-ad0c-cfa46a351cb9')
@decorators.idempotent_id('df3d1046-6fa5-4b2c-ad0c-cfa46a351cb9')
def test_list_all_networks(self):
networks = self.client.list_networks()['networks']
# Check the configured network is in the list

View File

@ -19,7 +19,7 @@ from testtools import matchers
from tempest.api.compute import base
from tempest.common import tempest_fixtures as fixtures
from tempest.common.utils import data_utils
from tempest import test
from tempest.lib import decorators
LOG = logging.getLogger(__name__)
@ -53,7 +53,7 @@ class QuotasAdminTestJSON(base.BaseV2ComputeAdminTest):
'instances', 'security_group_rules',
'cores', 'security_groups'))
@test.idempotent_id('3b0a7c8f-cf58-46b8-a60c-715a32a8ba7d')
@decorators.idempotent_id('3b0a7c8f-cf58-46b8-a60c-715a32a8ba7d')
def test_get_default_quotas(self):
# Admin can get the default resource quota set for a tenant
expected_quota_set = self.default_quota_set | set(['id'])
@ -63,7 +63,7 @@ class QuotasAdminTestJSON(base.BaseV2ComputeAdminTest):
for quota in expected_quota_set:
self.assertIn(quota, quota_set.keys())
@test.idempotent_id('55fbe2bf-21a9-435b-bbd2-4162b0ed799a')
@decorators.idempotent_id('55fbe2bf-21a9-435b-bbd2-4162b0ed799a')
def test_update_all_quota_resources_for_tenant(self):
# Admin can update all the resource quota limits for a tenant
default_quota_set = self.adm_client.show_default_quota_set(
@ -88,7 +88,7 @@ class QuotasAdminTestJSON(base.BaseV2ComputeAdminTest):
self.assertIn(quota, quota_set.keys())
# TODO(afazekas): merge these test cases
@test.idempotent_id('ce9e0815-8091-4abd-8345-7fe5b85faa1d')
@decorators.idempotent_id('ce9e0815-8091-4abd-8345-7fe5b85faa1d')
def test_get_updated_quotas(self):
# Verify that GET shows the updated quota set of project
project_name = data_utils.rand_name('cpu_quota_project')
@ -120,7 +120,7 @@ class QuotasAdminTestJSON(base.BaseV2ComputeAdminTest):
project_id, user_id=user_id)['quota_set']
self.assertEqual(2048, quota_set['ram'])
@test.idempotent_id('389d04f0-3a41-405f-9317-e5f86e3c44f0')
@decorators.idempotent_id('389d04f0-3a41-405f-9317-e5f86e3c44f0')
def test_delete_quota(self):
# Admin can delete the resource quota set for a project
project_name = data_utils.rand_name('ram_quota_project')
@ -164,7 +164,7 @@ class QuotaClassesAdminTestJSON(base.BaseV2ComputeAdminTest):
# global state, and possibly needs to be part of a set of
# tests that get run all by themselves at the end under a
# 'danger' flag.
@test.idempotent_id('7932ab0f-5136-4075-b201-c0e2338df51a')
@decorators.idempotent_id('7932ab0f-5136-4075-b201-c0e2338df51a')
def test_update_default_quotas(self):
LOG.debug("get the current 'default' quota class values")
body = (self.adm_client.show_quota_class_set('default')

View File

@ -52,7 +52,7 @@ class QuotasAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
**{quota_item: default_quota_value})
@test.attr(type=['negative'])
@test.idempotent_id('733abfe8-166e-47bb-8363-23dbd7ff3476')
@decorators.idempotent_id('733abfe8-166e-47bb-8363-23dbd7ff3476')
def test_update_quota_normal_user(self):
self.assertRaises(lib_exc.Forbidden,
self.client.update_quota_set,
@ -62,7 +62,7 @@ class QuotasAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
# TODO(afazekas): Add dedicated tenant to the skipped quota tests.
# It can be moved into the setUpClass as well.
@test.attr(type=['negative'])
@test.idempotent_id('91058876-9947-4807-9f22-f6eb17140d9b')
@decorators.idempotent_id('91058876-9947-4807-9f22-f6eb17140d9b')
def test_create_server_when_cpu_quota_is_full(self):
# Disallow server creation when tenant's vcpu quota is full
self._update_quota('cores', 0)
@ -70,7 +70,7 @@ class QuotasAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
self.create_test_server)
@test.attr(type=['negative'])
@test.idempotent_id('6fdd7012-584d-4327-a61c-49122e0d5864')
@decorators.idempotent_id('6fdd7012-584d-4327-a61c-49122e0d5864')
def test_create_server_when_memory_quota_is_full(self):
# Disallow server creation when tenant's memory quota is full
self._update_quota('ram', 0)
@ -78,7 +78,7 @@ class QuotasAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
self.create_test_server)
@test.attr(type=['negative'])
@test.idempotent_id('7c6be468-0274-449a-81c3-ac1c32ee0161')
@decorators.idempotent_id('7c6be468-0274-449a-81c3-ac1c32ee0161')
def test_create_server_when_instances_quota_is_full(self):
# Once instances quota limit is reached, disallow server creation
self._update_quota('instances', 0)
@ -87,7 +87,7 @@ class QuotasAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
@decorators.skip_because(bug="1186354",
condition=CONF.service_available.neutron)
@test.idempotent_id('7c6c8f3b-2bf6-4918-b240-57b136a66aa0')
@decorators.idempotent_id('7c6c8f3b-2bf6-4918-b240-57b136a66aa0')
@test.services('network')
def test_security_groups_exceed_limit(self):
# Negative test: Creation Security Groups over limit should FAIL
@ -106,7 +106,7 @@ class QuotasAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
@decorators.skip_because(bug="1186354",
condition=CONF.service_available.neutron)
@test.attr(type=['negative'])
@test.idempotent_id('6e9f436d-f1ed-4f8e-a493-7275dfaa4b4d')
@decorators.idempotent_id('6e9f436d-f1ed-4f8e-a493-7275dfaa4b4d')
@test.services('network')
def test_security_groups_rules_exceed_limit(self):
# Negative test: Creation of Security Group Rules should FAIL

View File

@ -16,8 +16,8 @@ import testtools
from tempest.api.compute import base
from tempest import config
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest import test
CONF = config.CONF
@ -55,7 +55,7 @@ class SecurityGroupDefaultRulesTest(base.BaseV2ComputeAdminTest):
self.assertEqual(cidr, rule['ip_range']['cidr'])
return rule
@test.idempotent_id('6d880615-eec3-4d29-97c5-7a074dde239d')
@decorators.idempotent_id('6d880615-eec3-4d29-97c5-7a074dde239d')
def test_create_delete_security_group_default_rules(self):
# Create and delete Security Group default rule
ip_protocols = ['tcp', 'udp', 'icmp']
@ -67,7 +67,7 @@ class SecurityGroupDefaultRulesTest(base.BaseV2ComputeAdminTest):
self.adm_client.show_security_group_default_rule,
rule['id'])
@test.idempotent_id('4d752e0a-33a1-4c3a-b498-ff8667ca22e5')
@decorators.idempotent_id('4d752e0a-33a1-4c3a-b498-ff8667ca22e5')
def test_create_security_group_default_rule_without_cidr(self):
ip_protocol = 'udp'
from_port = 80
@ -81,7 +81,7 @@ class SecurityGroupDefaultRulesTest(base.BaseV2ComputeAdminTest):
self.assertNotEqual(0, rule['id'])
self.assertEqual('0.0.0.0/0', rule['ip_range']['cidr'])
@test.idempotent_id('29f2d218-69b0-4a95-8f3d-6bd0ef732b3a')
@decorators.idempotent_id('29f2d218-69b0-4a95-8f3d-6bd0ef732b3a')
def test_create_security_group_default_rule_with_blank_cidr(self):
ip_protocol = 'icmp'
from_port = 10
@ -97,7 +97,7 @@ class SecurityGroupDefaultRulesTest(base.BaseV2ComputeAdminTest):
self.assertNotEqual(0, rule['id'])
self.assertEqual('0.0.0.0/0', rule['ip_range']['cidr'])
@test.idempotent_id('6e6de55e-9146-4ae0-89f2-3569586e0b9b')
@decorators.idempotent_id('6e6de55e-9146-4ae0-89f2-3569586e0b9b')
def test_security_group_default_rules_list(self):
ip_protocol = 'tcp'
from_port = 22
@ -114,7 +114,7 @@ class SecurityGroupDefaultRulesTest(base.BaseV2ComputeAdminTest):
self.assertNotEqual(0, len(rules))
self.assertIn(rule, rules)
@test.idempotent_id('15cbb349-86b4-4f71-a048-04b7ef3f150b')
@decorators.idempotent_id('15cbb349-86b4-4f71-a048-04b7ef3f150b')
def test_default_security_group_default_rule_show(self):
ip_protocol = 'tcp'
from_port = 22

View File

@ -15,6 +15,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.lib import decorators
from tempest import test
@ -32,7 +33,7 @@ class SecurityGroupsTestAdminJSON(base.BaseV2ComputeAdminTest):
else:
self.client.delete_security_group(securitygroup_id)
@test.idempotent_id('49667619-5af9-4c63-ab5d-2cfdd1c8f7f1')
@decorators.idempotent_id('49667619-5af9-4c63-ab5d-2cfdd1c8f7f1')
@test.services('network')
def test_list_security_groups_list_all_tenants_filter(self):
# Admin can list security groups of all tenants

View File

@ -18,7 +18,6 @@ from tempest.common import fixed_network
from tempest.common.utils import data_utils
from tempest.common import waiters
from tempest.lib import decorators
from tempest import test
class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
@ -44,7 +43,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
wait_until='ACTIVE')
cls.s2_id = server['id']
@test.idempotent_id('06f960bb-15bb-48dc-873d-f96e89be7870')
@decorators.idempotent_id('06f960bb-15bb-48dc-873d-f96e89be7870')
def test_list_servers_filter_by_error_status(self):
# Filter the list of servers by server error status
params = {'status': 'error'}
@ -60,14 +59,14 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
self.assertIn(self.s1_id, map(lambda x: x['id'], servers))
self.assertNotIn(self.s2_id, map(lambda x: x['id'], servers))
@test.idempotent_id('d56e9540-73ed-45e0-9b88-98fc419087eb')
@decorators.idempotent_id('d56e9540-73ed-45e0-9b88-98fc419087eb')
def test_list_servers_detailed_filter_by_invalid_status(self):
params = {'status': 'invalid_status'}
body = self.client.list_servers(detail=True, **params)
servers = body['servers']
self.assertEqual([], servers)
@test.idempotent_id('51717b38-bdc1-458b-b636-1cf82d99f62f')
@decorators.idempotent_id('51717b38-bdc1-458b-b636-1cf82d99f62f')
def test_list_servers_by_admin(self):
# Listing servers by admin user returns a list which doesn't
# contain the other tenants' server by default
@ -80,7 +79,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
self.assertNotIn(self.s1_name, servers_name)
self.assertNotIn(self.s2_name, servers_name)
@test.idempotent_id('9f5579ae-19b4-4985-a091-2a5d56106580')
@decorators.idempotent_id('9f5579ae-19b4-4985-a091-2a5d56106580')
def test_list_servers_by_admin_with_all_tenants(self):
# Listing servers by admin user with all tenants parameter
# Here should be listed all servers
@ -92,7 +91,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
self.assertIn(self.s1_name, servers_name)
self.assertIn(self.s2_name, servers_name)
@test.idempotent_id('7e5d6b8f-454a-4ba1-8ae2-da857af8338b')
@decorators.idempotent_id('7e5d6b8f-454a-4ba1-8ae2-da857af8338b')
def test_list_servers_by_admin_with_specified_tenant(self):
# In nova v2, tenant_id is ignored unless all_tenants is specified
@ -122,7 +121,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
self.assertNotIn(self.s1_name, servers_name)
self.assertNotIn(self.s2_name, servers_name)
@test.idempotent_id('86c7a8f7-50cf-43a9-9bac-5b985317134f')
@decorators.idempotent_id('86c7a8f7-50cf-43a9-9bac-5b985317134f')
def test_list_servers_filter_by_exist_host(self):
# Filter the list of servers by existent host
name = data_utils.rand_name(self.__class__.__name__ + '-server')
@ -147,7 +146,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
self.assertNotIn(test_server['id'],
map(lambda x: x['id'], nonexistent_servers))
@test.idempotent_id('ee8ae470-db70-474d-b752-690b7892cab1')
@decorators.idempotent_id('ee8ae470-db70-474d-b752-690b7892cab1')
def test_reset_state_server(self):
# Reset server's state to 'error'
self.client.reset_state(self.s1_id, state='error')
@ -164,7 +163,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
self.assertEqual(server['status'], 'ACTIVE')
@decorators.skip_because(bug="1240043")
@test.idempotent_id('31ff3486-b8a0-4f56-a6c0-aab460531db3')
@decorators.idempotent_id('31ff3486-b8a0-4f56-a6c0-aab460531db3')
def test_get_server_diagnostics_by_admin(self):
# Retrieve server diagnostics by admin user
diagnostic = self.client.show_server_diagnostics(self.s1_id)
@ -174,7 +173,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
for key in basic_attrs:
self.assertIn(key, str(diagnostic.keys()))
@test.idempotent_id('682cb127-e5bb-4f53-87ce-cb9003604442')
@decorators.idempotent_id('682cb127-e5bb-4f53-87ce-cb9003604442')
def test_rebuild_server_in_error_state(self):
# The server in error state should be rebuilt using the provided
# image and changed to ACTIVE state
@ -202,7 +201,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
rebuilt_image_id = server['image']['id']
self.assertEqual(self.image_ref_alt, rebuilt_image_id)
@test.idempotent_id('7a1323b4-a6a2-497a-96cb-76c07b945c71')
@decorators.idempotent_id('7a1323b4-a6a2-497a-96cb-76c07b945c71')
def test_reset_network_inject_network_info(self):
# Reset Network of a Server
server = self.create_test_server(wait_until='ACTIVE')
@ -210,7 +209,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
# Inject the Network Info into Server
self.client.inject_network_info(server['id'])
@test.idempotent_id('fdcd9b33-0903-4e00-a1f7-b5f6543068d6')
@decorators.idempotent_id('fdcd9b33-0903-4e00-a1f7-b5f6543068d6')
def test_create_server_with_scheduling_hint(self):
# Create a server with scheduler hints.
hints = {

View File

@ -19,6 +19,7 @@ from tempest.common import tempest_fixtures as fixtures
from tempest.common.utils import data_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
@ -56,7 +57,7 @@ class ServersAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
flavor_id = data_utils.rand_int_id(start=1000)
return flavor_id
@test.idempotent_id('28dcec23-f807-49da-822c-56a92ea3c687')
@decorators.idempotent_id('28dcec23-f807-49da-822c-56a92ea3c687')
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
'Resize not available.')
@test.attr(type=['negative'])
@ -84,7 +85,7 @@ class ServersAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
self.servers[0]['id'],
flavor_ref['id'])
@test.idempotent_id('7368a427-2f26-4ad9-9ba9-911a0ec2b0db')
@decorators.idempotent_id('7368a427-2f26-4ad9-9ba9-911a0ec2b0db')
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
'Resize not available.')
@test.attr(type=['negative'])
@ -113,27 +114,27 @@ class ServersAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
flavor_ref['id'])
@test.attr(type=['negative'])
@test.idempotent_id('b0b4d8af-1256-41ef-9ee7-25f1c19dde80')
@decorators.idempotent_id('b0b4d8af-1256-41ef-9ee7-25f1c19dde80')
def test_reset_state_server_invalid_state(self):
self.assertRaises(lib_exc.BadRequest,
self.client.reset_state, self.s1_id,
state='invalid')
@test.attr(type=['negative'])
@test.idempotent_id('4cdcc984-fab0-4577-9a9d-6d558527ee9d')
@decorators.idempotent_id('4cdcc984-fab0-4577-9a9d-6d558527ee9d')
def test_reset_state_server_invalid_type(self):
self.assertRaises(lib_exc.BadRequest,
self.client.reset_state, self.s1_id,
state=1)
@test.attr(type=['negative'])
@test.idempotent_id('e741298b-8df2-46f0-81cb-8f814ff2504c')
@decorators.idempotent_id('e741298b-8df2-46f0-81cb-8f814ff2504c')
def test_reset_state_server_nonexistent_server(self):
self.assertRaises(lib_exc.NotFound,
self.client.reset_state, '999', state='error')
@test.attr(type=['negative'])
@test.idempotent_id('e84e2234-60d2-42fa-8b30-e2d3049724ac')
@decorators.idempotent_id('e84e2234-60d2-42fa-8b30-e2d3049724ac')
def test_get_server_diagnostics_by_non_admin(self):
# Non-admin user can not view server diagnostics according to policy
self.assertRaises(lib_exc.Forbidden,
@ -141,14 +142,14 @@ class ServersAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
self.s1_id)
@test.attr(type=['negative'])
@test.idempotent_id('46a4e1ca-87ae-4d28-987a-1b6b136a0221')
@decorators.idempotent_id('46a4e1ca-87ae-4d28-987a-1b6b136a0221')
def test_migrate_non_existent_server(self):
# migrate a non existent server
self.assertRaises(lib_exc.NotFound,
self.client.migrate_server,
data_utils.rand_uuid())
@test.idempotent_id('b0b17f83-d14e-4fc4-8f31-bcc9f3cfa629')
@decorators.idempotent_id('b0b17f83-d14e-4fc4-8f31-bcc9f3cfa629')
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
'Resize not available.')
@testtools.skipUnless(CONF.compute_feature_enabled.suspend,

View File

@ -16,6 +16,7 @@ import testtools
from tempest.api.compute import base
from tempest import config
from tempest.lib import decorators
from tempest import test
CONF = config.CONF
@ -35,7 +36,7 @@ class ServersOnMultiNodesTest(base.BaseV2ComputeAdminTest):
return self.os_adm.servers_client.show_server(
server_id)['server']['OS-EXT-SRV-ATTR:host']
@test.idempotent_id('26a9d5df-6890-45f2-abc4-a659290cb130')
@decorators.idempotent_id('26a9d5df-6890-45f2-abc4-a659290cb130')
@testtools.skipUnless(
test.is_scheduler_filter_enabled("SameHostFilter"),
'SameHostFilter is not available.')
@ -49,7 +50,7 @@ class ServersOnMultiNodesTest(base.BaseV2ComputeAdminTest):
host02 = self._get_host(server02)
self.assertEqual(host01, host02)
@test.idempotent_id('cc7ca884-6e3e-42a3-a92f-c522fcf25e8e')
@decorators.idempotent_id('cc7ca884-6e3e-42a3-a92f-c522fcf25e8e')
@testtools.skipUnless(
test.is_scheduler_filter_enabled("DifferentHostFilter"),
'DifferentHostFilter is not available.')
@ -63,7 +64,7 @@ class ServersOnMultiNodesTest(base.BaseV2ComputeAdminTest):
host02 = self._get_host(server02)
self.assertNotEqual(host01, host02)
@test.idempotent_id('7869cc84-d661-4e14-9f00-c18cdc89cf57')
@decorators.idempotent_id('7869cc84-d661-4e14-9f00-c18cdc89cf57')
@testtools.skipUnless(
test.is_scheduler_filter_enabled("DifferentHostFilter"),
'DifferentHostFilter is not available.')

View File

@ -15,7 +15,7 @@
# under the License.
from tempest.api.compute import base
from tempest import test
from tempest.lib import decorators
class ServicesAdminTestJSON(base.BaseV2ComputeAdminTest):
@ -26,12 +26,12 @@ class ServicesAdminTestJSON(base.BaseV2ComputeAdminTest):
super(ServicesAdminTestJSON, cls).setup_clients()
cls.client = cls.os_adm.services_client
@test.idempotent_id('5be41ef4-53d1-41cc-8839-5c2a48a1b283')
@decorators.idempotent_id('5be41ef4-53d1-41cc-8839-5c2a48a1b283')
def test_list_services(self):
services = self.client.list_services()['services']
self.assertNotEqual(0, len(services))
@test.idempotent_id('f345b1ec-bc6e-4c38-a527-3ca2bc00bef5')
@decorators.idempotent_id('f345b1ec-bc6e-4c38-a527-3ca2bc00bef5')
def test_get_service_by_service_binary_name(self):
binary_name = 'nova-compute'
services = self.client.list_services(binary=binary_name)['services']
@ -39,7 +39,7 @@ class ServicesAdminTestJSON(base.BaseV2ComputeAdminTest):
for service in services:
self.assertEqual(binary_name, service['binary'])
@test.idempotent_id('affb42d5-5b4b-43c8-8b0b-6dca054abcca')
@decorators.idempotent_id('affb42d5-5b4b-43c8-8b0b-6dca054abcca')
def test_get_service_by_host_name(self):
services = self.client.list_services()['services']
host_name = services[0]['host']
@ -57,7 +57,7 @@ class ServicesAdminTestJSON(base.BaseV2ComputeAdminTest):
# on order.
self.assertEqual(sorted(s1), sorted(s2))
@test.idempotent_id('39397f6f-37b8-4234-8671-281e44c74025')
@decorators.idempotent_id('39397f6f-37b8-4234-8671-281e44c74025')
def test_get_service_by_service_and_host_name(self):
services = self.client.list_services()['services']
host_name = services[0]['host']

View File

@ -13,6 +13,7 @@
# under the License.
from tempest.api.compute import base
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest import test
@ -27,13 +28,13 @@ class ServicesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
cls.non_admin_client = cls.services_client
@test.attr(type=['negative'])
@test.idempotent_id('1126d1f8-266e-485f-a687-adc547492646')
@decorators.idempotent_id('1126d1f8-266e-485f-a687-adc547492646')
def test_list_services_with_non_admin_user(self):
self.assertRaises(lib_exc.Forbidden,
self.non_admin_client.list_services)
@test.attr(type=['negative'])
@test.idempotent_id('d0884a69-f693-4e79-a9af-232d15643bf7')
@decorators.idempotent_id('d0884a69-f693-4e79-a9af-232d15643bf7')
def test_get_service_by_invalid_params(self):
# return all services if send the request with invalid parameter
services = self.client.list_services()['services']
@ -42,7 +43,7 @@ class ServicesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
self.assertEqual(len(services), len(services_xxx))
@test.attr(type=['negative'])
@test.idempotent_id('1e966d4a-226e-47c7-b601-0b18a27add54')
@decorators.idempotent_id('1e966d4a-226e-47c7-b601-0b18a27add54')
def test_get_service_by_invalid_service_and_valid_host(self):
services = self.client.list_services()['services']
host_name = services[0]['host']
@ -51,7 +52,7 @@ class ServicesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
self.assertEqual(0, len(services))
@test.attr(type=['negative'])
@test.idempotent_id('64e7e7fb-69e8-4cb6-a71d-8d5eb0c98655')
@decorators.idempotent_id('64e7e7fb-69e8-4cb6-a71d-8d5eb0c98655')
def test_get_service_with_valid_service_and_invalid_host(self):
services = self.client.list_services()['services']
binary_name = services[0]['binary']

View File

@ -17,8 +17,8 @@ import datetime
from tempest.api.compute import base
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
from tempest.lib import exceptions as e
from tempest import test
# Time that waits for until returning valid response
# TODO(takmatsu): Ideally this value would come from configuration.
@ -65,7 +65,7 @@ class TenantUsagesTestJSON(base.BaseV2ComputeAdminTest):
func.__name__, duration))
return self.resp
@test.idempotent_id('062c8ae9-9912-4249-8b51-e38d664e926e')
@decorators.idempotent_id('062c8ae9-9912-4249-8b51-e38d664e926e')
def test_list_usage_all_tenants(self):
# Get usage for all tenants
tenant_usage = self.call_until_valid(
@ -73,7 +73,7 @@ class TenantUsagesTestJSON(base.BaseV2ComputeAdminTest):
start=self.start, end=self.end, detailed="1")['tenant_usages'][0]
self.assertEqual(len(tenant_usage), 8)
@test.idempotent_id('94135049-a4c5-4934-ad39-08fa7da4f22e')
@decorators.idempotent_id('94135049-a4c5-4934-ad39-08fa7da4f22e')
def test_get_usage_tenant(self):
# Get usage for a specific tenant
tenant_usage = self.call_until_valid(
@ -82,7 +82,7 @@ class TenantUsagesTestJSON(base.BaseV2ComputeAdminTest):
self.assertEqual(len(tenant_usage), 8)
@test.idempotent_id('9d00a412-b40e-4fd9-8eba-97b496316116')
@decorators.idempotent_id('9d00a412-b40e-4fd9-8eba-97b496316116')
def test_get_usage_tenant_with_non_admin_user(self):
# Get usage for a specific tenant with non admin user
tenant_usage = self.call_until_valid(

View File

@ -16,6 +16,7 @@
import datetime
from tempest.api.compute import base
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest import test
@ -41,7 +42,7 @@ class TenantUsagesNegativeTestJSON(base.BaseV2ComputeAdminTest):
return at.strftime('%Y-%m-%dT%H:%M:%S.%f')
@test.attr(type=['negative'])
@test.idempotent_id('8b21e135-d94b-4991-b6e9-87059609c8ed')
@decorators.idempotent_id('8b21e135-d94b-4991-b6e9-87059609c8ed')
def test_get_usage_tenant_with_empty_tenant_id(self):
# Get usage for a specific tenant empty
params = {'start': self.start,
@ -51,7 +52,7 @@ class TenantUsagesNegativeTestJSON(base.BaseV2ComputeAdminTest):
'', **params)
@test.attr(type=['negative'])
@test.idempotent_id('4079dd2a-9e8d-479f-869d-6fa985ce45b6')
@decorators.idempotent_id('4079dd2a-9e8d-479f-869d-6fa985ce45b6')
def test_get_usage_tenant_with_invalid_date(self):
# Get usage for tenant with invalid date
params = {'start': self.end,
@ -61,7 +62,7 @@ class TenantUsagesNegativeTestJSON(base.BaseV2ComputeAdminTest):
self.client.tenant_id, **params)
@test.attr(type=['negative'])
@test.idempotent_id('bbe6fe2c-15d8-404c-a0a2-44fad0ad5cc7')
@decorators.idempotent_id('bbe6fe2c-15d8-404c-a0a2-44fad0ad5cc7')
def test_list_usage_all_tenants_with_non_admin_user(self):
# Get usage for all tenants with non admin user
params = {'start': self.start,

View File

@ -13,6 +13,7 @@
from tempest.api.compute import base
from tempest.common import waiters
from tempest import config
from tempest.lib import decorators
from tempest import test
CONF = config.CONF
@ -43,7 +44,7 @@ class TestVolumeSwap(base.BaseV2ComputeAdminTest):
# We need the admin client for performing the update (swap) volume call
cls.servers_admin_client = cls.os_adm.servers_client
@test.idempotent_id('1769f00d-a693-4d67-a631-6a3496773813')
@decorators.idempotent_id('1769f00d-a693-4d67-a631-6a3496773813')
@test.services('volume')
def test_volume_swap(self):
# Create two volumes.

View File

@ -15,6 +15,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest import test
@ -40,7 +41,7 @@ class VolumesAdminNegativeTest(base.BaseV2ComputeAdminTest):
super(VolumesAdminNegativeTest, cls).resource_setup()
cls.server = cls.create_test_server(wait_until='ACTIVE')
@test.idempotent_id('309b5ecd-0585-4a7e-a36f-d2b2bf55259d')
@decorators.idempotent_id('309b5ecd-0585-4a7e-a36f-d2b2bf55259d')
def test_update_attached_volume_with_nonexistent_volume_in_uri(self):
volume = self.create_volume()
nonexistent_volume = data_utils.rand_uuid()
@ -50,7 +51,7 @@ class VolumesAdminNegativeTest(base.BaseV2ComputeAdminTest):
volumeId=volume['id'])
@test.related_bug('1629110', status_code=400)
@test.idempotent_id('7dcac15a-b107-46d3-a5f6-cb863f4e454a')
@decorators.idempotent_id('7dcac15a-b107-46d3-a5f6-cb863f4e454a')
def test_update_attached_volume_with_nonexistent_volume_in_body(self):
volume = self.create_volume()
self.attach_volume(self.server, volume)

View File

@ -26,7 +26,10 @@ import uuid
from oslo_utils import uuidutils
import six.moves.urllib.parse as urlparse
DECORATOR_MODULE = 'test'
# TODO(oomichi): Need to remove this after switching all modules to decorators
OLD_DECORATOR_MODULE = 'test'
DECORATOR_MODULE = 'decorators'
DECORATOR_NAME = 'idempotent_id'
DECORATOR_IMPORT = 'tempest.%s' % DECORATOR_MODULE
IMPORT_LINE = 'from tempest import %s' % DECORATOR_MODULE
@ -124,7 +127,8 @@ class TestChecker(object):
hasattr(decorator.func, 'attr') and
decorator.func.attr == DECORATOR_NAME and
hasattr(decorator.func, 'value') and
decorator.func.value.id == DECORATOR_MODULE):
(decorator.func.value.id == DECORATOR_MODULE or
decorator.func.value.id == OLD_DECORATOR_MODULE)):
for arg in decorator.args:
idempotent_id = ast.literal_eval(arg)
return idempotent_id