Merge "Switch to decorators.idempotent_id on volume"
diff --git a/tempest/api/identity/admin/v3/test_projects.py b/tempest/api/identity/admin/v3/test_projects.py
index fef6020..b37d33d 100644
--- a/tempest/api/identity/admin/v3/test_projects.py
+++ b/tempest/api/identity/admin/v3/test_projects.py
@@ -88,6 +88,30 @@
self.assertEqual(project_name, project['name'])
self.assertEqual(root_project_id, parent_id)
+ @decorators.idempotent_id('a7eb9416-6f9b-4dbb-b71b-7f73aaef59d5')
+ @testtools.skipUnless(CONF.identity_feature_enabled.reseller,
+ 'Reseller not available.')
+ def test_create_is_domain_project(self):
+ project_name = data_utils.rand_name('is_domain_project')
+ project = self.projects_client.create_project(
+ project_name, domain_id=None, is_domain=True)['project']
+ # To delete a domain, we need to disable it first
+ self.addCleanup(self.projects_client.delete_project, project['id'])
+ self.addCleanup(self.projects_client.update_project, project['id'],
+ enabled=False)
+
+ # Check if the is_domain project is correctly returned by both
+ # project and domain APIs
+ projects_list = self.projects_client.list_projects(
+ params={'is_domain': True})['projects']
+ self.assertIn(project, projects_list)
+
+ # The domains API return different attributes for the entity, so we
+ # compare the entities IDs
+ domains_ids = [d['id'] for d in self.domains_client.list_domains()[
+ 'domains']]
+ self.assertIn(project['id'], domains_ids)
+
@decorators.idempotent_id('1f66dc76-50cc-4741-a200-af984509e480')
def test_project_create_enabled(self):
# Create a project that is enabled
diff --git a/tempest/api/orchestration/stacks/test_environment.py b/tempest/api/orchestration/stacks/test_environment.py
index f2ffbd7..0a9b3e5 100644
--- a/tempest/api/orchestration/stacks/test_environment.py
+++ b/tempest/api/orchestration/stacks/test_environment.py
@@ -12,12 +12,12 @@
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
-from tempest import test
+from tempest.lib import decorators
class StackEnvironmentTest(base.BaseOrchestrationTest):
- @test.idempotent_id('37d4346b-1abd-4442-b7b1-2a4e5749a1e3')
+ @decorators.idempotent_id('37d4346b-1abd-4442-b7b1-2a4e5749a1e3')
def test_environment_parameter(self):
"""Test passing a stack parameter via the environment."""
stack_name = data_utils.rand_name('heat')
@@ -34,7 +34,7 @@
random_value = self.get_stack_output(stack_identifier, 'random_value')
self.assertEqual(20, len(random_value))
- @test.idempotent_id('73bce717-ad22-4853-bbef-6ed89b632701')
+ @decorators.idempotent_id('73bce717-ad22-4853-bbef-6ed89b632701')
def test_environment_provider_resource(self):
"""Test passing resource_registry defining a provider resource."""
stack_name = data_utils.rand_name('heat')
@@ -63,7 +63,7 @@
'random_length']['default']
self.assertEqual(expected_length, len(random_value))
- @test.idempotent_id('9d682e5a-f4bb-47d5-8472-9d3cacb855df')
+ @decorators.idempotent_id('9d682e5a-f4bb-47d5-8472-9d3cacb855df')
def test_files_provider_resource(self):
"""Test untyped defining of a provider resource via "files"."""
# It's also possible to specify the filename directly in the template.
diff --git a/tempest/api/orchestration/stacks/test_limits.py b/tempest/api/orchestration/stacks/test_limits.py
index d85aa96..b079435 100644
--- a/tempest/api/orchestration/stacks/test_limits.py
+++ b/tempest/api/orchestration/stacks/test_limits.py
@@ -13,15 +13,15 @@
from tempest.api.orchestration 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
CONF = config.CONF
class TestServerStackLimits(base.BaseOrchestrationTest):
- @test.idempotent_id('ec9bed71-c460-45c9-ab98-295caa9fd76b')
+ @decorators.idempotent_id('ec9bed71-c460-45c9-ab98-295caa9fd76b')
def test_exceed_max_template_size_fails(self):
stack_name = data_utils.rand_name('heat')
fill = 'A' * CONF.orchestration.max_template_size
@@ -34,7 +34,7 @@
stack_name, template)
self.assertIn('exceeds maximum allowed size', str(ex))
- @test.idempotent_id('d1b83e73-7cad-4a22-9839-036548c5387c')
+ @decorators.idempotent_id('d1b83e73-7cad-4a22-9839-036548c5387c')
def test_exceed_max_resources_per_stack(self):
stack_name = data_utils.rand_name('heat')
# Create a big template, one resource more than the limit
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index 5d680d2..3a52108 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -16,6 +16,7 @@
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
from tempest import config
+from tempest.lib import decorators
from tempest.lib import exceptions
from tempest import test
@@ -94,7 +95,7 @@
for resource in resources:
cls.test_resources[resource['logical_resource_id']] = resource
- @test.idempotent_id('f9e2664c-bc44-4eef-98b6-495e4f9d74b3')
+ @decorators.idempotent_id('f9e2664c-bc44-4eef-98b6-495e4f9d74b3')
def test_created_resources(self):
"""Verifies created neutron resources."""
resources = [('Network', self.neutron_basic_template['resources'][
@@ -112,7 +113,7 @@
self.assertEqual(resource_type, resource['resource_type'])
self.assertEqual('CREATE_COMPLETE', resource['resource_status'])
- @test.idempotent_id('c572b915-edb1-4e90-b196-c7199a6848c0')
+ @decorators.idempotent_id('c572b915-edb1-4e90-b196-c7199a6848c0')
@test.services('network')
def test_created_network(self):
"""Verifies created network."""
@@ -124,7 +125,7 @@
self.assertEqual(self.neutron_basic_template['resources'][
'Network']['properties']['name'], network['name'])
- @test.idempotent_id('e8f84b96-f9d7-4684-ad5f-340203e9f2c2')
+ @decorators.idempotent_id('e8f84b96-f9d7-4684-ad5f-340203e9f2c2')
@test.services('network')
def test_created_subnet(self):
"""Verifies created subnet."""
@@ -142,7 +143,7 @@
'Subnet']['properties']['ip_version'], subnet['ip_version'])
self.assertEqual(str(self.subnet_cidr), subnet['cidr'])
- @test.idempotent_id('96af4c7f-5069-44bc-bdcf-c0390f8a67d1')
+ @decorators.idempotent_id('96af4c7f-5069-44bc-bdcf-c0390f8a67d1')
@test.services('network')
def test_created_router(self):
"""Verifies created router."""
@@ -155,7 +156,7 @@
router['external_gateway_info']['network_id'])
self.assertEqual(True, router['admin_state_up'])
- @test.idempotent_id('89f605bd-153e-43ee-a0ed-9919b63423c5')
+ @decorators.idempotent_id('89f605bd-153e-43ee-a0ed-9919b63423c5')
@test.services('network')
def test_created_router_interface(self):
"""Verifies created router interface."""
@@ -178,7 +179,7 @@
self.assertEqual(str(self.subnet_cidr.iter_hosts().next()),
router_interface_ip)
- @test.idempotent_id('75d85316-4ac2-4c0e-a1a9-edd2148fc10e')
+ @decorators.idempotent_id('75d85316-4ac2-4c0e-a1a9-edd2148fc10e')
@test.services('compute', 'network')
def test_created_server(self):
"""Verifies created sever."""
diff --git a/tempest/api/orchestration/stacks/test_non_empty_stack.py b/tempest/api/orchestration/stacks/test_non_empty_stack.py
index 4ead084..f106349 100644
--- a/tempest/api/orchestration/stacks/test_non_empty_stack.py
+++ b/tempest/api/orchestration/stacks/test_non_empty_stack.py
@@ -13,7 +13,7 @@
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import test
+from tempest.lib import decorators
CONF = config.CONF
@@ -49,14 +49,14 @@
self.assertEqual(expected_num, len(stacks))
return stacks
- @test.idempotent_id('065c652a-720d-4760-9132-06aedeb8e3ab')
+ @decorators.idempotent_id('065c652a-720d-4760-9132-06aedeb8e3ab')
def test_stack_list(self):
"""Created stack should be in the list of existing stacks."""
stacks = self._list_stacks()
stacks_names = map(lambda stack: stack['stack_name'], stacks)
self.assertIn(self.stack_name, stacks_names)
- @test.idempotent_id('992f96e3-41ee-4ff6-91c7-bcfb670c0919')
+ @decorators.idempotent_id('992f96e3-41ee-4ff6-91c7-bcfb670c0919')
def test_stack_show(self):
"""Getting details about created stack should be possible."""
stack = self.client.show_stack(self.stack_name)['stack']
@@ -75,7 +75,7 @@
self.assertEqual(self.stack_id, stack['id'])
self.assertEqual('fluffy', stack['outputs'][0]['output_key'])
- @test.idempotent_id('fe719f7a-305a-44d8-bbb5-c91e93d9da17')
+ @decorators.idempotent_id('fe719f7a-305a-44d8-bbb5-c91e93d9da17')
def test_suspend_resume_stack(self):
"""Suspend and resume a stack."""
self.client.suspend_stack(self.stack_identifier)
@@ -85,13 +85,13 @@
self.client.wait_for_stack_status(self.stack_identifier,
'RESUME_COMPLETE')
- @test.idempotent_id('c951d55e-7cce-4c1f-83a0-bad735437fa6')
+ @decorators.idempotent_id('c951d55e-7cce-4c1f-83a0-bad735437fa6')
def test_list_resources(self):
"""Get list of created resources for the stack should be possible."""
resources = self.list_resources(self.stack_identifier)
self.assertEqual({self.resource_name: self.resource_type}, resources)
- @test.idempotent_id('2aba03b3-392f-4237-900b-1f5a5e9bd962')
+ @decorators.idempotent_id('2aba03b3-392f-4237-900b-1f5a5e9bd962')
def test_show_resource(self):
"""Getting details about created resource should be possible."""
resource = self.client.show_resource(self.stack_identifier,
@@ -105,7 +105,7 @@
self.assertEqual(self.resource_name, resource['logical_resource_id'])
self.assertEqual(self.resource_type, resource['resource_type'])
- @test.idempotent_id('898070a9-eba5-4fae-b7d6-cf3ffa03090f')
+ @decorators.idempotent_id('898070a9-eba5-4fae-b7d6-cf3ffa03090f')
def test_resource_metadata(self):
"""Getting metadata for created resources should be possible."""
metadata = self.client.show_resource_metadata(
@@ -114,7 +114,7 @@
self.assertIsInstance(metadata, dict)
self.assertEqual(['Tom', 'Stinky'], metadata.get('kittens', None))
- @test.idempotent_id('46567533-0a7f-483b-8942-fa19e0f17839')
+ @decorators.idempotent_id('46567533-0a7f-483b-8942-fa19e0f17839')
def test_list_events(self):
"""Getting list of created events for the stack should be possible."""
events = self.client.list_events(self.stack_identifier)['events']
@@ -129,7 +129,7 @@
self.assertIn('CREATE_IN_PROGRESS', resource_statuses)
self.assertIn('CREATE_COMPLETE', resource_statuses)
- @test.idempotent_id('92465723-1673-400a-909d-4773757a3f21')
+ @decorators.idempotent_id('92465723-1673-400a-909d-4773757a3f21')
def test_show_event(self):
"""Getting details about an event should be possible."""
events = self.client.list_resource_events(self.stack_identifier,
diff --git a/tempest/api/orchestration/stacks/test_nova_keypair_resources.py b/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
index 16d8180..4d1db6d 100644
--- a/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
+++ b/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
@@ -12,7 +12,7 @@
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
-from tempest import test
+from tempest.lib import decorators
class NovaKeyPairResourcesYAMLTest(base.BaseOrchestrationTest):
@@ -43,7 +43,7 @@
for resource in resources:
cls.test_resources[resource['logical_resource_id']] = resource
- @test.idempotent_id('b476eac2-a302-4815-961f-18c410a2a537')
+ @decorators.idempotent_id('b476eac2-a302-4815-961f-18c410a2a537')
def test_created_resources(self):
"""Verifies created keypair resource."""
@@ -63,7 +63,7 @@
self.assertEqual(resource_type, resource['resource_type'])
self.assertEqual('CREATE_COMPLETE', resource['resource_status'])
- @test.idempotent_id('8d77dec7-91fd-45a6-943d-5abd45e338a4')
+ @decorators.idempotent_id('8d77dec7-91fd-45a6-943d-5abd45e338a4')
def test_stack_keypairs_output(self):
stack = self.client.show_stack(self.stack_name)['stack']
self.assertIsInstance(stack, dict)
diff --git a/tempest/api/orchestration/stacks/test_resource_types.py b/tempest/api/orchestration/stacks/test_resource_types.py
index 8cf40de..63376d5 100644
--- a/tempest/api/orchestration/stacks/test_resource_types.py
+++ b/tempest/api/orchestration/stacks/test_resource_types.py
@@ -11,13 +11,14 @@
# under the License.
from tempest.api.orchestration import base
+from tempest.lib import decorators
from tempest import test
class ResourceTypesTest(base.BaseOrchestrationTest):
@test.attr(type='smoke')
- @test.idempotent_id('7123d082-3577-4a30-8f00-f805327c4ffd')
+ @decorators.idempotent_id('7123d082-3577-4a30-8f00-f805327c4ffd')
def test_resource_type_list(self):
"""Verify it is possible to list resource types."""
resource_types = self.client.list_resource_types()['resource_types']
@@ -25,7 +26,7 @@
self.assertIn('OS::Nova::Server', resource_types)
@test.attr(type='smoke')
- @test.idempotent_id('0e85a483-828b-4a28-a0e3-f0a21809192b')
+ @decorators.idempotent_id('0e85a483-828b-4a28-a0e3-f0a21809192b')
def test_resource_type_show(self):
"""Verify it is possible to get schema about resource types."""
resource_types = self.client.list_resource_types()['resource_types']
@@ -38,7 +39,7 @@
self.assertEqual(resource_type, type_schema['resource_type'])
@test.attr(type='smoke')
- @test.idempotent_id('8401821d-65fe-4d43-9fa3-57d5ce3a35c7')
+ @decorators.idempotent_id('8401821d-65fe-4d43-9fa3-57d5ce3a35c7')
def test_resource_type_template(self):
"""Verify it is possible to get template about resource types."""
type_template = self.client.show_resource_type_template(
diff --git a/tempest/api/orchestration/stacks/test_soft_conf.py b/tempest/api/orchestration/stacks/test_soft_conf.py
index b660f6e..89b10cc 100644
--- a/tempest/api/orchestration/stacks/test_soft_conf.py
+++ b/tempest/api/orchestration/stacks/test_soft_conf.py
@@ -12,6 +12,7 @@
from tempest.api.orchestration 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
@@ -75,7 +76,7 @@
lib_exc.NotFound, self.client.show_software_config, config_id)
@test.attr(type='smoke')
- @test.idempotent_id('136162ed-9445-4b9c-b7fc-306af8b5da99')
+ @decorators.idempotent_id('136162ed-9445-4b9c-b7fc-306af8b5da99')
def test_get_software_config(self):
"""Testing software config get."""
for conf in self.configs:
@@ -83,7 +84,7 @@
self._validate_config(conf, api_config)
@test.attr(type='smoke')
- @test.idempotent_id('1275c835-c967-4a2c-8d5d-ad533447ed91')
+ @decorators.idempotent_id('1275c835-c967-4a2c-8d5d-ad533447ed91')
def test_get_deployment_list(self):
"""Getting a list of all deployments"""
deploy_list = self.client.list_software_deployments()
@@ -92,7 +93,7 @@
self.assertIn(self.deployment_id, deploy_ids)
@test.attr(type='smoke')
- @test.idempotent_id('fe7cd9f9-54b1-429c-a3b7-7df8451db913')
+ @decorators.idempotent_id('fe7cd9f9-54b1-429c-a3b7-7df8451db913')
def test_get_deployment_metadata(self):
"""Testing deployment metadata get"""
metadata = self.client.show_software_deployment_metadata(
@@ -110,7 +111,7 @@
deployment['software_deployment']['config_id'])
@test.attr(type='smoke')
- @test.idempotent_id('f29d21f3-ed75-47cf-8cdc-ef1bdeb4c674')
+ @decorators.idempotent_id('f29d21f3-ed75-47cf-8cdc-ef1bdeb4c674')
def test_software_deployment_create_validate(self):
"""Testing software deployment was created as expected."""
# Asserting that all fields were created
@@ -123,7 +124,7 @@
self.status_reason, self.configs[0]['id'])
@test.attr(type='smoke')
- @test.idempotent_id('2ac43ab3-34f2-415d-be2e-eabb4d14ee32')
+ @decorators.idempotent_id('2ac43ab3-34f2-415d-be2e-eabb4d14ee32')
def test_software_deployment_update_no_metadata_change(self):
"""Testing software deployment update without metadata change."""
metadata = self.client.show_software_deployment_metadata(
@@ -149,7 +150,7 @@
test_metadata['metadata'][0][key])
@test.attr(type='smoke')
- @test.idempotent_id('92c48944-d79d-4595-a840-8e1a581c1a72')
+ @decorators.idempotent_id('92c48944-d79d-4595-a840-8e1a581c1a72')
def test_software_deployment_update_with_metadata_change(self):
"""Testing software deployment update with metadata change."""
metadata = self.client.show_software_deployment_metadata(
diff --git a/tempest/api/orchestration/stacks/test_stacks.py b/tempest/api/orchestration/stacks/test_stacks.py
index f13a2d9..7b5f161 100644
--- a/tempest/api/orchestration/stacks/test_stacks.py
+++ b/tempest/api/orchestration/stacks/test_stacks.py
@@ -12,6 +12,7 @@
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
+from tempest.lib import decorators
from tempest import test
@@ -19,13 +20,13 @@
empty_template = "HeatTemplateFormatVersion: '2012-12-12'\n"
@test.attr(type='smoke')
- @test.idempotent_id('d35d628c-07f6-4674-85a1-74db9919e986')
+ @decorators.idempotent_id('d35d628c-07f6-4674-85a1-74db9919e986')
def test_stack_list_responds(self):
stacks = self.client.list_stacks()['stacks']
self.assertIsInstance(stacks, list)
@test.attr(type='smoke')
- @test.idempotent_id('10498bd5-a83e-4b62-a817-ce24afe938fe')
+ @decorators.idempotent_id('10498bd5-a83e-4b62-a817-ce24afe938fe')
def test_stack_crud_no_resources(self):
stack_name = data_utils.rand_name('heat')
diff --git a/tempest/api/orchestration/stacks/test_swift_resources.py b/tempest/api/orchestration/stacks/test_swift_resources.py
index 3672526..505abe7 100644
--- a/tempest/api/orchestration/stacks/test_swift_resources.py
+++ b/tempest/api/orchestration/stacks/test_swift_resources.py
@@ -15,6 +15,7 @@
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
from tempest import config
+from tempest.lib import decorators
from tempest import test
@@ -59,7 +60,7 @@
for resource in resources:
cls.test_resources[resource['logical_resource_id']] = resource
- @test.idempotent_id('1a6fe69e-4be4-4990-9a7a-84b6f18019cb')
+ @decorators.idempotent_id('1a6fe69e-4be4-4990-9a7a-84b6f18019cb')
def test_created_resources(self):
"""Created stack should be in the list of existing stacks."""
swift_basic_template = self.load_template('swift_basic')
@@ -74,7 +75,7 @@
self.assertEqual(resource_name, resource['logical_resource_id'])
self.assertEqual('CREATE_COMPLETE', resource['resource_status'])
- @test.idempotent_id('bd438b18-5494-4d5a-9ce6-d2a942ec5060')
+ @decorators.idempotent_id('bd438b18-5494-4d5a-9ce6-d2a942ec5060')
@test.services('object_storage')
def test_created_containers(self):
params = {'format': 'json'}
@@ -84,7 +85,7 @@
if cont['name'].startswith(self.stack_name)]
self.assertEqual(2, len(created_containers))
- @test.idempotent_id('73d0c093-9922-44a0-8b1d-1fc092dee367')
+ @decorators.idempotent_id('73d0c093-9922-44a0-8b1d-1fc092dee367')
@test.services('object_storage')
def test_acl(self):
acl_headers = ('x-container-meta-web-index', 'x-container-read')
@@ -102,7 +103,7 @@
for h in acl_headers:
self.assertIn(h, headers)
- @test.idempotent_id('fda06135-6777-4594-aefa-0f6107169698')
+ @decorators.idempotent_id('fda06135-6777-4594-aefa-0f6107169698')
@test.services('object_storage')
def test_metadata(self):
swift_basic_template = self.load_template('swift_basic')
diff --git a/tempest/api/orchestration/stacks/test_templates.py b/tempest/api/orchestration/stacks/test_templates.py
index 9154175..21548a0 100644
--- a/tempest/api/orchestration/stacks/test_templates.py
+++ b/tempest/api/orchestration/stacks/test_templates.py
@@ -12,7 +12,7 @@
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
-from tempest import test
+from tempest.lib import decorators
class TemplateYAMLTestJSON(base.BaseOrchestrationTest):
@@ -35,12 +35,12 @@
cls.stack_id = cls.stack_identifier.split('/')[1]
cls.parameters = {}
- @test.idempotent_id('47430699-c368-495e-a1db-64c26fd967d7')
+ @decorators.idempotent_id('47430699-c368-495e-a1db-64c26fd967d7')
def test_show_template(self):
"""Getting template used to create the stack."""
self.client.show_template(self.stack_identifier)
- @test.idempotent_id('ed53debe-8727-46c5-ab58-eba6090ec4de')
+ @decorators.idempotent_id('ed53debe-8727-46c5-ab58-eba6090ec4de')
def test_validate_template(self):
"""Validating template passing it content."""
self.client.validate_template(self.template,
diff --git a/tempest/api/orchestration/stacks/test_templates_negative.py b/tempest/api/orchestration/stacks/test_templates_negative.py
index f8245c1..a90abe2 100644
--- a/tempest/api/orchestration/stacks/test_templates_negative.py
+++ b/tempest/api/orchestration/stacks/test_templates_negative.py
@@ -13,6 +13,7 @@
# under the License.
from tempest.api.orchestration import base
+from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest import test
@@ -35,7 +36,7 @@
cls.parameters = {}
@test.attr(type=['negative'])
- @test.idempotent_id('5586cbca-ddc4-4152-9db8-fa1ce5fc1876')
+ @decorators.idempotent_id('5586cbca-ddc4-4152-9db8-fa1ce5fc1876')
def test_validate_template_url(self):
"""Validating template passing url to it."""
self.assertRaises(lib_exc.BadRequest,
diff --git a/tempest/api/orchestration/stacks/test_volumes.py b/tempest/api/orchestration/stacks/test_volumes.py
index a5aaf6e..d34eb89 100644
--- a/tempest/api/orchestration/stacks/test_volumes.py
+++ b/tempest/api/orchestration/stacks/test_volumes.py
@@ -13,6 +13,7 @@
from tempest.api.orchestration 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
@@ -58,7 +59,7 @@
self.assertEqual(template['resources']['volume']['properties'][
'name'], self.get_stack_output(stack_identifier, 'display_name'))
- @test.idempotent_id('c3243329-7bdd-4730-b402-4d19d50c41d8')
+ @decorators.idempotent_id('c3243329-7bdd-4730-b402-4d19d50c41d8')
@test.services('volume')
def test_cinder_volume_create_delete(self):
"""Create and delete a volume via OS::Cinder::Volume."""
@@ -92,7 +93,7 @@
self.volumes_client.delete_volume(volume_id)
self.volumes_client.wait_for_resource_deletion(volume_id)
- @test.idempotent_id('ea8b3a46-b932-4c18-907a-fe23f00b33f8')
+ @decorators.idempotent_id('ea8b3a46-b932-4c18-907a-fe23f00b33f8')
@test.services('volume')
def test_cinder_volume_create_delete_retain(self):
"""Ensure the 'Retain' deletion policy is respected."""
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index f4def46..0a095a9 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -52,10 +52,10 @@
# Should not be able to create volume with invalid size
# in request
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
- metadata = {'Type': 'work'}
+ params = {self.name_field: v_name}
self.assertRaises(lib_exc.BadRequest,
self.volumes_client.create_volume,
- size='#$%', display_name=v_name, metadata=metadata)
+ size='#$%', params=params)
@test.attr(type=['negative'])
@decorators.idempotent_id('9387686f-334f-4d31-a439-33494b9e2683')
@@ -63,89 +63,85 @@
# Should not be able to create volume without passing size
# in request
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
- metadata = {'Type': 'work'}
+ params = {self.name_field: v_name}
self.assertRaises(lib_exc.BadRequest,
self.volumes_client.create_volume,
- size='', display_name=v_name, metadata=metadata)
+ size='', params=params)
@test.attr(type=['negative'])
@decorators.idempotent_id('41331caa-eaf4-4001-869d-bc18c1869360')
def test_create_volume_with_size_zero(self):
# Should not be able to create volume with size zero
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
- metadata = {'Type': 'work'}
+ params = {self.name_field: v_name}
self.assertRaises(lib_exc.BadRequest,
self.volumes_client.create_volume,
- size='0', display_name=v_name, metadata=metadata)
+ size='0', params=params)
@test.attr(type=['negative'])
@decorators.idempotent_id('8b472729-9eba-446e-a83b-916bdb34bef7')
def test_create_volume_with_size_negative(self):
# Should not be able to create volume with size negative
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
- metadata = {'Type': 'work'}
+ params = {self.name_field: v_name}
self.assertRaises(lib_exc.BadRequest,
self.volumes_client.create_volume,
- size='-1', display_name=v_name, metadata=metadata)
+ size='-1', params=params)
@test.attr(type=['negative'])
@decorators.idempotent_id('10254ed8-3849-454e-862e-3ab8e6aa01d2')
def test_create_volume_with_nonexistent_volume_type(self):
# Should not be able to create volume with non-existent volume type
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
- metadata = {'Type': 'work'}
+ params = {self.name_field: v_name}
self.assertRaises(lib_exc.NotFound, self.volumes_client.create_volume,
size='1', volume_type=data_utils.rand_uuid(),
- display_name=v_name, metadata=metadata)
+ params=params)
@test.attr(type=['negative'])
@decorators.idempotent_id('0c36f6ae-4604-4017-b0a9-34fdc63096f9')
def test_create_volume_with_nonexistent_snapshot_id(self):
# Should not be able to create volume with non-existent snapshot
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
- metadata = {'Type': 'work'}
+ params = {self.name_field: v_name}
self.assertRaises(lib_exc.NotFound, self.volumes_client.create_volume,
size='1', snapshot_id=data_utils.rand_uuid(),
- display_name=v_name, metadata=metadata)
+ params=params)
@test.attr(type=['negative'])
@decorators.idempotent_id('47c73e08-4be8-45bb-bfdf-0c4e79b88344')
def test_create_volume_with_nonexistent_source_volid(self):
# Should not be able to create volume with non-existent source volume
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
- metadata = {'Type': 'work'}
+ params = {self.name_field: v_name}
self.assertRaises(lib_exc.NotFound, self.volumes_client.create_volume,
size='1', source_volid=data_utils.rand_uuid(),
- display_name=v_name, metadata=metadata)
+ params=params)
@test.attr(type=['negative'])
@decorators.idempotent_id('0186422c-999a-480e-a026-6a665744c30c')
def test_update_volume_with_nonexistent_volume_id(self):
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
- metadata = {'Type': 'work'}
+ params = {self.name_field: v_name}
self.assertRaises(lib_exc.NotFound, self.volumes_client.update_volume,
- volume_id=data_utils.rand_uuid(),
- display_name=v_name,
- metadata=metadata)
+ volume_id=data_utils.rand_uuid(), params=params)
@test.attr(type=['negative'])
@decorators.idempotent_id('e66e40d6-65e6-4e75-bdc7-636792fa152d')
def test_update_volume_with_invalid_volume_id(self):
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
- metadata = {'Type': 'work'}
+ params = {self.name_field: v_name}
self.assertRaises(lib_exc.NotFound, self.volumes_client.update_volume,
volume_id=data_utils.rand_name('invalid'),
- display_name=v_name,
- metadata=metadata)
+ params=params)
@test.attr(type=['negative'])
@decorators.idempotent_id('72aeca85-57a5-4c1f-9057-f320f9ea575b')
def test_update_volume_with_empty_volume_id(self):
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
- metadata = {'Type': 'work'}
+ params = {self.name_field: v_name}
self.assertRaises(lib_exc.NotFound, self.volumes_client.update_volume,
- volume_id='', display_name=v_name,
- metadata=metadata)
+ volume_id='', params=params)
@test.attr(type=['negative'])
@decorators.idempotent_id('30799cfd-7ee4-446c-b66c-45b383ed211b')
diff --git a/tempest/common/waiters.py b/tempest/common/waiters.py
index 8303caf..865db39 100644
--- a/tempest/common/waiters.py
+++ b/tempest/common/waiters.py
@@ -26,14 +26,15 @@
LOG = logging.getLogger(__name__)
+def _get_task_state(body):
+ return body.get('OS-EXT-STS:task_state', None)
+
+
# NOTE(afazekas): This function needs to know a token and a subject.
def wait_for_server_status(client, server_id, status, ready_wait=True,
extra_timeout=0, raise_on_error=True):
"""Waits for a server to reach a given status."""
- def _get_task_state(body):
- return body.get('OS-EXT-STS:task_state', None)
-
# NOTE(afazekas): UNKNOWN status possible on ERROR
# or in a very early stage.
body = client.show_server(server_id)['server']
@@ -99,21 +100,33 @@
def wait_for_server_termination(client, server_id, ignore_error=False):
"""Waits for server to reach termination."""
+ try:
+ body = client.show_server(server_id)['server']
+ except lib_exc.NotFound:
+ return
+ old_status = server_status = body['status']
+ old_task_state = task_state = _get_task_state(body)
start_time = int(time.time())
while True:
+ time.sleep(client.build_interval)
try:
body = client.show_server(server_id)['server']
except lib_exc.NotFound:
return
-
server_status = body['status']
+ task_state = _get_task_state(body)
+ if (server_status != old_status) or (task_state != old_task_state):
+ LOG.info('State transition "%s" ==> "%s" after %d second wait',
+ '/'.join((old_status, str(old_task_state))),
+ '/'.join((server_status, str(task_state))),
+ time.time() - start_time)
if server_status == 'ERROR' and not ignore_error:
raise exceptions.BuildErrorException(server_id=server_id)
if int(time.time()) - start_time >= client.build_timeout:
raise lib_exc.TimeoutException
-
- time.sleep(client.build_interval)
+ old_status = server_status
+ old_task_state = task_state
def wait_for_image_status(client, image_id, status):