Prepare for enabling H302 rule (api/volume,tempest/*)

We can use H302 rule but ignore it now. This commit prepares for
enabling H302 rule. But this commit modifies a part of Tempest only
because if we fix all of them at one time, it's hard to merge this
commit.
    ---------------
    tempest/api/compute/admin
    tempest/api/compute/{c*,f*,i*,s*,t*}
    tempest/api/compute/{v3,volumes},data_processing
    tempest/api/identity/admin
    tempest/api/image
    tempest/api/{n*,o*,t*}
    tempest/api/volume,tempest/*     <- This patch
    tempest/services/compute/json
    tempest/services/compute/v3/json
    tempest/services/compute/xml
    tempest/services/identity
    tempest/services/{im*,n*,o*,t*}
    tempest/services/volume
    tempest/clients.py: TBD
    ---------------

Change-Id: I65e9ac5678d17f31de5449017f2193f53c74c535
This commit is contained in:
Masayuki Igawa 2014-03-04 18:34:16 +09:00
parent 811f088076
commit 1edf94f997
17 changed files with 114 additions and 114 deletions

View File

@ -14,7 +14,7 @@ from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest import config
from tempest.openstack.common import log as logging
from tempest.test import attr
from tempest import test
CONF = config.CONF
@ -86,7 +86,7 @@ class VolumeMultiBackendTest(base.BaseVolumeV1AdminTest):
super(VolumeMultiBackendTest, cls).tearDownClass()
@attr(type='smoke')
@test.attr(type='smoke')
def test_backend_name_reporting(self):
# this test checks if os-vol-attr:host is populated correctly after
# the multi backend feature has been enabled
@ -100,7 +100,7 @@ class VolumeMultiBackendTest(base.BaseVolumeV1AdminTest):
self.volume1['id'])
self.assertTrue(len(volume1_host.split("@")) > 1, msg)
@attr(type='gate')
@test.attr(type='gate')
def test_backend_name_distinction(self):
# this test checks that the two volumes created at setUp don't
# belong to the same backend (if they are, than the

View File

@ -15,7 +15,7 @@
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest import test
class SnapshotsActionsTest(base.BaseVolumeV1AdminTest):
@ -80,7 +80,7 @@ class SnapshotsActionsTest(base.BaseVolumeV1AdminTest):
def _get_progress_alias(self):
return 'os-extended-snapshot-attributes:progress'
@attr(type='gate')
@test.attr(type='gate')
def test_reset_snapshot_status(self):
# Reset snapshot status to creating
status = 'creating'
@ -92,7 +92,7 @@ class SnapshotsActionsTest(base.BaseVolumeV1AdminTest):
self.assertEqual(200, resp_get.status)
self.assertEqual(status, snapshot_get['status'])
@attr(type='gate')
@test.attr(type='gate')
def test_update_snapshot_status(self):
# Reset snapshot status to creating
status = 'creating'
@ -112,22 +112,22 @@ class SnapshotsActionsTest(base.BaseVolumeV1AdminTest):
self.assertEqual(status, snapshot_get['status'])
self.assertEqual(progress, snapshot_get[progress_alias])
@attr(type='gate')
@test.attr(type='gate')
def test_snapshot_force_delete_when_snapshot_is_creating(self):
# test force delete when status of snapshot is creating
self._create_reset_and_force_delete_temp_snapshot('creating')
@attr(type='gate')
@test.attr(type='gate')
def test_snapshot_force_delete_when_snapshot_is_deleting(self):
# test force delete when status of snapshot is deleting
self._create_reset_and_force_delete_temp_snapshot('deleting')
@attr(type='gate')
@test.attr(type='gate')
def test_snapshot_force_delete_when_snapshot_is_error(self):
# test force delete when status of snapshot is error
self._create_reset_and_force_delete_temp_snapshot('error')
@attr(type='gate')
@test.attr(type='gate')
def test_snapshot_force_delete_when_snapshot_is_error_deleting(self):
# test force delete when status of snapshot is error_deleting
self._create_reset_and_force_delete_temp_snapshot('error_deleting')

View File

@ -14,13 +14,13 @@
# under the License.
from tempest.api.volume import base
from tempest.test import attr
from tempest import test
class VolumeHostsAdminTestsJSON(base.BaseVolumeV1AdminTest):
_interface = "json"
@attr(type='gate')
@test.attr(type='gate')
def test_list_hosts(self):
resp, hosts = self.hosts_client.list_hosts()
self.assertEqual(200, resp.status)

View File

@ -16,7 +16,7 @@
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest import config
from tempest.test import attr
from tempest import test
CONF = config.CONF
@ -33,14 +33,14 @@ class VolumeTypesTest(base.BaseVolumeV1AdminTest):
resp, _ = self.client.delete_volume_type(volume_type_id)
self.assertEqual(202, resp.status)
@attr(type='smoke')
@test.attr(type='smoke')
def test_volume_type_list(self):
# List Volume types.
resp, body = self.client.list_volume_types()
self.assertEqual(200, resp.status)
self.assertIsInstance(body, list)
@attr(type='smoke')
@test.attr(type='smoke')
def test_create_get_delete_volume_with_volume_type_and_extra_specs(self):
# Create/get/delete volume with volume_type and extra spec.
volume = {}
@ -84,7 +84,7 @@ class VolumeTypesTest(base.BaseVolumeV1AdminTest):
'The fetched Volume is different '
'from the created Volume')
@attr(type='smoke')
@test.attr(type='smoke')
def test_volume_type_create_get_delete(self):
# Create/get volume type.
body = {}

View File

@ -15,7 +15,7 @@
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest import test
class VolumeTypesExtraSpecsTest(base.BaseVolumeV1AdminTest):
@ -32,7 +32,7 @@ class VolumeTypesExtraSpecsTest(base.BaseVolumeV1AdminTest):
cls.client.delete_volume_type(cls.volume_type['id'])
super(VolumeTypesExtraSpecsTest, cls).tearDownClass()
@attr(type='smoke')
@test.attr(type='smoke')
def test_volume_type_extra_specs_list(self):
# List Volume types extra specs.
extra_specs = {"spec1": "val1"}
@ -47,7 +47,7 @@ class VolumeTypesExtraSpecsTest(base.BaseVolumeV1AdminTest):
self.assertIsInstance(body, dict)
self.assertIn('spec1', body)
@attr(type='gate')
@test.attr(type='gate')
def test_volume_type_extra_specs_update(self):
# Update volume type extra specs
extra_specs = {"spec2": "val1"}
@ -67,7 +67,7 @@ class VolumeTypesExtraSpecsTest(base.BaseVolumeV1AdminTest):
self.assertEqual(extra_spec['spec2'], body['spec2'],
"Volume type extra spec incorrectly updated")
@attr(type='smoke')
@test.attr(type='smoke')
def test_volume_type_extra_spec_create_get_delete(self):
# Create/Get/Delete volume type extra spec.
extra_specs = {"spec3": "val1"}

View File

@ -18,7 +18,7 @@ import uuid
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest import test
class ExtraSpecsNegativeTest(base.BaseVolumeV1AdminTest):
@ -38,7 +38,7 @@ class ExtraSpecsNegativeTest(base.BaseVolumeV1AdminTest):
cls.client.delete_volume_type(cls.volume_type['id'])
super(ExtraSpecsNegativeTest, cls).tearDownClass()
@attr(type='gate')
@test.attr(type='gate')
def test_update_no_body(self):
# Should not update volume type extra specs with no body
extra_spec = {"spec1": "val2"}
@ -46,7 +46,7 @@ class ExtraSpecsNegativeTest(base.BaseVolumeV1AdminTest):
self.client.update_volume_type_extra_specs,
self.volume_type['id'], extra_spec.keys()[0], None)
@attr(type='gate')
@test.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"}
@ -55,7 +55,7 @@ class ExtraSpecsNegativeTest(base.BaseVolumeV1AdminTest):
self.volume_type['id'], str(uuid.uuid4()),
extra_spec)
@attr(type='gate')
@test.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"}
@ -63,7 +63,7 @@ class ExtraSpecsNegativeTest(base.BaseVolumeV1AdminTest):
self.client.update_volume_type_extra_specs,
self.volume_type['id'], None, extra_spec)
@attr(type='gate')
@test.attr(type='gate')
def test_update_multiple_extra_spec(self):
# Should not update volume type extra specs with multiple specs as
# body.
@ -73,7 +73,7 @@ class ExtraSpecsNegativeTest(base.BaseVolumeV1AdminTest):
self.volume_type['id'], extra_spec.keys()[0],
extra_spec)
@attr(type='gate')
@test.attr(type='gate')
def test_create_nonexistent_type_id(self):
# Should not create volume type extra spec for nonexistent volume
# type id.
@ -82,21 +82,21 @@ class ExtraSpecsNegativeTest(base.BaseVolumeV1AdminTest):
self.client.create_volume_type_extra_specs,
str(uuid.uuid4()), extra_specs)
@attr(type='gate')
@test.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')
@test.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')
@test.attr(type='gate')
def test_delete_nonexistent_volume_type_id(self):
# Should not delete volume type extra spec for nonexistent
# type id.
@ -105,14 +105,14 @@ class ExtraSpecsNegativeTest(base.BaseVolumeV1AdminTest):
self.client.delete_volume_type_extra_specs,
str(uuid.uuid4()), extra_specs.keys()[0])
@attr(type='gate')
@test.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')
@test.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"}
@ -120,7 +120,7 @@ class ExtraSpecsNegativeTest(base.BaseVolumeV1AdminTest):
self.client.get_volume_type_extra_specs,
str(uuid.uuid4()), extra_specs.keys()[0])
@attr(type='gate')
@test.attr(type='gate')
def test_get_nonexistent_extra_spec_id(self):
# Should not get volume type extra spec for nonexistent extra spec
# id.

View File

@ -17,13 +17,13 @@ import uuid
from tempest.api.volume import base
from tempest import exceptions
from tempest.test import attr
from tempest import test
class VolumeTypesNegativeTest(base.BaseVolumeV1AdminTest):
_interface = 'json'
@attr(type='gate')
@test.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,19 +31,19 @@ class VolumeTypesNegativeTest(base.BaseVolumeV1AdminTest):
display_name=str(uuid.uuid4()),
volume_type=str(uuid.uuid4()))
@attr(type='gate')
@test.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')
@test.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')
@test.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,

View File

@ -15,7 +15,7 @@
from tempest.api.volume import base
from tempest.common.utils import data_utils as utils
from tempest.test import attr
from tempest import test
class VolumesActionsTest(base.BaseVolumeV1AdminTest):
@ -75,7 +75,7 @@ class VolumesActionsTest(base.BaseVolumeV1AdminTest):
self.assertEqual(202, resp_delete.status)
self.client.wait_for_resource_deletion(temp_volume['id'])
@attr(type='gate')
@test.attr(type='gate')
def test_volume_reset_status(self):
# test volume reset status : available->error->available
resp, body = self._reset_volume_status(self.volume['id'], 'error')
@ -84,7 +84,7 @@ class VolumesActionsTest(base.BaseVolumeV1AdminTest):
self.volume['id'])
self.assertEqual('error', volume_get['status'])
@attr(type='gate')
@test.attr(type='gate')
def test_volume_begin_detaching(self):
# test volume begin detaching : available -> detaching -> available
resp, body = self.client.volume_begin_detaching(self.volume['id'])
@ -92,7 +92,7 @@ class VolumesActionsTest(base.BaseVolumeV1AdminTest):
resp_get, volume_get = self.client.get_volume(self.volume['id'])
self.assertEqual('detaching', volume_get['status'])
@attr(type='gate')
@test.attr(type='gate')
def test_volume_roll_detaching(self):
# test volume roll detaching : detaching -> in-use -> available
resp, body = self.client.volume_begin_detaching(self.volume['id'])
@ -110,7 +110,7 @@ class VolumesActionsTest(base.BaseVolumeV1AdminTest):
# test force delete when status of volume is attaching
self._create_reset_and_force_delete_temp_volume('attaching')
@attr(type='gate')
@test.attr(type='gate')
def test_volume_force_delete_when_volume_is_error(self):
# test force delete when status of volume is error
self._create_reset_and_force_delete_temp_volume('error')

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest.api.volume.base import BaseVolumeV1AdminTest
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest import config
from tempest.openstack.common import log as logging
@ -23,7 +23,7 @@ CONF = config.CONF
LOG = logging.getLogger(__name__)
class VolumesBackupsTest(BaseVolumeV1AdminTest):
class VolumesBackupsTest(base.BaseVolumeV1AdminTest):
_interface = "json"
@classmethod

View File

@ -17,7 +17,7 @@
from tempest.api.volume import base
from tempest import config
from tempest.openstack.common import log as logging
from tempest.test import attr
from tempest import test
CONF = config.CONF
@ -28,7 +28,7 @@ LOG = logging.getLogger(__name__)
class ExtensionsTestJSON(base.BaseVolumeV1Test):
_interface = 'json'
@attr(type='gate')
@test.attr(type='gate')
def test_list_extensions(self):
# List of all extensions
resp, extensions = self.volumes_extension_client.list_extensions()

View File

@ -18,7 +18,7 @@ from testtools import matchers
from tempest.api.volume import base
from tempest import clients
from tempest import config
from tempest.test import attr
from tempest import test
CONF = config.CONF
@ -66,7 +66,7 @@ class VolumesTransfersTest(base.BaseVolumeV1Test):
self.assertEqual(202, resp.status)
self.adm_client.wait_for_resource_deletion(volume_id)
@attr(type='gate')
@test.attr(type='gate')
def test_create_get_list_accept_volume_transfer(self):
# Create a volume first
volume = self.create_volume()

View File

@ -18,7 +18,7 @@ import uuid
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest import test
class VolumesNegativeTest(base.BaseVolumeV1Test):
@ -33,19 +33,19 @@ class VolumesNegativeTest(base.BaseVolumeV1Test):
cls.volume = cls.create_volume()
cls.mountpoint = "/dev/vdc"
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_volume_get_nonexistent_volume_id(self):
# Should not be able to get a non-existent volume
self.assertRaises(exceptions.NotFound, self.client.get_volume,
str(uuid.uuid4()))
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_volume_delete_nonexistent_volume_id(self):
# Should not be able to delete a non-existent Volume
self.assertRaises(exceptions.NotFound, self.client.delete_volume,
str(uuid.uuid4()))
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_volume_with_invalid_size(self):
# Should not be able to create volume with invalid size
# in request
@ -54,7 +54,7 @@ class VolumesNegativeTest(base.BaseVolumeV1Test):
self.assertRaises(exceptions.BadRequest, self.client.create_volume,
size='#$%', display_name=v_name, metadata=metadata)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_volume_with_out_passing_size(self):
# Should not be able to create volume without passing size
# in request
@ -63,7 +63,7 @@ class VolumesNegativeTest(base.BaseVolumeV1Test):
self.assertRaises(exceptions.BadRequest, self.client.create_volume,
size='', display_name=v_name, metadata=metadata)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_volume_with_size_zero(self):
# Should not be able to create volume with size zero
v_name = data_utils.rand_name('Volume-')
@ -71,7 +71,7 @@ class VolumesNegativeTest(base.BaseVolumeV1Test):
self.assertRaises(exceptions.BadRequest, self.client.create_volume,
size='0', display_name=v_name, metadata=metadata)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_volume_with_size_negative(self):
# Should not be able to create volume with size negative
v_name = data_utils.rand_name('Volume-')
@ -79,7 +79,7 @@ class VolumesNegativeTest(base.BaseVolumeV1Test):
self.assertRaises(exceptions.BadRequest, self.client.create_volume,
size='-1', display_name=v_name, metadata=metadata)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
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('Volume-')
@ -88,7 +88,7 @@ class VolumesNegativeTest(base.BaseVolumeV1Test):
size='1', volume_type=str(uuid.uuid4()),
display_name=v_name, metadata=metadata)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
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('Volume-')
@ -97,7 +97,7 @@ class VolumesNegativeTest(base.BaseVolumeV1Test):
size='1', snapshot_id=str(uuid.uuid4()),
display_name=v_name, metadata=metadata)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
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('Volume-')
@ -106,7 +106,7 @@ class VolumesNegativeTest(base.BaseVolumeV1Test):
size='1', source_volid=str(uuid.uuid4()),
display_name=v_name, metadata=metadata)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_update_volume_with_nonexistent_volume_id(self):
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
@ -114,7 +114,7 @@ class VolumesNegativeTest(base.BaseVolumeV1Test):
volume_id=str(uuid.uuid4()), display_name=v_name,
metadata=metadata)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_update_volume_with_invalid_volume_id(self):
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
@ -122,7 +122,7 @@ class VolumesNegativeTest(base.BaseVolumeV1Test):
volume_id='#$%%&^&^', display_name=v_name,
metadata=metadata)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_update_volume_with_empty_volume_id(self):
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
@ -130,29 +130,29 @@ class VolumesNegativeTest(base.BaseVolumeV1Test):
volume_id='', display_name=v_name,
metadata=metadata)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', '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=['negative', 'gate'])
@test.attr(type=['negative', '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=['negative', 'gate'])
@test.attr(type=['negative', '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=['negative', 'gate'])
@test.attr(type=['negative', '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, '')
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_attach_volumes_with_nonexistent_volume_id(self):
srv_name = data_utils.rand_name('Instance-')
resp, server = self.servers_client.create_server(srv_name,
@ -166,60 +166,60 @@ class VolumesNegativeTest(base.BaseVolumeV1Test):
server['id'],
self.mountpoint)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_detach_volumes_with_invalid_volume_id(self):
self.assertRaises(exceptions.NotFound,
self.client.detach_volume,
'xxx')
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_volume_extend_with_size_smaller_than_original_size(self):
# Extend volume with smaller size than original size.
extend_size = 0
self.assertRaises(exceptions.BadRequest, self.client.extend_volume,
self.volume['id'], extend_size)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_volume_extend_with_non_number_size(self):
# Extend volume when size is non number.
extend_size = 'abc'
self.assertRaises(exceptions.BadRequest, self.client.extend_volume,
self.volume['id'], extend_size)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_volume_extend_with_None_size(self):
# Extend volume with None size.
extend_size = None
self.assertRaises(exceptions.BadRequest, self.client.extend_volume,
self.volume['id'], extend_size)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_volume_extend_with_nonexistent_volume_id(self):
# Extend volume size when volume is nonexistent.
extend_size = int(self.volume['size']) + 1
self.assertRaises(exceptions.NotFound, self.client.extend_volume,
str(uuid.uuid4()), extend_size)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_volume_extend_without_passing_volume_id(self):
# Extend volume size when passing volume id is None.
extend_size = int(self.volume['size']) + 1
self.assertRaises(exceptions.NotFound, self.client.extend_volume,
None, extend_size)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_reserve_volume_with_nonexistent_volume_id(self):
self.assertRaises(exceptions.NotFound,
self.client.reserve_volume,
str(uuid.uuid4()))
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_unreserve_volume_with_nonexistent_volume_id(self):
self.assertRaises(exceptions.NotFound,
self.client.unreserve_volume,
str(uuid.uuid4()))
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_reserve_volume_with_negative_volume_status(self):
# Mark volume as reserved.
resp, body = self.client.reserve_volume(self.volume['id'])
@ -232,7 +232,7 @@ class VolumesNegativeTest(base.BaseVolumeV1Test):
resp, body = self.client.unreserve_volume(self.volume['id'])
self.assertEqual(202, resp.status)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_list_volumes_with_nonexistent_name(self):
v_name = data_utils.rand_name('Volume-')
params = {'display_name': v_name}
@ -240,7 +240,7 @@ class VolumesNegativeTest(base.BaseVolumeV1Test):
self.assertEqual(200, resp.status)
self.assertEqual(0, len(fetched_volume))
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_list_volumes_detail_with_nonexistent_name(self):
v_name = data_utils.rand_name('Volume-')
params = {'display_name': v_name}
@ -248,14 +248,14 @@ class VolumesNegativeTest(base.BaseVolumeV1Test):
self.assertEqual(200, resp.status)
self.assertEqual(0, len(fetched_volume))
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_list_volumes_with_invalid_status(self):
params = {'status': 'null'}
resp, fetched_volume = self.client.list_volumes(params)
self.assertEqual(200, resp.status)
self.assertEqual(0, len(fetched_volume))
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_list_volumes_detail_with_invalid_status(self):
params = {'status': 'null'}
resp, fetched_volume = self.client.list_volumes_with_detail(params)

View File

@ -14,7 +14,7 @@ from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest import config
from tempest.openstack.common import log as logging
from tempest.test import attr
from tempest import test
LOG = logging.getLogger(__name__)
CONF = config.CONF
@ -63,7 +63,7 @@ class VolumesSnapshotTest(base.BaseVolumeV1Test):
('details' if with_detail else '', key)
self.assertEqual(params[key], snap[key], msg)
@attr(type='gate')
@test.attr(type='gate')
def test_snapshot_create_with_volume_in_use(self):
# Create a snapshot when volume status is in-use
# Create a test instance
@ -89,7 +89,7 @@ class VolumesSnapshotTest(base.BaseVolumeV1Test):
self.snapshots_client.wait_for_resource_deletion(snapshot['id'])
self.snapshots.remove(snapshot)
@attr(type='gate')
@test.attr(type='gate')
def test_snapshot_create_get_list_update_delete(self):
# Create a snapshot
s_name = data_utils.rand_name('snap')
@ -134,7 +134,7 @@ class VolumesSnapshotTest(base.BaseVolumeV1Test):
self.snapshots_client.wait_for_resource_deletion(snapshot['id'])
self.snapshots.remove(snapshot)
@attr(type='gate')
@test.attr(type='gate')
def test_snapshots_list_with_params(self):
"""list snapshots with params."""
# Create a snapshot
@ -155,7 +155,7 @@ class VolumesSnapshotTest(base.BaseVolumeV1Test):
'display_name': snapshot['display_name']}
self._list_by_param_values_and_assert(params)
@attr(type='gate')
@test.attr(type='gate')
def test_snapshots_list_details_with_params(self):
"""list snapshot details with params."""
# Create a snapshot
@ -174,7 +174,7 @@ class VolumesSnapshotTest(base.BaseVolumeV1Test):
'display_name': snapshot['display_name']}
self._list_by_param_values_and_assert(params, with_detail=True)
@attr(type='gate')
@test.attr(type='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

View File

@ -15,13 +15,13 @@ import uuid
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest import test
class VolumesSnapshotNegativeTest(base.BaseVolumeV1Test):
_interface = "json"
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_snapshot_with_nonexistent_volume_id(self):
# Create a snapshot with nonexistent volume id
s_name = data_utils.rand_name('snap')
@ -29,7 +29,7 @@ class VolumesSnapshotNegativeTest(base.BaseVolumeV1Test):
self.snapshots_client.create_snapshot,
str(uuid.uuid4()), display_name=s_name)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_snapshot_without_passing_volume_id(self):
# Create a snapshot without passing volume id
s_name = data_utils.rand_name('snap')

View File

@ -18,8 +18,8 @@ import operator
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest.openstack.common import log as logging
from tempest.test import attr
from testtools.matchers import ContainsAll
from tempest import test
from testtools import matchers
LOG = logging.getLogger(__name__)
@ -116,12 +116,12 @@ class VolumesV2ListTestJSON(base.BaseVolumeV2Test):
('details' if with_detail else '', key)
if key == 'metadata':
self.assertThat(volume[key].items(),
ContainsAll(params[key].items()),
msg)
matchers.ContainsAll(params[key]
.items()), msg)
else:
self.assertEqual(params[key], volume[key], msg)
@attr(type='smoke')
@test.attr(type='smoke')
def test_volume_list(self):
# Get a list of Volumes
# Fetch all volumes
@ -130,7 +130,7 @@ class VolumesV2ListTestJSON(base.BaseVolumeV2Test):
self.assertVolumesIn(fetched_list, self.volume_list,
fields=VOLUME_FIELDS)
@attr(type='gate')
@test.attr(type='gate')
def test_volume_list_with_details(self):
# Get a list of Volumes with details
# Fetch all Volumes
@ -138,7 +138,7 @@ class VolumesV2ListTestJSON(base.BaseVolumeV2Test):
self.assertEqual(200, resp.status)
self.assertVolumesIn(fetched_list, self.volume_list)
@attr(type='gate')
@test.attr(type='gate')
def test_volume_list_by_name(self):
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
params = {'name': volume['name']}
@ -147,7 +147,7 @@ class VolumesV2ListTestJSON(base.BaseVolumeV2Test):
self.assertEqual(1, len(fetched_vol), str(fetched_vol))
self.assertEqual(fetched_vol[0]['name'], volume['name'])
@attr(type='gate')
@test.attr(type='gate')
def test_volume_list_details_by_name(self):
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
params = {'name': volume['name']}
@ -156,43 +156,43 @@ class VolumesV2ListTestJSON(base.BaseVolumeV2Test):
self.assertEqual(1, len(fetched_vol), str(fetched_vol))
self.assertEqual(fetched_vol[0]['name'], volume['name'])
@attr(type='gate')
@test.attr(type='gate')
def test_volumes_list_by_status(self):
params = {'status': 'available'}
self._list_by_param_value_and_assert(params)
@attr(type='gate')
@test.attr(type='gate')
def test_volumes_list_details_by_status(self):
params = {'status': 'available'}
self._list_by_param_value_and_assert(params, with_detail=True)
@attr(type='gate')
@test.attr(type='gate')
def test_volumes_list_by_availability_zone(self):
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
zone = volume['availability_zone']
params = {'availability_zone': zone}
self._list_by_param_value_and_assert(params)
@attr(type='gate')
@test.attr(type='gate')
def test_volumes_list_details_by_availability_zone(self):
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
zone = volume['availability_zone']
params = {'availability_zone': zone}
self._list_by_param_value_and_assert(params, with_detail=True)
@attr(type='gate')
@test.attr(type='gate')
def test_volume_list_with_param_metadata(self):
# Test to list volumes when metadata param is given
params = {'metadata': self.metadata}
self._list_by_param_value_and_assert(params)
@attr(type='gate')
@test.attr(type='gate')
def test_volume_list_with_detail_param_metadata(self):
# Test to list volumes details when metadata param is given
params = {'metadata': self.metadata}
self._list_by_param_value_and_assert(params, with_detail=True)
@attr(type='gate')
@test.attr(type='gate')
def test_volume_list_param_display_name_and_status(self):
# Test to list volume when display name and status param is given
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
@ -200,7 +200,7 @@ class VolumesV2ListTestJSON(base.BaseVolumeV2Test):
'status': 'available'}
self._list_by_param_value_and_assert(params, expected_list=[volume])
@attr(type='gate')
@test.attr(type='gate')
def test_volume_list_with_detail_param_display_name_and_status(self):
# Test to list volume when name and status param is given
volume = self.volume_list[data_utils.rand_int_id(0, 2)]

View File

@ -14,11 +14,11 @@
# under the License.
import copy
import datetime
import exceptions
import re
import urlparse
from datetime import datetime
from tempest import config
from tempest.services.identity.json import identity_client as json_id
from tempest.services.identity.v3.json import identity_client as json_v3id
@ -291,9 +291,9 @@ class KeystoneV2AuthProvider(KeystoneAuthProvider):
def is_expired(self, auth_data):
_, access = auth_data
expiry = datetime.strptime(access['token']['expires'],
self.EXPIRY_DATE_FORMAT)
return expiry <= datetime.now()
expiry = datetime.datetime.strptime(access['token']['expires'],
self.EXPIRY_DATE_FORMAT)
return expiry <= datetime.datetime.now()
class KeystoneV3AuthProvider(KeystoneAuthProvider):
@ -391,6 +391,6 @@ class KeystoneV3AuthProvider(KeystoneAuthProvider):
def is_expired(self, auth_data):
_, access = auth_data
expiry = datetime.strptime(access['expires_at'],
self.EXPIRY_DATE_FORMAT)
return expiry <= datetime.now()
expiry = datetime.datetime.strptime(access['expires_at'],
self.EXPIRY_DATE_FORMAT)
return expiry <= datetime.datetime.now()

View File

@ -25,7 +25,7 @@ from tempest.common import http
from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.services.compute.xml.common import xml_to_json
from tempest.services.compute.xml import common
CONF = config.CONF
@ -299,11 +299,11 @@ class RestClient(object):
# Parse list-like xmls (users, roles, etc)
array = []
for child in element.getchildren():
array.append(xml_to_json(child))
array.append(common.xml_to_json(child))
return array
# Parse one-item-like xmls (user, role, etc)
return xml_to_json(element)
return common.xml_to_json(element)
def response_checker(self, method, url, headers, body, resp, resp_body):
if (resp.status in set((204, 205, 304)) or resp.status < 200 or