Merge "Skip test_volume_list_with_detail_param_marker"
diff --git a/HACKING.rst b/HACKING.rst
index b82f8c9..4095c4b 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -20,6 +20,7 @@
- [T110] Check that service client names of GET should be consistent
- [T111] Check that service client names of DELETE should be consistent
- [T112] Check that tempest.lib should not import local tempest code
+- [T113] Check that tests use data_utils.rand_uuid() instead of uuid.uuid4()
- [N322] Method's default argument shouldn't be mutable
Test Data/Configuration
diff --git a/requirements.txt b/requirements.txt
index 3913f8f..79ae42e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -21,7 +21,7 @@
fixtures<2.0,>=1.3.1 # Apache-2.0/BSD
testscenarios>=0.4 # Apache-2.0/BSD
PyYAML>=3.1.0 # MIT
-stevedore>=1.5.0 # Apache-2.0
+stevedore>=1.9.0 # Apache-2.0
PrettyTable<0.8,>=0.7 # BSD
os-testr>=0.4.1 # Apache-2.0
urllib3>=1.8.3 # MIT
diff --git a/tempest/api/baremetal/admin/test_ports_negative.py b/tempest/api/baremetal/admin/test_ports_negative.py
index 8f04db9..5e3a33f 100644
--- a/tempest/api/baremetal/admin/test_ports_negative.py
+++ b/tempest/api/baremetal/admin/test_ports_negative.py
@@ -37,7 +37,7 @@
@test.attr(type=['negative'])
@test.idempotent_id('30277ee8-0c60-4f1d-b125-0e51c2f43369')
def test_create_port_nonexsistent_node_id(self):
- node_id = str(data_utils.rand_uuid())
+ node_id = data_utils.rand_uuid()
address = data_utils.rand_mac_address()
self.assertRaises(lib_exc.BadRequest, self.create_port,
node_id=node_id, address=address)
diff --git a/tempest/api/compute/admin/test_flavors.py b/tempest/api/compute/admin/test_flavors.py
index 96dedcf..95e7ef1 100644
--- a/tempest/api/compute/admin/test_flavors.py
+++ b/tempest/api/compute/admin/test_flavors.py
@@ -91,7 +91,7 @@
@test.idempotent_id('94c9bb4e-2c2a-4f3c-bb1f-5f0daf918e6d')
def test_create_flavor_with_uuid_id(self):
- flavor_id = str(uuid.uuid4())
+ flavor_id = data_utils.rand_uuid()
new_flavor_id = self._create_flavor(flavor_id)
self.assertEqual(new_flavor_id, flavor_id)
diff --git a/tempest/api/compute/admin/test_flavors_access_negative.py b/tempest/api/compute/admin/test_flavors_access_negative.py
index 3854973..1b7eb12 100644
--- a/tempest/api/compute/admin/test_flavors_access_negative.py
+++ b/tempest/api/compute/admin/test_flavors_access_negative.py
@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
@@ -145,4 +143,4 @@
self.assertRaises(lib_exc.NotFound,
self.client.remove_flavor_access,
new_flavor['id'],
- str(uuid.uuid4()))
+ data_utils.rand_uuid())
diff --git a/tempest/api/compute/admin/test_hypervisor_negative.py b/tempest/api/compute/admin/test_hypervisor_negative.py
index f313f76..9c6df7f 100644
--- a/tempest/api/compute/admin/test_hypervisor_negative.py
+++ b/tempest/api/compute/admin/test_hypervisor_negative.py
@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
@@ -38,7 +36,7 @@
@test.attr(type=['negative'])
@test.idempotent_id('c136086a-0f67-4b2b-bc61-8482bd68989f')
def test_show_nonexistent_hypervisor(self):
- nonexistent_hypervisor_id = str(uuid.uuid4())
+ nonexistent_hypervisor_id = data_utils.rand_uuid()
self.assertRaises(
lib_exc.NotFound,
@@ -70,7 +68,7 @@
@test.attr(type=['negative'])
@test.idempotent_id('02463d69-0ace-4d33-a4a8-93d7883a2bba')
def test_show_servers_with_nonexistent_hypervisor(self):
- nonexistent_hypervisor_id = str(uuid.uuid4())
+ nonexistent_hypervisor_id = data_utils.rand_uuid()
self.assertRaises(
lib_exc.NotFound,
@@ -87,7 +85,7 @@
@test.attr(type=['negative'])
@test.idempotent_id('f60aa680-9a3a-4c7d-90e1-fae3a4891303')
def test_get_nonexistent_hypervisor_uptime(self):
- nonexistent_hypervisor_id = str(uuid.uuid4())
+ nonexistent_hypervisor_id = data_utils.rand_uuid()
self.assertRaises(
lib_exc.NotFound,
diff --git a/tempest/api/compute/admin/test_servers_negative.py b/tempest/api/compute/admin/test_servers_negative.py
index 07a7a30..7437c14 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
import testtools
from tempest.api.compute import base
@@ -147,7 +145,7 @@
# migrate a non existent server
self.assertRaises(lib_exc.NotFound,
self.client.migrate_server,
- str(uuid.uuid4()))
+ data_utils.rand_uuid())
@test.idempotent_id('b0b17f83-d14e-4fc4-8f31-bcc9f3cfa629')
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
index 105c4e3..f71f046 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.compute.floating_ips import base
from tempest.common.utils import data_utils
from tempest import config
@@ -47,7 +45,7 @@
while True:
cls.non_exist_id = data_utils.rand_int_id(start=999)
if CONF.service_available.neutron:
- cls.non_exist_id = str(uuid.uuid4())
+ cls.non_exist_id = data_utils.rand_uuid()
if cls.non_exist_id not in cls.floating_ip_ids:
break
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py b/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
index c6c7347..ea56ae9 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
@@ -39,7 +37,7 @@
# of non-existent floating IP
# Creating a non-existent floatingIP id
if CONF.service_available.neutron:
- non_exist_id = str(uuid.uuid4())
+ non_exist_id = data_utils.rand_uuid()
else:
non_exist_id = data_utils.rand_int_id(start=999)
self.assertRaises(lib_exc.NotFound,
diff --git a/tempest/api/compute/servers/test_virtual_interfaces_negative.py b/tempest/api/compute/servers/test_virtual_interfaces_negative.py
index e038b82..912b0a1 100644
--- a/tempest/api/compute/servers/test_virtual_interfaces_negative.py
+++ b/tempest/api/compute/servers/test_virtual_interfaces_negative.py
@@ -13,9 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.compute import base
+from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
@@ -39,7 +38,7 @@
def test_list_virtual_interfaces_invalid_server_id(self):
# Negative test: Should not be able to GET virtual interfaces
# for an invalid server_id
- invalid_server_id = str(uuid.uuid4())
+ invalid_server_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.client.list_virtual_interfaces,
invalid_server_id)
diff --git a/tempest/api/compute/volumes/test_volumes_negative.py b/tempest/api/compute/volumes/test_volumes_negative.py
index d1c48c4..92f5ea8 100644
--- a/tempest/api/compute/volumes/test_volumes_negative.py
+++ b/tempest/api/compute/volumes/test_volumes_negative.py
@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
@@ -45,7 +43,7 @@
# Creating a nonexistent volume id
# Trying to GET a non existent volume
self.assertRaises(lib_exc.NotFound, self.client.show_volume,
- str(uuid.uuid4()))
+ data_utils.rand_uuid())
@test.attr(type=['negative'])
@test.idempotent_id('54a34226-d910-4b00-9ef8-8683e6c55846')
@@ -54,7 +52,7 @@
# Creating nonexistent volume id
# Trying to DELETE a non existent volume
self.assertRaises(lib_exc.NotFound, self.client.delete_volume,
- str(uuid.uuid4()))
+ data_utils.rand_uuid())
@test.attr(type=['negative'])
@test.idempotent_id('5125ae14-152b-40a7-b3c5-eae15e9022ef')
diff --git a/tempest/api/identity/admin/v2/test_roles_negative.py b/tempest/api/identity/admin/v2/test_roles_negative.py
index 14f4306..fd56285 100644
--- a/tempest/api/identity/admin/v2/test_roles_negative.py
+++ b/tempest/api/identity/admin/v2/test_roles_negative.py
@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
@@ -115,7 +113,7 @@
@test.idempotent_id('38373691-8551-453a-b074-4260ad8298ef')
def test_delete_role_non_existent(self):
# Attempt to delete a non existent role should fail
- non_existent_role = str(uuid.uuid4().hex)
+ non_existent_role = data_utils.rand_uuid_hex()
self.assertRaises(lib_exc.NotFound, self.roles_client.delete_role,
non_existent_role)
@@ -146,7 +144,7 @@
def test_assign_user_role_for_non_existent_role(self):
# Attempt to assign a non existent role to user should fail
(user, tenant, role) = self._get_role_params()
- non_existent_role = str(uuid.uuid4().hex)
+ non_existent_role = data_utils.rand_uuid_hex()
self.assertRaises(lib_exc.NotFound, self.roles_client.assign_user_role,
tenant['id'], user['id'], non_existent_role)
@@ -155,7 +153,7 @@
def test_assign_user_role_for_non_existent_tenant(self):
# Attempt to assign a role on a non existent tenant should fail
(user, tenant, role) = self._get_role_params()
- non_existent_tenant = str(uuid.uuid4().hex)
+ non_existent_tenant = data_utils.rand_uuid_hex()
self.assertRaises(lib_exc.NotFound, self.roles_client.assign_user_role,
non_existent_tenant, user['id'], role['id'])
@@ -205,7 +203,7 @@
self.roles_client.assign_user_role(tenant['id'],
user['id'],
role['id'])
- non_existent_role = str(uuid.uuid4().hex)
+ non_existent_role = data_utils.rand_uuid_hex()
self.assertRaises(lib_exc.NotFound, self.roles_client.delete_user_role,
tenant['id'], user['id'], non_existent_role)
@@ -217,7 +215,7 @@
self.roles_client.assign_user_role(tenant['id'],
user['id'],
role['id'])
- non_existent_tenant = str(uuid.uuid4().hex)
+ non_existent_tenant = data_utils.rand_uuid_hex()
self.assertRaises(lib_exc.NotFound, self.roles_client.delete_user_role,
non_existent_tenant, user['id'], role['id'])
diff --git a/tempest/api/identity/admin/v2/test_tenant_negative.py b/tempest/api/identity/admin/v2/test_tenant_negative.py
index a4c1afc..5169dae 100644
--- a/tempest/api/identity/admin/v2/test_tenant_negative.py
+++ b/tempest/api/identity/admin/v2/test_tenant_negative.py
@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
@@ -70,7 +68,7 @@
def test_delete_non_existent_tenant(self):
# Attempt to delete a non existent tenant should fail
self.assertRaises(lib_exc.NotFound, self.tenants_client.delete_tenant,
- str(uuid.uuid4().hex))
+ data_utils.rand_uuid_hex())
@test.attr(type=['negative'])
@test.idempotent_id('af16f44b-a849-46cb-9f13-a751c388f739')
@@ -130,7 +128,7 @@
def test_update_non_existent_tenant(self):
# Attempt to update a non existent tenant should fail
self.assertRaises(lib_exc.NotFound, self.tenants_client.update_tenant,
- str(uuid.uuid4().hex))
+ data_utils.rand_uuid_hex())
@test.attr(type=['negative'])
@test.idempotent_id('41704dc5-c5f7-4f79-abfa-76e6fedc570b')
diff --git a/tempest/api/identity/admin/v2/test_users_negative.py b/tempest/api/identity/admin/v2/test_users_negative.py
index dee42b7..46ecba1 100644
--- a/tempest/api/identity/admin/v2/test_users_negative.py
+++ b/tempest/api/identity/admin/v2/test_users_negative.py
@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
@@ -108,7 +106,7 @@
def test_update_user_for_non_existent_user(self):
# Attempt to update a user non-existent user should fail
user_name = data_utils.rand_name('user')
- non_existent_id = str(uuid.uuid4())
+ non_existent_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.users_client.update_user,
non_existent_id, name=user_name)
diff --git a/tempest/api/image/v2/test_images_negative.py b/tempest/api/image/v2/test_images_negative.py
index fc74326..14de8fd 100644
--- a/tempest/api/image/v2/test_images_negative.py
+++ b/tempest/api/image/v2/test_images_negative.py
@@ -14,9 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.image import base
+from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
@@ -38,7 +37,7 @@
@test.idempotent_id('668743d5-08ad-4480-b2b8-15da34f81d9f')
def test_get_non_existent_image(self):
# get the non-existent image
- non_existent_id = str(uuid.uuid4())
+ non_existent_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.show_image,
non_existent_id)
@@ -72,7 +71,7 @@
@test.idempotent_id('6fe40f1c-57bd-4918-89cc-8500f850f3de')
def test_delete_non_existing_image(self):
# delete non-existent image
- non_existent_image_id = str(uuid.uuid4())
+ non_existent_image_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.delete_image,
non_existent_image_id)
diff --git a/tempest/api/image/v2/test_images_tags_negative.py b/tempest/api/image/v2/test_images_tags_negative.py
index 1aa2d11..dd5650f 100644
--- a/tempest/api/image/v2/test_images_tags_negative.py
+++ b/tempest/api/image/v2/test_images_tags_negative.py
@@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.image import base
from tempest.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
@@ -27,7 +25,7 @@
def test_update_tags_for_non_existing_image(self):
# Update tag with non existing image.
tag = data_utils.rand_name('tag')
- non_exist_image = str(uuid.uuid4())
+ non_exist_image = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.add_image_tag,
non_exist_image, tag)
diff --git a/tempest/api/network/test_security_groups_negative.py b/tempest/api/network/test_security_groups_negative.py
index 86d0b46..b9765c8 100644
--- a/tempest/api/network/test_security_groups_negative.py
+++ b/tempest/api/network/test_security_groups_negative.py
@@ -13,10 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.network import base_security_groups as base
from tempest import config
+from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
@@ -36,7 +35,7 @@
@test.attr(type=['negative'])
@test.idempotent_id('424fd5c3-9ddc-486a-b45f-39bf0c820fc6')
def test_show_non_existent_security_group(self):
- non_exist_id = str(uuid.uuid4())
+ non_exist_id = data_utils.rand_uuid()
self.assertRaises(
lib_exc.NotFound, self.security_groups_client.show_security_group,
non_exist_id)
@@ -44,7 +43,7 @@
@test.attr(type=['negative'])
@test.idempotent_id('4c094c09-000b-4e41-8100-9617600c02a6')
def test_show_non_existent_security_group_rule(self):
- non_exist_id = str(uuid.uuid4())
+ non_exist_id = data_utils.rand_uuid()
self.assertRaises(
lib_exc.NotFound,
self.security_group_rules_client.show_security_group_rule,
@@ -53,7 +52,7 @@
@test.attr(type=['negative'])
@test.idempotent_id('1f1bb89d-5664-4956-9fcd-83ee0fa603df')
def test_delete_non_existent_security_group(self):
- non_exist_id = str(uuid.uuid4())
+ non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.security_groups_client.delete_security_group,
non_exist_id
@@ -91,7 +90,7 @@
@test.idempotent_id('4bf786fd-2f02-443c-9716-5b98e159a49a')
def test_create_security_group_rule_with_non_existent_remote_groupid(self):
group_create_body, _ = self._create_security_group()
- non_exist_id = str(uuid.uuid4())
+ non_exist_id = data_utils.rand_uuid()
# Create rule with non existent remote_group_id
group_ids = ['bad_group_id', non_exist_id]
@@ -204,7 +203,7 @@
@test.idempotent_id('be308db6-a7cf-4d5c-9baf-71bafd73f35e')
def test_create_security_group_rule_with_non_existent_security_group(self):
# Create security group rules with not existing security group.
- non_existent_sg = str(uuid.uuid4())
+ non_existent_sg = data_utils.rand_uuid()
self.assertRaises(
lib_exc.NotFound,
self.security_group_rules_client.create_security_group_rule,
diff --git a/tempest/api/telemetry/test_alarming_api_negative.py b/tempest/api/telemetry/test_alarming_api_negative.py
index 0701b54..3e34f8b 100644
--- a/tempest/api/telemetry/test_alarming_api_negative.py
+++ b/tempest/api/telemetry/test_alarming_api_negative.py
@@ -17,8 +17,6 @@
from tempest.lib import exceptions as lib_exc
from tempest import test
-import uuid
-
class TelemetryAlarmingNegativeTest(base.BaseAlarmingTest):
"""Negative tests for show_alarm, update_alarm, show_alarm_history tests
@@ -33,7 +31,7 @@
@test.idempotent_id('668743d5-08ad-4480-b2b8-15da34f81e7d')
def test_get_non_existent_alarm(self):
# get the non-existent alarm
- non_existent_id = str(uuid.uuid4())
+ non_existent_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.alarming_client.show_alarm,
non_existent_id)
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
index 29ce2e7..f3e52e9 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
@@ -53,7 +51,7 @@
self.assertRaises(
lib_exc.BadRequest,
self.volume_types_client.update_volume_type_extra_specs,
- self.volume_type['id'], str(uuid.uuid4()),
+ self.volume_type['id'], data_utils.rand_uuid(),
extra_spec)
@test.idempotent_id('9bf7a657-b011-4aec-866d-81c496fbe5c8')
@@ -84,7 +82,7 @@
self.assertRaises(
lib_exc.NotFound,
self.volume_types_client.create_volume_type_extra_specs,
- str(uuid.uuid4()), extra_specs)
+ data_utils.rand_uuid(), extra_specs)
@test.idempotent_id('c821bdc8-43a4-4bf4-86c8-82f3858d5f7d')
def test_create_none_body(self):
@@ -110,7 +108,7 @@
self.assertRaises(
lib_exc.NotFound,
self.volume_types_client.delete_volume_type_extra_specs,
- str(uuid.uuid4()), extra_specs.keys()[0])
+ data_utils.rand_uuid(), extra_specs.keys()[0])
@test.idempotent_id('dee5cf0c-cdd6-4353-b70c-e847050d71fb')
def test_list_nonexistent_volume_type_id(self):
@@ -118,7 +116,7 @@
self.assertRaises(
lib_exc.NotFound,
self.volume_types_client.list_volume_types_extra_specs,
- str(uuid.uuid4()))
+ data_utils.rand_uuid())
@test.idempotent_id('9f402cbd-1838-4eb4-9554-126a6b1908c9')
def test_get_nonexistent_volume_type_id(self):
@@ -127,7 +125,7 @@
self.assertRaises(
lib_exc.NotFound,
self.volume_types_client.show_volume_type_extra_specs,
- str(uuid.uuid4()), extra_specs.keys()[0])
+ data_utils.rand_uuid(), extra_specs.keys()[0])
@test.idempotent_id('c881797d-12ff-4f1a-b09d-9f6212159753')
def test_get_nonexistent_extra_spec_id(self):
@@ -136,7 +134,7 @@
self.assertRaises(
lib_exc.NotFound,
self.volume_types_client.show_volume_type_extra_specs,
- self.volume_type['id'], str(uuid.uuid4()))
+ self.volume_type['id'], data_utils.rand_uuid())
class ExtraSpecsNegativeV1Test(ExtraSpecsNegativeV2Test):
diff --git a/tempest/api/volume/admin/test_volume_types_negative.py b/tempest/api/volume/admin/test_volume_types_negative.py
index bccf20e..aff5466 100644
--- a/tempest/api/volume/admin/test_volume_types_negative.py
+++ b/tempest/api/volume/admin/test_volume_types_negative.py
@@ -13,9 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.volume import base
+from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
@@ -26,8 +25,8 @@
def test_create_with_nonexistent_volume_type(self):
# Should not be able to create volume with nonexistent volume_type.
self.name_field = self.special_fields['name_field']
- params = {self.name_field: str(uuid.uuid4()),
- 'volume_type': str(uuid.uuid4())}
+ params = {self.name_field: data_utils.rand_uuid(),
+ 'volume_type': data_utils.rand_uuid()}
self.assertRaises(lib_exc.NotFound,
self.volumes_client.create_volume, **params)
@@ -42,14 +41,14 @@
# Should not be able to get volume type with nonexistent type id.
self.assertRaises(lib_exc.NotFound,
self.volume_types_client.show_volume_type,
- str(uuid.uuid4()))
+ data_utils.rand_uuid())
@test.idempotent_id('6b3926d2-7d73-4896-bc3d-e42dfd11a9f6')
def test_delete_nonexistent_type_id(self):
# Should not be able to delete volume type with nonexistent type id.
self.assertRaises(lib_exc.NotFound,
self.volume_types_client.delete_volume_type,
- str(uuid.uuid4()))
+ data_utils.rand_uuid())
class VolumeTypesNegativeV1Test(VolumeTypesNegativeV2Test):
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index 1b5e72a..77bfaf1 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest.common import waiters
@@ -44,14 +42,14 @@
def test_volume_get_nonexistent_volume_id(self):
# Should not be able to get a non-existent volume
self.assertRaises(lib_exc.NotFound, self.client.show_volume,
- str(uuid.uuid4()))
+ data_utils.rand_uuid())
@test.attr(type=['negative'])
@test.idempotent_id('555efa6e-efcd-44ef-8a3b-4a7ca4837a29')
def test_volume_delete_nonexistent_volume_id(self):
# Should not be able to delete a non-existent Volume
self.assertRaises(lib_exc.NotFound, self.client.delete_volume,
- str(uuid.uuid4()))
+ data_utils.rand_uuid())
@test.attr(type=['negative'])
@test.idempotent_id('1ed83a8a-682d-4dfb-a30e-ee63ffd6c049')
@@ -98,7 +96,7 @@
v_name = data_utils.rand_name('Volume')
metadata = {'Type': 'work'}
self.assertRaises(lib_exc.NotFound, self.client.create_volume,
- size='1', volume_type=str(uuid.uuid4()),
+ size='1', volume_type=data_utils.rand_uuid(),
display_name=v_name, metadata=metadata)
@test.attr(type=['negative'])
@@ -108,7 +106,7 @@
v_name = data_utils.rand_name('Volume')
metadata = {'Type': 'work'}
self.assertRaises(lib_exc.NotFound, self.client.create_volume,
- size='1', snapshot_id=str(uuid.uuid4()),
+ size='1', snapshot_id=data_utils.rand_uuid(),
display_name=v_name, metadata=metadata)
@test.attr(type=['negative'])
@@ -118,7 +116,7 @@
v_name = data_utils.rand_name('Volume')
metadata = {'Type': 'work'}
self.assertRaises(lib_exc.NotFound, self.client.create_volume,
- size='1', source_volid=str(uuid.uuid4()),
+ size='1', source_volid=data_utils.rand_uuid(),
display_name=v_name, metadata=metadata)
@test.attr(type=['negative'])
@@ -127,7 +125,8 @@
v_name = data_utils.rand_name('Volume')
metadata = {'Type': 'work'}
self.assertRaises(lib_exc.NotFound, self.client.update_volume,
- volume_id=str(uuid.uuid4()), display_name=v_name,
+ volume_id=data_utils.rand_uuid(),
+ display_name=v_name,
metadata=metadata)
@test.attr(type=['negative'])
@@ -188,7 +187,7 @@
self.assertRaises(lib_exc.NotFound,
self.client.attach_volume,
- str(uuid.uuid4()),
+ data_utils.rand_uuid(),
instance_uuid=server['id'],
mountpoint=self.mountpoint)
@@ -229,7 +228,7 @@
# Extend volume size when volume is nonexistent.
extend_size = int(self.volume['size']) + 1
self.assertRaises(lib_exc.NotFound, self.client.extend_volume,
- str(uuid.uuid4()), new_size=extend_size)
+ data_utils.rand_uuid(), new_size=extend_size)
@test.attr(type=['negative'])
@test.idempotent_id('aff8ba64-6d6f-4f2e-bc33-41a08ee9f115')
@@ -244,14 +243,14 @@
def test_reserve_volume_with_nonexistent_volume_id(self):
self.assertRaises(lib_exc.NotFound,
self.client.reserve_volume,
- str(uuid.uuid4()))
+ data_utils.rand_uuid())
@test.attr(type=['negative'])
@test.idempotent_id('eb467654-3dc1-4a72-9b46-47c29d22654c')
def test_unreserve_volume_with_nonexistent_volume_id(self):
self.assertRaises(lib_exc.NotFound,
self.client.unreserve_volume,
- str(uuid.uuid4()))
+ data_utils.rand_uuid())
@test.attr(type=['negative'])
@test.idempotent_id('449c4ed2-ecdd-47bb-98dc-072aeccf158c')
diff --git a/tempest/api/volume/test_volumes_snapshots_negative.py b/tempest/api/volume/test_volumes_snapshots_negative.py
index 54459ac..374979c 100644
--- a/tempest/api/volume/test_volumes_snapshots_negative.py
+++ b/tempest/api/volume/test_volumes_snapshots_negative.py
@@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest import config
@@ -36,7 +34,8 @@
s_name = data_utils.rand_name('snap')
self.assertRaises(lib_exc.NotFound,
self.snapshots_client.create_snapshot,
- volume_id=str(uuid.uuid4()), display_name=s_name)
+ volume_id=data_utils.rand_uuid(),
+ display_name=s_name)
@test.attr(type=['negative'])
@test.idempotent_id('bb9da53e-d335-4309-9c15-7e76fd5e4d6d')
diff --git a/tempest/cmd/verify_tempest_config.py b/tempest/cmd/verify_tempest_config.py
index f29973d..3ef04f5 100644
--- a/tempest/cmd/verify_tempest_config.py
+++ b/tempest/cmd/verify_tempest_config.py
@@ -365,7 +365,16 @@
CONF_PARSER = moves.configparser.SafeConfigParser()
CONF_PARSER.optionxform = str
CONF_PARSER.readfp(conf_file)
- icreds = credentials.get_credentials_provider('verify_tempest_config')
+
+ # Indicate not to create network resources as part of getting credentials
+ net_resources = {
+ 'network': False,
+ 'router': False,
+ 'subnet': False,
+ 'dhcp': False
+ }
+ icreds = credentials.get_credentials_provider(
+ 'verify_tempest_config', network_resources=net_resources)
try:
os = clients.Manager(icreds.get_primary_creds())
services = check_service_availability(os, update)
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 031df7f..b8e052f 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -82,11 +82,6 @@
message = "Image %(image_id)s failed to become ACTIVE in the allotted time"
-class EC2RegisterImageException(TempestException):
- message = ("Image %(image_id)s failed to become 'available' "
- "in the allotted time")
-
-
class VolumeBuildErrorException(TempestException):
message = "Volume %(volume_id)s failed to build and is in ERROR status"
@@ -108,25 +103,10 @@
"due to '%(stack_status_reason)s'")
-class StackResourceBuildErrorException(TempestException):
- message = ("Resource %(resource_name)s in stack %(stack_identifier)s is "
- "in %(resource_status)s status due to "
- "'%(resource_status_reason)s'")
-
-
-class AuthenticationFailure(TempestException):
- message = ("Authentication with user %(user)s and password "
- "%(password)s failed auth using tenant %(tenant)s.")
-
-
class EndpointNotFound(TempestException):
message = "Endpoint not found"
-class ImageFault(TempestException):
- message = "Got image fault"
-
-
class IdentityError(TempestException):
message = "Got identity error"
@@ -135,10 +115,6 @@
message = "The server is not reachable via the configured network"
-class TearDownException(TempestException):
- message = "%(num)d cleanUp operation failed"
-
-
# NOTE(andreaf) This exception is added here to facilitate the migration
# of get_network_from_name and preprov_creds to tempest-lib, and it should
# be migrated along with them
diff --git a/tempest/hacking/checks.py b/tempest/hacking/checks.py
index 9ebb17e..d0e1fcb 100644
--- a/tempest/hacking/checks.py
+++ b/tempest/hacking/checks.py
@@ -241,6 +241,22 @@
yield (0, msg)
+def use_rand_uuid_instead_of_uuid4(logical_line, filename):
+ """Check that tests use data_utils.rand_uuid() instead of uuid.uuid4()
+
+ T113
+ """
+ if 'tempest/lib/' in filename:
+ return
+
+ if 'uuid.uuid4()' not in logical_line:
+ return
+
+ msg = ("T113: Tests should use data_utils.rand_uuid()/rand_uuid_hex() "
+ "instead of uuid.uuid4()/uuid.uuid4().hex")
+ yield (0, msg)
+
+
def factory(register):
register(import_no_clients_in_api_and_scenario_tests)
register(scenario_tests_need_service_tags)
@@ -253,3 +269,4 @@
register(get_resources_on_service_clients)
register(delete_resources_on_service_clients)
register(dont_import_local_tempest_into_lib)
+ register(use_rand_uuid_instead_of_uuid4)
diff --git a/tempest/test.py b/tempest/test.py
index 6ba4962..b32beaa 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -19,7 +19,6 @@
import re
import sys
import time
-import uuid
import fixtures
from oslo_log import log as logging
@@ -38,6 +37,7 @@
import tempest.common.validation_resources as vresources
from tempest import config
from tempest import exceptions
+from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
LOG = logging.getLogger(__name__)
@@ -714,10 +714,10 @@
resource = resource['name']
LOG.debug("Add resource to test %s" % resource)
scn_name = "inv_res_%s" % (resource)
- scenario_list.append((scn_name, {"resource": (resource,
- str(uuid.uuid4())),
- "expected_result": expected_result
- }))
+ scenario_list.append((scn_name, {
+ "resource": (resource, data_utils.rand_uuid()),
+ "expected_result": expected_result
+ }))
if schema is not None:
for scenario in generator.generate_scenarios(schema):
scenario_list.append((scenario['_negtest_name'],
diff --git a/tempest/tests/cmd/test_verify_tempest_config.py b/tempest/tests/cmd/test_verify_tempest_config.py
index 9df07a1..330c393 100644
--- a/tempest/tests/cmd/test_verify_tempest_config.py
+++ b/tempest/tests/cmd/test_verify_tempest_config.py
@@ -41,7 +41,8 @@
def setUp(self):
super(TestDiscovery, self).setUp()
self.useFixture(fake_config.ConfigFixture())
- self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
+ self.patchobject(config, 'TempestConfigPrivate',
+ fake_config.FakePrivate)
def test_get_keystone_api_versions(self):
self.useFixture(mockpatch.PatchObject(
diff --git a/tempest/tests/common/test_admin_available.py b/tempest/tests/common/test_admin_available.py
index c803541..7461c4b 100644
--- a/tempest/tests/common/test_admin_available.py
+++ b/tempest/tests/common/test_admin_available.py
@@ -28,7 +28,8 @@
def setUp(self):
super(TestAdminAvailable, self).setUp()
self.useFixture(fake_config.ConfigFixture())
- self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
+ self.patchobject(config, 'TempestConfigPrivate',
+ fake_config.FakePrivate)
def run_test(self, dynamic_creds, use_accounts_file, admin_creds):
diff --git a/tempest/tests/common/test_alt_available.py b/tempest/tests/common/test_alt_available.py
index cb1de16..1a36068 100644
--- a/tempest/tests/common/test_alt_available.py
+++ b/tempest/tests/common/test_alt_available.py
@@ -28,7 +28,8 @@
def setUp(self):
super(TestAltAvailable, self).setUp()
self.useFixture(fake_config.ConfigFixture())
- self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
+ self.patchobject(config, 'TempestConfigPrivate',
+ fake_config.FakePrivate)
def run_test(self, dynamic_creds, use_accounts_file, creds):
diff --git a/tempest/tests/common/test_configured_creds.py b/tempest/tests/common/test_configured_creds.py
index 3c104b2..2ce354d 100644
--- a/tempest/tests/common/test_configured_creds.py
+++ b/tempest/tests/common/test_configured_creds.py
@@ -41,9 +41,10 @@
def setUp(self):
super(ConfiguredV2CredentialsTests, self).setUp()
self.useFixture(fake_config.ConfigFixture())
- self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
- self.stubs.Set(self.tokenclient_class, 'raw_request',
- self.identity_response)
+ self.patchobject(config, 'TempestConfigPrivate',
+ fake_config.FakePrivate)
+ self.patchobject(self.tokenclient_class, 'raw_request',
+ self.identity_response)
def _get_credentials(self, attributes=None):
if attributes is None:
diff --git a/tempest/tests/common/test_credentials.py b/tempest/tests/common/test_credentials.py
index 6fc490e..3d09d9f 100644
--- a/tempest/tests/common/test_credentials.py
+++ b/tempest/tests/common/test_credentials.py
@@ -26,7 +26,8 @@
def setUp(self):
super(TestLegacyCredentialsProvider, self).setUp()
self.useFixture(fake_config.ConfigFixture())
- self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
+ self.patchobject(config, 'TempestConfigPrivate',
+ fake_config.FakePrivate)
def test_get_creds_roles_legacy_invalid(self):
test_accounts_class = credentials.LegacyCredentialProvider(
diff --git a/tempest/tests/common/test_dynamic_creds.py b/tempest/tests/common/test_dynamic_creds.py
index e1d9023..1488793 100644
--- a/tempest/tests/common/test_dynamic_creds.py
+++ b/tempest/tests/common/test_dynamic_creds.py
@@ -46,9 +46,10 @@
def setUp(self):
super(TestDynamicCredentialProvider, self).setUp()
self.useFixture(fake_config.ConfigFixture())
- self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
- self.stubs.Set(json_token_client.TokenClient, 'raw_request',
- fake_identity._fake_v2_response)
+ self.patchobject(config, 'TempestConfigPrivate',
+ fake_config.FakePrivate)
+ self.patchobject(json_token_client.TokenClient, 'raw_request',
+ fake_identity._fake_v2_response)
cfg.CONF.set_default('operator_role', 'FakeRole',
group='object-storage')
self._mock_list_ec2_credentials('fake_user_id', 'fake_tenant_id')
diff --git a/tempest/tests/common/test_preprov_creds.py b/tempest/tests/common/test_preprov_creds.py
index 36d6c3d..fba5b1f 100644
--- a/tempest/tests/common/test_preprov_creds.py
+++ b/tempest/tests/common/test_preprov_creds.py
@@ -46,9 +46,10 @@
def setUp(self):
super(TestPreProvisionedCredentials, self).setUp()
self.useFixture(fake_config.ConfigFixture())
- self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
- self.stubs.Set(token_client.TokenClient, 'raw_request',
- fake_identity._fake_v2_response)
+ self.patchobject(config, 'TempestConfigPrivate',
+ fake_config.FakePrivate)
+ self.patchobject(token_client.TokenClient, 'raw_request',
+ fake_identity._fake_v2_response)
self.useFixture(lockutils_fixtures.ExternalLockFixture())
self.test_accounts = [
{'username': 'test_user1', 'tenant_name': 'test_tenant1',
@@ -96,8 +97,8 @@
return hash_list
def test_get_hash(self):
- self.stubs.Set(token_client.TokenClient, 'raw_request',
- fake_identity._fake_v2_response)
+ self.patchobject(token_client.TokenClient, 'raw_request',
+ fake_identity._fake_v2_response)
test_account_class = preprov_creds.PreProvisionedCredentialProvider(
**self.fixed_params)
hash_list = self._get_hash_list(self.test_accounts)
@@ -188,7 +189,7 @@
return False
return True
- self.stubs.Set(os.path, 'isfile', _fake_is_file)
+ self.patchobject(os.path, 'isfile', _fake_is_file)
with mock.patch('six.moves.builtins.open', mock.mock_open(),
create=True) as open_mock:
test_account_class._get_free_hash(hash_list)
diff --git a/tempest/tests/common/utils/linux/test_remote_client.py b/tempest/tests/common/utils/linux/test_remote_client.py
index 22cf47a..b3bba72 100644
--- a/tempest/tests/common/utils/linux/test_remote_client.py
+++ b/tempest/tests/common/utils/linux/test_remote_client.py
@@ -27,7 +27,8 @@
def setUp(self):
super(TestRemoteClient, self).setUp()
self.useFixture(fake_config.ConfigFixture())
- self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
+ self.patchobject(config, 'TempestConfigPrivate',
+ fake_config.FakePrivate)
cfg.CONF.set_default('ip_version_for_ssh', 4, group='validation')
cfg.CONF.set_default('network_for_ssh', 'public', group='validation')
cfg.CONF.set_default('connect_timeout', 1, group='validation')
diff --git a/tempest/tests/lib/base.py b/tempest/tests/lib/base.py
index fe9268e..ca81d4d 100644
--- a/tempest/tests/lib/base.py
+++ b/tempest/tests/lib/base.py
@@ -14,17 +14,10 @@
import mock
from oslotest import base
-from oslotest import moxstubout
class TestCase(base.BaseTestCase):
- def setUp(self):
- super(TestCase, self).setUp()
- mox_fixture = self.useFixture(moxstubout.MoxStubout())
- self.mox = mox_fixture.mox
- self.stubs = mox_fixture.stubs
-
def patch(self, target, **kwargs):
"""Returns a started `mock.patch` object for the supplied target.
@@ -42,3 +35,15 @@
m = p.start()
self.addCleanup(p.stop)
return m
+
+ def patchobject(self, target, attribute, new=mock.DEFAULT):
+ """Convenient wrapper around `mock.patch.object`
+
+ Returns a started mock that will be automatically stopped after the
+ test ran.
+ """
+
+ p = mock.patch.object(target, attribute, new)
+ m = p.start()
+ self.addCleanup(p.stop)
+ return m
diff --git a/tempest/tests/lib/test_auth.py b/tempest/tests/lib/test_auth.py
index 5502c01..50ad566 100644
--- a/tempest/tests/lib/test_auth.py
+++ b/tempest/tests/lib/test_auth.py
@@ -41,7 +41,7 @@
def setUp(self):
super(BaseAuthTestsSetUp, self).setUp()
- self.stubs.Set(auth, 'get_credentials', fake_get_credentials)
+ self.patchobject(auth, 'get_credentials', fake_get_credentials)
self.auth_provider = self._auth(self.credentials,
fake_identity.FAKE_AUTH_URL)
@@ -118,8 +118,8 @@
def setUp(self):
super(TestKeystoneV2AuthProvider, self).setUp()
- self.stubs.Set(v2_client.TokenClient, 'raw_request',
- fake_identity._fake_v2_response)
+ self.patchobject(v2_client.TokenClient, 'raw_request',
+ fake_identity._fake_v2_response)
self.target_url = 'test_api'
def _get_fake_identity(self):
@@ -433,8 +433,8 @@
def setUp(self):
super(TestKeystoneV3AuthProvider, self).setUp()
- self.stubs.Set(v3_client.V3TokenClient, 'raw_request',
- fake_identity._fake_v3_response)
+ self.patchobject(v3_client.V3TokenClient, 'raw_request',
+ fake_identity._fake_v3_response)
def _get_fake_identity(self):
return fake_identity.IDENTITY_V3_RESPONSE['token']
diff --git a/tempest/tests/lib/test_credentials.py b/tempest/tests/lib/test_credentials.py
index 791fbb5..b8acf83 100644
--- a/tempest/tests/lib/test_credentials.py
+++ b/tempest/tests/lib/test_credentials.py
@@ -72,8 +72,8 @@
def setUp(self):
super(KeystoneV2CredentialsTests, self).setUp()
- self.stubs.Set(self.tokenclient_class, 'raw_request',
- self.identity_response)
+ self.patchobject(self.tokenclient_class, 'raw_request',
+ self.identity_response)
def _verify_credentials(self, credentials_class, creds_dict, filled=True):
creds = auth.get_credentials(fake_identity.FAKE_AUTH_URL,
diff --git a/tempest/tests/lib/test_decorators.py b/tempest/tests/lib/test_decorators.py
index 07b577c..f83bcbb 100644
--- a/tempest/tests/lib/test_decorators.py
+++ b/tempest/tests/lib/test_decorators.py
@@ -13,11 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
import testtools
from tempest.lib import base as test
+from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.tests.lib import base
@@ -78,13 +77,13 @@
return foo
def test_positive(self):
- _id = str(uuid.uuid4())
+ _id = data_utils.rand_uuid()
foo = self._test_helper(_id)
self.assertIn('id-%s' % _id, getattr(foo, '__testtools_attrs'))
self.assertTrue(foo.__doc__.startswith('Test idempotent id: %s' % _id))
def test_positive_without_doc(self):
- _id = str(uuid.uuid4())
+ _id = data_utils.rand_uuid()
foo = self._test_helper_without_doc(_id)
self.assertTrue(foo.__doc__.startswith('Test idempotent id: %s' % _id))
diff --git a/tempest/tests/lib/test_rest_client.py b/tempest/tests/lib/test_rest_client.py
index 90651b0..572b446 100644
--- a/tempest/tests/lib/test_rest_client.py
+++ b/tempest/tests/lib/test_rest_client.py
@@ -37,9 +37,7 @@
self.fake_auth_provider = fake_auth_provider.FakeAuthProvider()
self.rest_client = rest_client.RestClient(
self.fake_auth_provider, None, None)
- self.stubs.Set(http.ClosingHttp, 'request',
- self.fake_http.request)
-
+ self.patchobject(http.ClosingHttp, 'request', self.fake_http.request)
self.useFixture(mockpatch.PatchObject(self.rest_client,
'_log_request'))
diff --git a/tempest/tests/negative/test_negative_auto_test.py b/tempest/tests/negative/test_negative_auto_test.py
index c666bd3..1795466 100644
--- a/tempest/tests/negative/test_negative_auto_test.py
+++ b/tempest/tests/negative/test_negative_auto_test.py
@@ -37,7 +37,8 @@
def setUp(self):
super(TestNegativeAutoTest, self).setUp()
self.useFixture(fake_config.ConfigFixture())
- self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
+ self.patchobject(config, 'TempestConfigPrivate',
+ fake_config.FakePrivate)
def _check_prop_entries(self, result, entry):
entries = [a for a in result if entry in a[0]]
diff --git a/tempest/tests/test_decorators.py b/tempest/tests/test_decorators.py
index 4c9a3b7..ee68676 100644
--- a/tempest/tests/test_decorators.py
+++ b/tempest/tests/test_decorators.py
@@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
import mock
from oslo_config import cfg
from oslotest import mockpatch
@@ -21,6 +19,7 @@
from tempest import config
from tempest import exceptions
+from tempest.lib.common.utils import data_utils
from tempest import test
from tempest.tests import fake_config
from tempest.tests.lib import base
@@ -30,7 +29,8 @@
def setUp(self):
super(BaseDecoratorsTest, self).setUp()
self.config_fixture = self.useFixture(fake_config.ConfigFixture())
- self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
+ self.patchobject(config, 'TempestConfigPrivate',
+ fake_config.FakePrivate)
class TestAttrDecorator(BaseDecoratorsTest):
@@ -79,13 +79,13 @@
return foo
def test_positive(self):
- _id = str(uuid.uuid4())
+ _id = data_utils.rand_uuid()
foo = self._test_helper(_id)
self.assertIn('id-%s' % _id, getattr(foo, '__testtools_attrs'))
self.assertTrue(foo.__doc__.startswith('Test idempotent id: %s' % _id))
def test_positive_without_doc(self):
- _id = str(uuid.uuid4())
+ _id = data_utils.rand_uuid()
foo = self._test_helper_without_doc(_id)
self.assertTrue(foo.__doc__.startswith('Test idempotent id: %s' % _id))
diff --git a/tempest/tests/test_microversions.py b/tempest/tests/test_microversions.py
index 1ac1232..b80cf80 100644
--- a/tempest/tests/test_microversions.py
+++ b/tempest/tests/test_microversions.py
@@ -57,8 +57,8 @@
def setUp(self):
super(TestMicroversionsTestsClass, self).setUp()
self.useFixture(fake_config.ConfigFixture())
- self.stubs.Set(config, 'TempestConfigPrivate',
- fake_config.FakePrivate)
+ self.patchobject(config, 'TempestConfigPrivate',
+ fake_config.FakePrivate)
def _test_version(self, cfg_min, cfg_max,
expected_pass_tests,
diff --git a/tempest/tests/test_negative_rest_client.py b/tempest/tests/test_negative_rest_client.py
index a1b5f0e..e46649c 100644
--- a/tempest/tests/test_negative_rest_client.py
+++ b/tempest/tests/test_negative_rest_client.py
@@ -32,7 +32,8 @@
def setUp(self):
super(TestNegativeRestClient, self).setUp()
self.useFixture(fake_config.ConfigFixture())
- self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
+ self.patchobject(config, 'TempestConfigPrivate',
+ fake_config.FakePrivate)
self.negative_rest_client = negative_rest_client.NegativeRestClient(
fake_auth_provider.FakeAuthProvider(), None)
self.useFixture(mockpatch.PatchObject(self.negative_rest_client,
diff --git a/test-requirements.txt b/test-requirements.txt
index bb4b27f..9ef956a 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -7,7 +7,6 @@
python-subunit>=0.0.18 # Apache-2.0/BSD
oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0
reno>=1.6.2 # Apache2
-mox>=0.5.3 # Apache-2.0
mock>=1.2 # BSD
coverage>=3.6 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0
diff --git a/tox.ini b/tox.ini
index 28dfe8b..e371406 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,23 +5,27 @@
[tempestenv]
sitepackages = False
-setenv = VIRTUAL_ENV={envdir}
- OS_TEST_PATH=./tempest/test_discover
-deps = setuptools
- -r{toxinidir}/requirements.txt
+setenv =
+ VIRTUAL_ENV={envdir}
+ OS_TEST_PATH=./tempest/test_discover
+deps =
+ setuptools
+ -r{toxinidir}/requirements.txt
[testenv]
-setenv = VIRTUAL_ENV={envdir}
- OS_TEST_PATH=./tempest/tests
+setenv =
+ VIRTUAL_ENV={envdir}
+ OS_TEST_PATH=./tempest/tests
passenv = OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_TEST_TIMEOUT OS_TEST_LOCK_PATH OS_TEST_PATH TEMPEST_CONFIG TEMPEST_CONFIG_DIR http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
usedevelop = True
install_command = pip install -U {opts} {packages}
whitelist_externals = *
-deps = -r{toxinidir}/requirements.txt
- -r{toxinidir}/test-requirements.txt
+deps =
+ -r{toxinidir}/requirements.txt
+ -r{toxinidir}/test-requirements.txt
commands =
- find . -type f -name "*.pyc" -delete
- bash tools/pretty_tox.sh '{posargs}'
+ find . -type f -name "*.pyc" -delete
+ bash tools/pretty_tox.sh '{posargs}'
[testenv:genconfig]
commands = oslo-config-generator --config-file etc/config-generator.tempest.conf
@@ -33,22 +37,35 @@
[testenv:all]
sitepackages = {[tempestenv]sitepackages}
# 'all' includes slow tests
-setenv = {[tempestenv]setenv}
- OS_TEST_TIMEOUT={env:OS_TEST_TIMEOUT:1200}
+setenv =
+ {[tempestenv]setenv}
+ OS_TEST_TIMEOUT={env:OS_TEST_TIMEOUT:1200}
deps = {[tempestenv]deps}
commands =
- find . -type f -name "*.pyc" -delete
- bash tools/pretty_tox.sh '{posargs}'
+ find . -type f -name "*.pyc" -delete
+ bash tools/pretty_tox.sh '{posargs}'
+
+[testenv:ostestr]
+sitepackages = {[tempestenv]sitepackages}
+# 'all' includes slow tests
+setenv =
+ {[tempestenv]setenv}
+ OS_TEST_TIMEOUT={env:OS_TEST_TIMEOUT:1200}
+deps = {[tempestenv]deps}
+commands =
+ find . -type f -name "*.pyc" -delete
+ ostestr {posargs}
[testenv:all-plugin]
sitepackages = True
# 'all' includes slow tests
-setenv = {[tempestenv]setenv}
- OS_TEST_TIMEOUT={env:OS_TEST_TIMEOUT:1200}
+setenv =
+ {[tempestenv]setenv}
+ OS_TEST_TIMEOUT={env:OS_TEST_TIMEOUT:1200}
deps = {[tempestenv]deps}
commands =
- find . -type f -name "*.pyc" -delete
- bash tools/pretty_tox.sh '{posargs}'
+ find . -type f -name "*.pyc" -delete
+ bash tools/pretty_tox.sh '{posargs}'
[testenv:full]
sitepackages = {[tempestenv]sitepackages}
@@ -57,8 +74,8 @@
# The regex below is used to select which tests to run and exclude the slow tag:
# See the testrepository bug: https://bugs.launchpad.net/testrepository/+bug/1208610
commands =
- find . -type f -name "*.pyc" -delete
- bash tools/pretty_tox.sh '(?!.*\[.*\bslow\b.*\])(^tempest\.(api|scenario|thirdparty)) {posargs}'
+ find . -type f -name "*.pyc" -delete
+ bash tools/pretty_tox.sh '(?!.*\[.*\bslow\b.*\])(^tempest\.(api|scenario|thirdparty)) {posargs}'
[testenv:full-serial]
sitepackages = {[tempestenv]sitepackages}
@@ -67,16 +84,16 @@
# The regex below is used to select which tests to run and exclude the slow tag:
# See the testrepository bug: https://bugs.launchpad.net/testrepository/+bug/1208610
commands =
- find . -type f -name "*.pyc" -delete
- bash tools/pretty_tox_serial.sh '(?!.*\[.*\bslow\b.*\])(^tempest\.(api|scenario|thirdparty)) {posargs}'
+ find . -type f -name "*.pyc" -delete
+ bash tools/pretty_tox_serial.sh '(?!.*\[.*\bslow\b.*\])(^tempest\.(api|scenario|thirdparty)) {posargs}'
[testenv:smoke]
sitepackages = {[tempestenv]sitepackages}
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
commands =
- find . -type f -name "*.pyc" -delete
- bash tools/pretty_tox.sh '\[.*\bsmoke\b.*\] {posargs}'
+ find . -type f -name "*.pyc" -delete
+ bash tools/pretty_tox.sh '\[.*\bsmoke\b.*\] {posargs}'
[testenv:smoke-serial]
sitepackages = {[tempestenv]sitepackages}
@@ -86,8 +103,8 @@
# https://bugs.launchpad.net/tempest/+bug/1216076 so the neutron smoke
# job would fail if we moved it to parallel.
commands =
- find . -type f -name "*.pyc" -delete
- bash tools/pretty_tox_serial.sh '\[.*\bsmoke\b.*\] {posargs}'
+ find . -type f -name "*.pyc" -delete
+ bash tools/pretty_tox_serial.sh '\[.*\bsmoke\b.*\] {posargs}'
[testenv:stress]
sitepackages = {[tempestenv]sitepackages}
@@ -101,16 +118,16 @@
[testenv:docs]
commands =
- python setup.py build_sphinx {posargs}
+ python setup.py build_sphinx {posargs}
[testenv:pep8]
commands =
- flake8 {posargs}
- check-uuid
+ flake8 {posargs}
+ check-uuid
[testenv:uuidgen]
commands =
- check-uuid --fix
+ check-uuid --fix
[hacking]
local-check-factory = tempest.hacking.checks.factory