From 8b3119091fd33284c1f05c4f9a89c5440cf13067 Mon Sep 17 00:00:00 2001 From: Giulio Fidente Date: Sun, 12 May 2013 15:40:31 +0200 Subject: [PATCH] Set smoke/gate attributes for tests in "volume" Change-Id: I56e4192aa7ff1d948e8a63773e4f82ac4315ecdc Implements: blueprint set-gate-attribute --- tempest/tests/volume/admin/test_multi_backend.py | 3 +++ tempest/tests/volume/admin/test_volume_types.py | 5 +++++ .../volume/admin/test_volume_types_extra_specs.py | 4 ++++ .../admin/test_volume_types_extra_specs_negative.py | 12 ++++++++++++ .../tests/volume/admin/test_volume_types_negative.py | 5 +++++ tempest/tests/volume/test_volumes_actions.py | 3 ++- tempest/tests/volume/test_volumes_get.py | 6 +++--- tempest/tests/volume/test_volumes_list.py | 4 ++-- tempest/tests/volume/test_volumes_negative.py | 10 ++++++++++ tempest/tests/volume/test_volumes_snapshots.py | 3 ++- 10 files changed, 48 insertions(+), 7 deletions(-) diff --git a/tempest/tests/volume/admin/test_multi_backend.py b/tempest/tests/volume/admin/test_multi_backend.py index 3d5fae4403..c50586ca78 100644 --- a/tempest/tests/volume/admin/test_multi_backend.py +++ b/tempest/tests/volume/admin/test_multi_backend.py @@ -22,6 +22,7 @@ from tempest.common.utils.data_utils import rand_name from tempest import config from tempest.services.volume.json.admin import volume_types_client from tempest.services.volume.json import volumes_client +from tempest.test import attr from tempest.tests.volume import base LOG = logging.getLogger(__name__) @@ -108,6 +109,7 @@ class VolumeMultiBackendTest(base.BaseVolumeAdminTest): super(VolumeMultiBackendTest, cls).tearDownClass() + @attr(type=['smoke', 'gate']) def test_multi_backend_enabled(self): # this test checks that multi backend is enabled for at least the # computes where the volumes created in setUp were made @@ -131,6 +133,7 @@ class VolumeMultiBackendTest(base.BaseVolumeAdminTest): "%(volume_host2)s") % locals() self.assertTrue(len(volume_host2.split("@")) > 1, msg) + @attr(type='gate') def test_backend_name_distinction(self): # this test checks that the two volumes created at setUp doesn't # belong to the same backend (if they are in the same backend, that diff --git a/tempest/tests/volume/admin/test_volume_types.py b/tempest/tests/volume/admin/test_volume_types.py index 13efca77b2..8fccd24987 100644 --- a/tempest/tests/volume/admin/test_volume_types.py +++ b/tempest/tests/volume/admin/test_volume_types.py @@ -17,6 +17,7 @@ from tempest.common.utils.data_utils import rand_name from tempest.services.volume.json.admin import volume_types_client +from tempest.test import attr from tempest.tests.volume.base import BaseVolumeTest @@ -37,6 +38,7 @@ class VolumeTypesTest(BaseVolumeTest): auth_url, adm_tenant) + @attr(type=['smoke', 'gate']) def test_volume_type_list(self): # List Volume types. try: @@ -46,6 +48,7 @@ class VolumeTypesTest(BaseVolumeTest): except Exception: self.fail("Could not list volume types") + @attr(type=['smoke', 'gate']) def test_create_get_delete_volume_with_volume_type_and_extra_specs(self): # Create/get/delete volume with volume_type and extra spec. try: @@ -97,6 +100,7 @@ class VolumeTypesTest(BaseVolumeTest): resp, _ = self.client.delete_volume_type(body['id']) self.assertEqual(202, resp.status) + @attr(type=['smoke', 'gate']) def test_volume_type_create_delete(self): # Create/Delete volume type. try: @@ -119,6 +123,7 @@ class VolumeTypesTest(BaseVolumeTest): except Exception: self.fail("Could not create a volume_type") + @attr(type=['smoke', 'gate']) def test_volume_type_create_get(self): # Create/get volume type. try: diff --git a/tempest/tests/volume/admin/test_volume_types_extra_specs.py b/tempest/tests/volume/admin/test_volume_types_extra_specs.py index 1cd7653661..85edd643e0 100644 --- a/tempest/tests/volume/admin/test_volume_types_extra_specs.py +++ b/tempest/tests/volume/admin/test_volume_types_extra_specs.py @@ -16,6 +16,7 @@ # under the License. from tempest.common.utils.data_utils import rand_name +from tempest.test import attr from tempest.tests.volume import base @@ -33,6 +34,7 @@ class VolumeTypesExtraSpecsTest(base.BaseVolumeAdminTest): cls.client.delete_volume_type(cls.volume_type['id']) super(VolumeTypesExtraSpecsTest, cls).tearDownClass() + @attr(type=['smoke', 'gate']) def test_volume_type_extra_specs_list(self): # List Volume types extra specs. try: @@ -51,6 +53,7 @@ class VolumeTypesExtraSpecsTest(base.BaseVolumeAdminTest): except Exception: self.fail("Could not list volume types extra specs") + @attr(type=['gate']) def test_volume_type_extra_specs_update(self): # Update volume type extra specs try: @@ -74,6 +77,7 @@ class VolumeTypesExtraSpecsTest(base.BaseVolumeAdminTest): except Exception: self.fail("Couldnt update volume type extra spec") + @attr(type=['smoke', 'gate']) def test_volume_type_extra_spec_create_get_delete(self): # Create/Get/Delete volume type extra spec. try: diff --git a/tempest/tests/volume/admin/test_volume_types_extra_specs_negative.py b/tempest/tests/volume/admin/test_volume_types_extra_specs_negative.py index bd6e2790be..4a1a0b2d1d 100644 --- a/tempest/tests/volume/admin/test_volume_types_extra_specs_negative.py +++ b/tempest/tests/volume/admin/test_volume_types_extra_specs_negative.py @@ -19,6 +19,7 @@ import uuid from tempest.common.utils.data_utils import rand_name from tempest import exceptions +from tempest.test import attr from tempest.tests.volume import base @@ -39,6 +40,7 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest): cls.client.delete_volume_type(cls.volume_type['id']) super(ExtraSpecsNegativeTest, cls).tearDownClass() + @attr(type='gate') def test_update_no_body(self): # Should not update volume type extra specs with no body extra_spec = {"spec1": "val2"} @@ -46,6 +48,7 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest): self.client.update_volume_type_extra_specs, self.volume_type['id'], extra_spec.keys()[0], None) + @attr(type='gate') def test_update_nonexistent_extra_spec_id(self): # Should not update volume type extra specs with nonexistent id. extra_spec = {"spec1": "val2"} @@ -54,6 +57,7 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest): self.volume_type['id'], str(uuid.uuid4()), extra_spec) + @attr(type='gate') def test_update_none_extra_spec_id(self): # Should not update volume type extra specs with none id. extra_spec = {"spec1": "val2"} @@ -61,6 +65,7 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest): self.client.update_volume_type_extra_specs, self.volume_type['id'], None, extra_spec) + @attr(type='gate') def test_update_multiple_extra_spec(self): # Should not update volume type extra specs with multiple specs as # body. @@ -70,6 +75,7 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest): self.volume_type['id'], extra_spec.keys()[0], extra_spec) + @attr(type='gate') def test_create_nonexistent_type_id(self): # Should not create volume type extra spec for nonexistent volume # type id. @@ -78,18 +84,21 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest): self.client.create_volume_type_extra_specs, str(uuid.uuid4()), extra_specs) + @attr(type='gate') def test_create_none_body(self): # Should not create volume type extra spec for none POST body. self.assertRaises(exceptions.BadRequest, self.client.create_volume_type_extra_specs, self.volume_type['id'], None) + @attr(type='gate') def test_create_invalid_body(self): # Should not create volume type extra spec for invalid POST body. self.assertRaises(exceptions.BadRequest, self.client.create_volume_type_extra_specs, self.volume_type['id'], ['invalid']) + @attr(type='gate') def test_delete_nonexistent_volume_type_id(self): # Should not delete volume type extra spec for nonexistent # type id. @@ -98,12 +107,14 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest): self.client.delete_volume_type_extra_specs, str(uuid.uuid4()), extra_specs.keys()[0]) + @attr(type='gate') def test_list_nonexistent_volume_type_id(self): # Should not list volume type extra spec for nonexistent type id. self.assertRaises(exceptions.NotFound, self.client.list_volume_types_extra_specs, str(uuid.uuid4())) + @attr(type='gate') def test_get_nonexistent_volume_type_id(self): # Should not get volume type extra spec for nonexistent type id. extra_specs = {"spec1": "val1"} @@ -111,6 +122,7 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest): self.client.get_volume_type_extra_specs, str(uuid.uuid4()), extra_specs.keys()[0]) + @attr(type='gate') def test_get_nonexistent_extra_spec_id(self): # Should not get volume type extra spec for nonexistent extra spec # id. diff --git a/tempest/tests/volume/admin/test_volume_types_negative.py b/tempest/tests/volume/admin/test_volume_types_negative.py index daf804de98..bd358b8d8f 100644 --- a/tempest/tests/volume/admin/test_volume_types_negative.py +++ b/tempest/tests/volume/admin/test_volume_types_negative.py @@ -18,12 +18,14 @@ import uuid from tempest import exceptions +from tempest.test import attr from tempest.tests.volume import base class VolumeTypesNegativeTest(base.BaseVolumeAdminTest): _interface = 'json' + @attr(type='gate') def test_create_with_nonexistent_volume_type(self): # Should not be able to create volume with nonexistent volume_type. self.assertRaises(exceptions.NotFound, @@ -31,16 +33,19 @@ class VolumeTypesNegativeTest(base.BaseVolumeAdminTest): display_name=str(uuid.uuid4()), volume_type=str(uuid.uuid4())) + @attr(type='gate') def test_create_with_empty_name(self): # Should not be able to create volume type with an empty name. self.assertRaises(exceptions.BadRequest, self.client.create_volume_type, '') + @attr(type='gate') def test_get_nonexistent_type_id(self): # Should not be able to get volume type with nonexistent type id. self.assertRaises(exceptions.NotFound, self.client.get_volume_type, str(uuid.uuid4())) + @attr(type='gate') def test_delete_nonexistent_type_id(self): # Should not be able to delete volume type with nonexistent type id. self.assertRaises(exceptions.NotFound, self.client.delete_volume_type, diff --git a/tempest/tests/volume/test_volumes_actions.py b/tempest/tests/volume/test_volumes_actions.py index e6eb8d81b3..5396fa4140 100644 --- a/tempest/tests/volume/test_volumes_actions.py +++ b/tempest/tests/volume/test_volumes_actions.py @@ -52,7 +52,7 @@ class VolumesActionsTest(BaseVolumeTest): super(VolumesActionsTest, cls).tearDownClass() - @attr(type='smoke') + @attr(type=['smoke', 'gate']) def test_attach_detach_volume_to_instance(self): # Volume is attached and detached successfully from an instance try: @@ -70,6 +70,7 @@ class VolumesActionsTest(BaseVolumeTest): self.assertEqual(202, resp.status) self.client.wait_for_volume_status(self.volume['id'], 'available') + @attr(type='gate') def test_get_volume_attachment(self): # Verify that a volume's attachment information is retrieved mountpoint = '/dev/vdc' diff --git a/tempest/tests/volume/test_volumes_get.py b/tempest/tests/volume/test_volumes_get.py index 8e80e18f1f..fdaf09b90c 100644 --- a/tempest/tests/volume/test_volumes_get.py +++ b/tempest/tests/volume/test_volumes_get.py @@ -78,7 +78,7 @@ class VolumesGetTest(base.BaseVolumeTest): self.assertEqual(202, resp.status) self.client.wait_for_resource_deletion(volume['id']) - @attr(type='positive') + @attr(type='gate') def test_volume_get_metadata_none(self): # Create a volume without passing metadata, get details, and delete try: @@ -105,11 +105,11 @@ class VolumesGetTest(base.BaseVolumeTest): self.assertEqual(202, resp.status) self.client.wait_for_resource_deletion(volume['id']) - @attr(type='smoke') + @attr(type=['smoke', 'gate']) def test_volume_create_get_delete(self): self._volume_create_get_delete(image_ref=None) - @attr(type='smoke') + @attr(type=['smoke', 'gate']) def test_volume_from_image(self): self._volume_create_get_delete(image_ref=self.config.compute.image_ref) diff --git a/tempest/tests/volume/test_volumes_list.py b/tempest/tests/volume/test_volumes_list.py index a8fedb90c5..2468705a84 100644 --- a/tempest/tests/volume/test_volumes_list.py +++ b/tempest/tests/volume/test_volumes_list.py @@ -76,7 +76,7 @@ class VolumesListTest(base.BaseVolumeTest): cls.client.wait_for_resource_deletion(volid) super(VolumesListTest, cls).tearDownClass() - @attr(type='smoke') + @attr(type=['smoke', 'gate']) def test_volume_list(self): # Get a list of Volumes # Fetch all volumes @@ -89,7 +89,7 @@ class VolumesListTest(base.BaseVolumeTest): ', '.join(m_vol['display_name'] for m_vol in missing_vols)) - @attr(type='smoke') + @attr(type='gate') def test_volume_list_with_details(self): # Get a list of Volumes with details # Fetch all Volumes diff --git a/tempest/tests/volume/test_volumes_negative.py b/tempest/tests/volume/test_volumes_negative.py index c7d4374190..f02bb3f408 100644 --- a/tempest/tests/volume/test_volumes_negative.py +++ b/tempest/tests/volume/test_volumes_negative.py @@ -17,6 +17,7 @@ from tempest.common.utils.data_utils import rand_name from tempest import exceptions +from tempest.test import attr from tempest.tests.volume import base @@ -28,6 +29,7 @@ class VolumesNegativeTest(base.BaseVolumeTest): super(VolumesNegativeTest, cls).setUpClass() cls.client = cls.volumes_client + @attr(type='gate') def test_volume_get_nonexistant_volume_id(self): # Should not be able to get a nonexistant volume #Creating a nonexistant volume id @@ -43,6 +45,7 @@ class VolumesNegativeTest(base.BaseVolumeTest): self.assertRaises(exceptions.NotFound, self.client.get_volume, non_exist_id) + @attr(type='gate') def test_volume_delete_nonexistant_volume_id(self): # Should not be able to delete a nonexistant Volume # Creating nonexistant volume id @@ -58,6 +61,7 @@ class VolumesNegativeTest(base.BaseVolumeTest): self.assertRaises(exceptions.NotFound, self.client.delete_volume, non_exist_id) + @attr(type='gate') def test_create_volume_with_invalid_size(self): # Should not be able to create volume with invalid size # in request @@ -66,6 +70,7 @@ class VolumesNegativeTest(base.BaseVolumeTest): self.assertRaises(exceptions.BadRequest, self.client.create_volume, size='#$%', display_name=v_name, metadata=metadata) + @attr(type='gate') def test_create_volume_with_out_passing_size(self): # Should not be able to create volume without passing size # in request @@ -74,6 +79,7 @@ class VolumesNegativeTest(base.BaseVolumeTest): self.assertRaises(exceptions.BadRequest, self.client.create_volume, size='', display_name=v_name, metadata=metadata) + @attr(type='gate') def test_create_volume_with_size_zero(self): # Should not be able to create volume with size zero v_name = rand_name('Volume-') @@ -81,20 +87,24 @@ class VolumesNegativeTest(base.BaseVolumeTest): self.assertRaises(exceptions.BadRequest, self.client.create_volume, size='0', display_name=v_name, metadata=metadata) + @attr(type='gate') def test_get_invalid_volume_id(self): # Should not be able to get volume with invalid id self.assertRaises(exceptions.NotFound, self.client.get_volume, '#$%%&^&^') + @attr(type='gate') def test_get_volume_without_passing_volume_id(self): # Should not be able to get volume when empty ID is passed self.assertRaises(exceptions.NotFound, self.client.get_volume, '') + @attr(type='gate') def test_delete_invalid_volume_id(self): # Should not be able to delete volume when invalid ID is passed self.assertRaises(exceptions.NotFound, self.client.delete_volume, '!@#$%^&*()') + @attr(type='gate') def test_delete_volume_without_passing_volume_id(self): # Should not be able to delete volume when empty ID is passed self.assertRaises(exceptions.NotFound, self.client.delete_volume, '') diff --git a/tempest/tests/volume/test_volumes_snapshots.py b/tempest/tests/volume/test_volumes_snapshots.py index ba8ba6cc07..edc02ac923 100644 --- a/tempest/tests/volume/test_volumes_snapshots.py +++ b/tempest/tests/volume/test_volumes_snapshots.py @@ -37,7 +37,7 @@ class VolumesSnapshotTest(base.BaseVolumeTest): def tearDownClass(cls): super(VolumesSnapshotTest, cls).tearDownClass() - @attr(type='smoke') + @attr(type=['smoke', 'gate']) def test_snapshot_create_get_delete(self): # Create a snapshot, get some of the details and then deletes it resp, snapshot = self.snapshots_client.create_snapshot( @@ -52,6 +52,7 @@ class VolumesSnapshotTest(base.BaseVolumeTest): self.snapshots_client.delete_snapshot(snapshot['id']) self.snapshots_client.wait_for_resource_deletion(snapshot['id']) + @attr(type=['smoke', 'gate']) def test_volume_from_snapshot(self): # Create a temporary snap using wrapper method from base, then # create a snap based volume, check resp code and deletes it