Cleanup using about the data_utils module and functions

HACKING officially discourages symbol import directly because it makes
it harder to track down that a function was imported. Recently, we keep
this rule but there are many code that don't keep it.
 This commit cleanups them.

Change-Id: Ibda1a5e424280bad8535ee27f66dec99bf68f676
This commit is contained in:
Masayuki Igawa 2013-10-31 17:48:44 +09:00
parent 9ca1b506e4
commit 259c1137ba
91 changed files with 563 additions and 568 deletions

View File

@ -17,7 +17,7 @@
from tempest.api.compute import base
from tempest.common import tempest_fixtures as fixtures
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -47,7 +47,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type='gate')
def test_aggregate_create_delete(self):
# Create and delete an aggregate.
aggregate_name = rand_name(self.aggregate_name_prefix)
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
resp, aggregate = self.client.create_aggregate(aggregate_name)
self.assertEqual(200, resp.status)
self.assertEqual(aggregate_name, aggregate['name'])
@ -60,8 +60,8 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type='gate')
def test_aggregate_create_delete_with_az(self):
# Create and delete an aggregate.
aggregate_name = rand_name(self.aggregate_name_prefix)
az_name = rand_name(self.az_name_prefix)
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
az_name = data_utils.rand_name(self.az_name_prefix)
resp, aggregate = self.client.create_aggregate(aggregate_name, az_name)
self.assertEqual(200, resp.status)
self.assertEqual(aggregate_name, aggregate['name'])
@ -74,7 +74,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type='gate')
def test_aggregate_create_verify_entry_in_list(self):
# Create an aggregate and ensure it is listed.
aggregate_name = rand_name(self.aggregate_name_prefix)
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
resp, aggregate = self.client.create_aggregate(aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
@ -87,7 +87,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type='gate')
def test_aggregate_create_update_metadata_get_details(self):
# Create an aggregate and ensure its details are returned.
aggregate_name = rand_name(self.aggregate_name_prefix)
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
resp, aggregate = self.client.create_aggregate(aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
@ -113,8 +113,8 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
def test_aggregate_create_update_with_az(self):
# Update an aggregate and ensure properties are updated correctly
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = rand_name(self.aggregate_name_prefix)
az_name = rand_name(self.az_name_prefix)
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
az_name = data_utils.rand_name(self.az_name_prefix)
resp, aggregate = self.client.create_aggregate(aggregate_name, az_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
@ -144,7 +144,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type=['negative', 'gate'])
def test_aggregate_create_as_user(self):
# Regular user is not allowed to create an aggregate.
aggregate_name = rand_name(self.aggregate_name_prefix)
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
self.assertRaises(exceptions.Unauthorized,
self.user_client.create_aggregate,
aggregate_name)
@ -152,7 +152,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type=['negative', 'gate'])
def test_aggregate_delete_as_user(self):
# Regular user is not allowed to delete an aggregate.
aggregate_name = rand_name(self.aggregate_name_prefix)
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
resp, aggregate = self.client.create_aggregate(aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
@ -169,7 +169,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type=['negative', 'gate'])
def test_aggregate_get_details_as_user(self):
# Regular user is not allowed to get aggregate details.
aggregate_name = rand_name(self.aggregate_name_prefix)
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
resp, aggregate = self.client.create_aggregate(aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
@ -193,7 +193,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
def test_aggregate_add_remove_host(self):
# Add an host to the given aggregate and remove.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = rand_name(self.aggregate_name_prefix)
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
resp, aggregate = self.client.create_aggregate(aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
@ -215,7 +215,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
def test_aggregate_add_host_list(self):
# Add an host to the given aggregate and list.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = rand_name(self.aggregate_name_prefix)
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
resp, aggregate = self.client.create_aggregate(aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.client.add_host(aggregate['id'], self.host)
@ -233,7 +233,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
def test_aggregate_add_host_get_details(self):
# Add an host to the given aggregate and get details.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = rand_name(self.aggregate_name_prefix)
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
resp, aggregate = self.client.create_aggregate(aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.client.add_host(aggregate['id'], self.host)
@ -248,13 +248,13 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
def test_aggregate_add_host_create_server_with_az(self):
# Add an host to the given aggregate and create a server.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = rand_name(self.aggregate_name_prefix)
az_name = rand_name(self.az_name_prefix)
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
az_name = data_utils.rand_name(self.az_name_prefix)
resp, aggregate = self.client.create_aggregate(aggregate_name, az_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.client.add_host(aggregate['id'], self.host)
self.addCleanup(self.client.remove_host, aggregate['id'], self.host)
server_name = rand_name('test_server_')
server_name = data_utils.rand_name('test_server_')
admin_servers_client = self.os_adm.servers_client
resp, server = self.create_test_server(name=server_name,
availability_zone=az_name,
@ -268,11 +268,11 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
resp, hosts_all = self.os_adm.hosts_client.list_hosts()
hosts = map(lambda x: x['host_name'], hosts_all)
while True:
non_exist_host = rand_name('nonexist_host_')
non_exist_host = data_utils.rand_name('nonexist_host_')
if non_exist_host not in hosts:
break
aggregate_name = rand_name(self.aggregate_name_prefix)
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
resp, aggregate = self.client.create_aggregate(aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
@ -282,7 +282,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type=['negative', 'gate'])
def test_aggregate_add_host_as_user(self):
# Regular user is not allowed to add a host to an aggregate.
aggregate_name = rand_name(self.aggregate_name_prefix)
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
resp, aggregate = self.client.create_aggregate(aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
@ -294,7 +294,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
def test_aggregate_remove_host_as_user(self):
# Regular user is not allowed to remove a host from an aggregate.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = rand_name(self.aggregate_name_prefix)
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
resp, aggregate = self.client.create_aggregate(aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.client.add_host(aggregate['id'], self.host)

View File

@ -17,8 +17,7 @@
from tempest.api import compute
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_int_id
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest.test import skip_because
@ -58,8 +57,8 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
def test_create_flavor(self):
# Create a flavor and ensure it is listed
# This operation requires the user to have 'admin' role
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
# Create the flavor
resp, flavor = self.client.create_flavor(flavor_name,
@ -91,8 +90,8 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
def test_create_flavor_verify_entry_in_list_details(self):
# Create a flavor and ensure it's details are listed
# This operation requires the user to have 'admin' role
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
# Create the flavor
resp, flavor = self.client.create_flavor(flavor_name,
@ -116,8 +115,8 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
def test_get_flavor_details_for_deleted_flavor(self):
# Delete a flavor and ensure it is not listed
# Create a test flavor
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
resp, flavor = self.client.create_flavor(flavor_name,
self.ram,
@ -158,8 +157,8 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
self.assertEqual(int(flavor['OS-FLV-EXT-DATA:ephemeral']), 0)
self.assertEqual(flavor['os-flavor-access:is_public'], True)
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
# Create the flavor
resp, flavor = self.client.create_flavor(flavor_name,
@ -196,8 +195,8 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
# Create a flavor with os-flavor-access:is_public false should
# be present in list_details.
# This operation requires the user to have 'admin' role
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
# Create the flavor
resp, flavor = self.client.create_flavor(flavor_name,
@ -227,8 +226,8 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type='gate')
def test_create_server_with_non_public_flavor(self):
# Create a flavor with os-flavor-access:is_public false
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
# Create the flavor
resp, flavor = self.client.create_flavor(flavor_name,
@ -248,8 +247,8 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
def test_list_public_flavor_with_other_user(self):
# Create a Flavor with public access.
# Try to List/Get flavor with another user
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
# Create the flavor
resp, flavor = self.client.create_flavor(flavor_name,
@ -270,10 +269,10 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type='gate')
def test_is_public_string_variations(self):
flavor_id_not_public = rand_int_id(start=1000)
flavor_name_not_public = rand_name(self.flavor_name_prefix)
flavor_id_public = rand_int_id(start=1000)
flavor_name_public = rand_name(self.flavor_name_prefix)
flavor_id_not_public = data_utils.rand_int_id(start=1000)
flavor_name_not_public = data_utils.rand_name(self.flavor_name_prefix)
flavor_id_public = data_utils.rand_int_id(start=1000)
flavor_name_public = data_utils.rand_name(self.flavor_name_prefix)
# Create a non public flavor
resp, flavor = self.client.create_flavor(flavor_name_not_public,
@ -313,8 +312,8 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type='gate')
def test_create_flavor_using_string_ram(self):
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
ram = " 1024 "
resp, flavor = self.client.create_flavor(flavor_name,
@ -337,8 +336,8 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type=['negative', 'gate'])
def test_create_flavor_as_user(self):
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
self.assertRaises(exceptions.Unauthorized,
self.user_client.create_flavor,
@ -354,8 +353,8 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type=['negative', 'gate'])
def test_create_flavor_using_invalid_ram(self):
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
self.assertRaises(exceptions.BadRequest,
self.client.create_flavor,
@ -364,8 +363,8 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type=['negative', 'gate'])
def test_create_flavor_using_invalid_vcpus(self):
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
self.assertRaises(exceptions.BadRequest,
self.client.create_flavor,

View File

@ -17,8 +17,7 @@
from tempest.api import compute
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_int_id
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -55,8 +54,8 @@ class FlavorsAccessTestJSON(base.BaseV2ComputeAdminTest):
@attr(type='gate')
def test_flavor_access_list_with_private_flavor(self):
# Test to list flavor access successfully by querying private flavor
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
resp, new_flavor = self.client.create_flavor(flavor_name,
self.ram, self.vcpus,
self.disk,
@ -74,8 +73,8 @@ class FlavorsAccessTestJSON(base.BaseV2ComputeAdminTest):
@attr(type='gate')
def test_flavor_access_add_remove(self):
# Test to add and remove flavor access to a given tenant.
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
resp, new_flavor = self.client.create_flavor(flavor_name,
self.ram, self.vcpus,
self.disk,

View File

@ -19,8 +19,7 @@ import uuid
from tempest.api import compute
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_int_id
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -58,8 +57,8 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest):
@attr(type=['negative', 'gate'])
def test_flavor_access_list_with_public_flavor(self):
# Test to list flavor access with exceptions by querying public flavor
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
resp, new_flavor = self.client.create_flavor(flavor_name,
self.ram, self.vcpus,
self.disk,
@ -74,8 +73,8 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest):
@attr(type=['negative', 'gate'])
def test_flavor_non_admin_add(self):
# Test to add flavor access as a user without admin privileges.
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
resp, new_flavor = self.client.create_flavor(flavor_name,
self.ram, self.vcpus,
self.disk,
@ -90,8 +89,8 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest):
@attr(type=['negative', 'gate'])
def test_flavor_non_admin_remove(self):
# Test to remove flavor access as a user without admin privileges.
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
resp, new_flavor = self.client.create_flavor(flavor_name,
self.ram, self.vcpus,
self.disk,
@ -110,8 +109,8 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest):
@attr(type=['negative', 'gate'])
def test_add_flavor_access_duplicate(self):
# Create a new flavor.
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
resp, new_flavor = self.client.create_flavor(flavor_name,
self.ram, self.vcpus,
self.disk,
@ -134,8 +133,8 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest):
@attr(type=['negative', 'gate'])
def test_remove_flavor_access_not_found(self):
# Create a new flavor.
flavor_name = rand_name(self.flavor_name_prefix)
new_flavor_id = rand_int_id(start=1000)
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
resp, new_flavor = self.client.create_flavor(flavor_name,
self.ram, self.vcpus,
self.disk,

View File

@ -17,8 +17,7 @@
from tempest.api import compute
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_int_id
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -40,12 +39,12 @@ class FlavorsExtraSpecsTestJSON(base.BaseV2ComputeAdminTest):
raise cls.skipException(msg)
cls.client = cls.os_adm.flavors_client
flavor_name = rand_name('test_flavor')
flavor_name = data_utils.rand_name('test_flavor')
ram = 512
vcpus = 1
disk = 10
ephemeral = 10
cls.new_flavor_id = rand_int_id(start=1000)
cls.new_flavor_id = data_utils.rand_int_id(start=1000)
swap = 1024
rxtx = 1
# Create a flavor so as to set/get/unset extra specs

View File

@ -18,8 +18,7 @@
from tempest.api import compute
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_int_id
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -37,12 +36,12 @@ class FlavorsExtraSpecsNegativeTestJSON(base.BaseV2ComputeAdminTest):
raise cls.skipException(msg)
cls.client = cls.os_adm.flavors_client
flavor_name = rand_name('test_flavor')
flavor_name = data_utils.rand_name('test_flavor')
ram = 512
vcpus = 1
disk = 10
ephemeral = 10
cls.new_flavor_id = rand_int_id(start=1000)
cls.new_flavor_id = data_utils.rand_int_id(start=1000)
swap = 1024
rxtx = 1
# Create a flavor
@ -81,7 +80,7 @@ class FlavorsExtraSpecsNegativeTestJSON(base.BaseV2ComputeAdminTest):
@attr(type=['negative', 'gate'])
def test_flavor_unset_nonexistent_key(self):
nonexistent_key = rand_name('flavor_key')
nonexistent_key = data_utils.rand_name('flavor_key')
self.assertRaises(exceptions.NotFound,
self.client.unset_flavor_extra_spec,
self.flavor['id'],

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
from tempest.test import attr
@ -87,7 +87,7 @@ class QuotasAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type='gate')
def test_get_updated_quotas(self):
# Verify that GET shows the updated quota set
tenant_name = rand_name('cpu_quota_tenant_')
tenant_name = data_utils.rand_name('cpu_quota_tenant_')
tenant_desc = tenant_name + '-desc'
identity_client = self.os_adm.identity_client
_, tenant = identity_client.create_tenant(name=tenant_name,
@ -200,8 +200,8 @@ class QuotasAdminTestJSON(base.BaseV2ComputeAdminTest):
self.demo_tenant_id,
security_group_rules=default_sg_rules_quota)
s_name = rand_name('securitygroup-')
s_description = rand_name('description-')
s_name = data_utils.rand_name('securitygroup-')
s_description = data_utils.rand_name('description-')
resp, securitygroup =\
self.sg_client.create_security_group(s_name, s_description)
self.addCleanup(self.sg_client.delete_security_group,

View File

@ -15,8 +15,7 @@
# under the License.
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_int_id
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest.test import skip_because
@ -41,23 +40,23 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
cls.client.tenant_name)
cls.tenant_id = tenant['id']
cls.s1_name = rand_name('server')
cls.s1_name = data_utils.rand_name('server')
resp, server = cls.create_test_server(name=cls.s1_name,
wait_until='ACTIVE')
cls.s1_id = server['id']
cls.s2_name = rand_name('server')
cls.s2_name = data_utils.rand_name('server')
resp, server = cls.create_test_server(name=cls.s2_name,
wait_until='ACTIVE')
def _get_unused_flavor_id(self):
flavor_id = rand_int_id(start=1000)
flavor_id = data_utils.rand_int_id(start=1000)
while True:
try:
resp, body = self.flavors_client.get_flavor_details(flavor_id)
except exceptions.NotFound:
break
flavor_id = rand_int_id(start=1000)
flavor_id = data_utils.rand_int_id(start=1000)
return flavor_id
@attr(type='gate')
@ -90,7 +89,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type=['negative', 'gate'])
def test_resize_server_using_overlimit_ram(self):
flavor_name = rand_name("flavor-")
flavor_name = data_utils.rand_name("flavor-")
flavor_id = self._get_unused_flavor_id()
resp, quota_set = self.quotas_client.get_default_quota_set(
self.tenant_id)
@ -108,7 +107,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
@attr(type=['negative', 'gate'])
def test_resize_server_using_overlimit_vcpus(self):
flavor_name = rand_name("flavor-")
flavor_name = data_utils.rand_name("flavor-")
flavor_id = self._get_unused_flavor_id()
ram = 512
resp, quota_set = self.quotas_client.get_default_quota_set(

View File

@ -19,8 +19,7 @@ import time
from tempest.api import compute
from tempest import clients
from tempest.common.utils.data_utils import parse_image_id
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.openstack.common import log as logging
import tempest.test
@ -94,7 +93,7 @@ class BaseComputeTest(tempest.test.BaseTestCase):
@classmethod
def create_test_server(cls, **kwargs):
"""Wrapper utility that returns a test server."""
name = rand_name(cls.__name__ + "-instance")
name = data_utils.rand_name(cls.__name__ + "-instance")
if 'name' in kwargs:
name = kwargs.pop('name')
flavor = kwargs.get('flavor', cls.flavor_ref)
@ -163,13 +162,13 @@ class BaseV2ComputeTest(BaseComputeTest):
@classmethod
def create_image_from_server(cls, server_id, **kwargs):
"""Wrapper utility that returns an image created from the server."""
name = rand_name(cls.__name__ + "-image")
name = data_utils.rand_name(cls.__name__ + "-image")
if 'name' in kwargs:
name = kwargs.pop('name')
resp, image = cls.images_client.create_image(
server_id, name)
image_id = parse_image_id(resp['location'])
image_id = data_utils.parse_image_id(resp['location'])
cls.images.append(image_id)
if 'wait_until' in kwargs:
@ -236,13 +235,13 @@ class BaseV3ComputeTest(BaseComputeTest):
@classmethod
def create_image_from_server(cls, server_id, **kwargs):
"""Wrapper utility that returns an image created from the server."""
name = rand_name(cls.__name__ + "-image")
name = data_utils.rand_name(cls.__name__ + "-image")
if 'name' in kwargs:
name = kwargs.pop('name')
resp, image = cls.servers_client.create_image(
server_id, name)
image_id = parse_image_id(resp['location'])
image_id = data_utils.parse_image_id(resp['location'])
cls.images.append(image_id)
if 'wait_until' in kwargs:

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -38,7 +38,7 @@ class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
cls.server_id = server['id']
# Snapshot the server once to save time
name = rand_name('image')
name = data_utils.rand_name('image')
resp, _ = cls.client.create_image(cls.server_id, name, {})
cls.image_id = resp['location'].rsplit('/', 1)[1]

View File

@ -17,8 +17,7 @@
from tempest.api import compute
from tempest.api.compute import base
from tempest import clients
from tempest.common.utils.data_utils import parse_image_id
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -58,7 +57,7 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
def __create_image__(self, server_id, name, meta=None):
resp, body = self.client.create_image(server_id, name, meta)
image_id = parse_image_id(resp['location'])
image_id = data_utils.parse_image_id(resp['location'])
self.client.wait_for_image_status(image_id, 'ACTIVE')
self.image_ids.append(image_id)
return resp, body
@ -72,7 +71,7 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
self.servers_client.delete_server(server['id'])
self.servers_client.wait_for_server_termination(server['id'])
# Create a new image after server is deleted
name = rand_name('image')
name = data_utils.rand_name('image')
meta = {'image_type': 'test'}
self.assertRaises(exceptions.NotFound,
self.__create_image__,
@ -82,7 +81,7 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
def test_create_image_from_invalid_server(self):
# An image should not be created with invalid server id
# Create a new image with invalid server id
name = rand_name('image')
name = data_utils.rand_name('image')
meta = {'image_type': 'test'}
resp = {}
resp['status'] = None
@ -96,7 +95,7 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
self.servers_client.wait_for_server_status(server['id'],
'SHUTOFF')
self.addCleanup(self.servers_client.delete_server, server['id'])
snapshot_name = rand_name('test-snap-')
snapshot_name = data_utils.rand_name('test-snap-')
resp, image = self.create_image_from_server(server['id'],
name=snapshot_name,
wait_until='ACTIVE')
@ -105,7 +104,7 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
@attr(type='gate')
def test_delete_saving_image(self):
snapshot_name = rand_name('test-snap-')
snapshot_name = data_utils.rand_name('test-snap-')
resp, server = self.create_test_server(wait_until='ACTIVE')
self.addCleanup(self.servers_client.delete_server, server['id'])
resp, image = self.create_image_from_server(server['id'],
@ -117,7 +116,7 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
@attr(type=['negative', 'gate'])
def test_create_image_specify_uuid_35_characters_or_less(self):
# Return an error if Image ID passed is 35 characters or less
snapshot_name = rand_name('test-snap-')
snapshot_name = data_utils.rand_name('test-snap-')
test_uuid = ('a' * 35)
self.assertRaises(exceptions.NotFound, self.client.create_image,
test_uuid, snapshot_name)
@ -125,7 +124,7 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
@attr(type=['negative', 'gate'])
def test_create_image_specify_uuid_37_characters_or_more(self):
# Return an error if Image ID passed is 37 characters or more
snapshot_name = rand_name('test-snap-')
snapshot_name = data_utils.rand_name('test-snap-')
test_uuid = ('a' * 37)
self.assertRaises(exceptions.NotFound, self.client.create_image,
test_uuid, snapshot_name)

View File

@ -20,8 +20,7 @@ import testtools
from tempest.api import compute
from tempest.api.compute import base
from tempest import clients
from tempest.common.utils.data_utils import parse_image_id
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.openstack.common import log as logging
from tempest.test import attr
@ -91,11 +90,11 @@ class ImagesOneServerTestJSON(base.BaseV2ComputeTest):
def test_create_delete_image(self):
# Create a new image
name = rand_name('image')
name = data_utils.rand_name('image')
meta = {'image_type': 'test'}
resp, body = self.client.create_image(self.server_id, name, meta)
self.assertEqual(202, resp.status)
image_id = parse_image_id(resp['location'])
image_id = data_utils.parse_image_id(resp['location'])
self.client.wait_for_image_status(image_id, 'ACTIVE')
# Verify the image was created correctly

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.compute import base
from tempest.common.utils.data_utils import parse_image_id
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.test import attr
@ -46,7 +46,7 @@ class ListImageFiltersTestJSON(base.BaseV2ComputeTest):
# Create images to be used in the filter tests
resp, body = cls.create_image_from_server(cls.server1['id'])
cls.image1_id = parse_image_id(resp['location'])
cls.image1_id = data_utils.parse_image_id(resp['location'])
cls.client.wait_for_image_status(cls.image1_id, 'ACTIVE')
resp, cls.image1 = cls.client.get_image(cls.image1_id)
@ -54,12 +54,12 @@ class ListImageFiltersTestJSON(base.BaseV2ComputeTest):
# Performing back-to-back create image calls on a single
# server will sometimes cause failures
resp, body = cls.create_image_from_server(cls.server2['id'])
cls.image3_id = parse_image_id(resp['location'])
cls.image3_id = data_utils.parse_image_id(resp['location'])
cls.client.wait_for_image_status(cls.image3_id, 'ACTIVE')
resp, cls.image3 = cls.client.get_image(cls.image3_id)
resp, body = cls.create_image_from_server(cls.server1['id'])
cls.image2_id = parse_image_id(resp['location'])
cls.image2_id = data_utils.parse_image_id(resp['location'])
cls.client.wait_for_image_status(cls.image2_id, 'ACTIVE')
resp, cls.image2 = cls.client.get_image(cls.image2_id)

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -35,7 +35,7 @@ class KeyPairsTestJSON(base.BaseV2ComputeTest):
# Create 3 keypairs
key_list = list()
for i in range(3):
k_name = rand_name('keypair-')
k_name = data_utils.rand_name('keypair-')
resp, keypair = self.client.create_keypair(k_name)
# Need to pop these keys so that our compare doesn't fail later,
# as the keypair dicts from list API doesn't have them.
@ -66,7 +66,7 @@ class KeyPairsTestJSON(base.BaseV2ComputeTest):
@attr(type='gate')
def test_keypair_create_delete(self):
# Keypair should be created, verified and deleted
k_name = rand_name('keypair-')
k_name = data_utils.rand_name('keypair-')
resp, keypair = self.client.create_keypair(k_name)
self.assertEqual(200, resp.status)
private_key = keypair['private_key']
@ -82,7 +82,7 @@ class KeyPairsTestJSON(base.BaseV2ComputeTest):
@attr(type='gate')
def test_get_keypair_detail(self):
# Keypair should be created, Got details by name and deleted
k_name = rand_name('keypair-')
k_name = data_utils.rand_name('keypair-')
resp, keypair = self.client.create_keypair(k_name)
self.addCleanup(self.client.delete_keypair, k_name)
resp, keypair_detail = self.client.get_keypair(k_name)
@ -99,7 +99,7 @@ class KeyPairsTestJSON(base.BaseV2ComputeTest):
@attr(type='gate')
def test_keypair_create_with_pub_key(self):
# Keypair should be created with a given public key
k_name = rand_name('keypair-')
k_name = data_utils.rand_name('keypair-')
pub_key = ("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs"
"Ne3/1ILNCqFyfYWDeTKLD6jEXC2OQHLmietMWW+/vd"
"aZq7KZEwO0jhglaFjU1mpqq4Gz5RX156sCTNM9vRbw"
@ -123,7 +123,7 @@ class KeyPairsTestJSON(base.BaseV2ComputeTest):
@attr(type=['negative', 'gate'])
def test_keypair_create_with_invalid_pub_key(self):
# Keypair should not be created with a non RSA public key
k_name = rand_name('keypair-')
k_name = data_utils.rand_name('keypair-')
pub_key = "ssh-rsa JUNK nova@ubuntu"
self.assertRaises(exceptions.BadRequest,
self.client.create_keypair, k_name, pub_key)
@ -131,14 +131,14 @@ class KeyPairsTestJSON(base.BaseV2ComputeTest):
@attr(type=['negative', 'gate'])
def test_keypair_delete_nonexistant_key(self):
# Non-existant key deletion should throw a proper error
k_name = rand_name("keypair-non-existant-")
k_name = data_utils.rand_name("keypair-non-existant-")
self.assertRaises(exceptions.NotFound, self.client.delete_keypair,
k_name)
@attr(type=['negative', 'gate'])
def test_create_keypair_with_empty_public_key(self):
# Keypair should not be created with an empty public key
k_name = rand_name("keypair-")
k_name = data_utils.rand_name("keypair-")
pub_key = ' '
self.assertRaises(exceptions.BadRequest, self.client.create_keypair,
k_name, pub_key)
@ -146,7 +146,7 @@ class KeyPairsTestJSON(base.BaseV2ComputeTest):
@attr(type=['negative', 'gate'])
def test_create_keypair_when_public_key_bits_exceeds_maximum(self):
# Keypair should not be created when public key bits are too long
k_name = rand_name("keypair-")
k_name = data_utils.rand_name("keypair-")
pub_key = 'ssh-rsa ' + 'A' * 2048 + ' openstack@ubuntu'
self.assertRaises(exceptions.BadRequest, self.client.create_keypair,
k_name, pub_key)
@ -154,7 +154,7 @@ class KeyPairsTestJSON(base.BaseV2ComputeTest):
@attr(type=['negative', 'gate'])
def test_create_keypair_with_duplicate_name(self):
# Keypairs with duplicate names should not be created
k_name = rand_name('keypair-')
k_name = data_utils.rand_name('keypair-')
resp, _ = self.client.create_keypair(k_name)
self.assertEqual(200, resp.status)
# Now try the same keyname to create another key

View File

@ -22,7 +22,7 @@ import testtools
from tempest.api import compute
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.common.utils.linux.remote_client import RemoteClient
import tempest.config
from tempest.test import attr
@ -39,7 +39,7 @@ class ServersTestJSON(base.BaseV2ComputeTest):
cls.meta = {'hello': 'world'}
cls.accessIPv4 = '1.1.1.1'
cls.accessIPv6 = '0000:0000:0000:0000:0000:babe:220.12.22.2'
cls.name = rand_name('server')
cls.name = data_utils.rand_name('server')
file_contents = 'This is a test file.'
personality = [{'path': '/test.txt',
'contents': base64.b64encode(file_contents)}]

View File

@ -17,7 +17,7 @@
from tempest.api.compute import base
from tempest.api import utils
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
from tempest.test import attr
@ -57,16 +57,16 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
raise RuntimeError("Image %s (image_ref_alt) was not found!" %
cls.image_ref_alt)
cls.s1_name = rand_name(cls.__name__ + '-instance')
cls.s1_name = data_utils.rand_name(cls.__name__ + '-instance')
resp, cls.s1 = cls.create_test_server(name=cls.s1_name,
wait_until='ACTIVE')
cls.s2_name = rand_name(cls.__name__ + '-instance')
cls.s2_name = data_utils.rand_name(cls.__name__ + '-instance')
resp, cls.s2 = cls.create_test_server(name=cls.s2_name,
image_id=cls.image_ref_alt,
wait_until='ACTIVE')
cls.s3_name = rand_name(cls.__name__ + '-instance')
cls.s3_name = data_utils.rand_name(cls.__name__ + '-instance')
resp, cls.s3 = cls.create_test_server(name=cls.s3_name,
flavor=cls.flavor_ref_alt,
wait_until='ACTIVE')

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -26,7 +26,7 @@ class MultipleCreateTestJSON(base.BaseV2ComputeTest):
_name = 'multiple-create-test'
def _generate_name(self):
return rand_name(self._name)
return data_utils.rand_name(self._name)
def _create_multiple_servers(self, name=None, wait_until=None, **kwargs):
"""

View File

@ -22,8 +22,7 @@ import testtools
from tempest.api import compute
from tempest.api.compute import base
from tempest.common.utils.data_utils import parse_image_id
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.common.utils.linux.remote_client import RemoteClient
import tempest.config
from tempest import exceptions
@ -113,7 +112,7 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest):
def test_rebuild_server(self):
# The server should be rebuilt using the provided image and data
meta = {'rebuild': 'server'}
new_name = rand_name('server')
new_name = data_utils.rand_name('server')
file_contents = 'Test server rebuild.'
personality = [{'path': 'rebuild.txt',
'contents': base64.b64encode(file_contents)}]
@ -204,7 +203,7 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest):
def test_create_backup(self):
# Positive test:create backup successfully and rotate backups correctly
# create the first and the second backup
backup1 = rand_name('backup')
backup1 = data_utils.rand_name('backup')
resp, _ = self.servers_client.create_backup(self.server_id,
'daily',
2,
@ -216,17 +215,17 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest):
if oldest_backup_exist:
self.os.image_client.delete_image(oldest_backup)
image1_id = parse_image_id(resp['location'])
image1_id = data_utils.parse_image_id(resp['location'])
self.addCleanup(_clean_oldest_backup, image1_id)
self.assertEqual(202, resp.status)
backup2 = rand_name('backup')
backup2 = data_utils.rand_name('backup')
self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
resp, _ = self.servers_client.create_backup(self.server_id,
'daily',
2,
backup2)
image2_id = parse_image_id(resp['location'])
image2_id = data_utils.parse_image_id(resp['location'])
self.addCleanup(self.os.image_client.delete_image, image2_id)
self.assertEqual(202, resp.status)
@ -247,13 +246,13 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest):
# create the third one, due to the rotation is 2,
# the first one will be deleted
backup3 = rand_name('backup')
backup3 = data_utils.rand_name('backup')
self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
resp, _ = self.servers_client.create_backup(self.server_id,
'daily',
2,
backup3)
image3_id = parse_image_id(resp['location'])
image3_id = data_utils.parse_image_id(resp['location'])
self.addCleanup(self.os.image_client.delete_image, image3_id)
self.assertEqual(202, resp.status)
# the first back up should be deleted

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -35,8 +35,8 @@ class ServerRescueTestJSON(base.BaseV2ComputeTest):
cls.floating_ip = str(body['ip']).strip()
# Security group creation
cls.sg_name = rand_name('sg')
cls.sg_desc = rand_name('sg-desc')
cls.sg_name = data_utils.rand_name('sg')
cls.sg_desc = data_utils.rand_name('sg-desc')
resp, cls.sg = \
cls.security_groups_client.create_security_group(cls.sg_name,
cls.sg_desc)

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -46,7 +46,7 @@ class ServersTestJSON(base.BaseV2ComputeTest):
# Creating a server with a name that already exists is allowed
# TODO(sdague): clear out try, we do cleanup one layer up
server_name = rand_name('server')
server_name = data_utils.rand_name('server')
resp, server = self.create_test_server(name=server_name,
wait_until='ACTIVE')
id1 = server['id']
@ -64,7 +64,7 @@ class ServersTestJSON(base.BaseV2ComputeTest):
def test_create_specify_keypair(self):
# Specify a keypair while creating a server
key_name = rand_name('key')
key_name = data_utils.rand_name('key')
resp, keypair = self.keypairs_client.create_keypair(key_name)
resp, body = self.keypairs_client.list_keypairs()
resp, server = self.create_test_server(key_name=key_name)

View File

@ -21,7 +21,7 @@ import uuid
from tempest.api.compute import base
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -155,7 +155,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
# Rebuild a non existent server
nonexistent_server = str(uuid.uuid4())
meta = {'rebuild': 'server'}
new_name = rand_name('server')
new_name = data_utils.rand_name('server')
file_contents = 'Test server rebuild.'
personality = [{'path': '/etc/rebuild.txt',
'contents': base64.b64encode(file_contents)}]
@ -201,7 +201,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
def test_create_with_non_existant_keypair(self):
# Pass a non-existent keypair while creating a server
key_name = rand_name('key')
key_name = data_utils.rand_name('key')
self.assertRaises(exceptions.BadRequest,
self.create_test_server,
key_name=key_name)
@ -219,8 +219,8 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
def test_update_name_of_non_existent_server(self):
# Update name of a non-existent server
server_name = rand_name('server')
new_name = rand_name('server') + '_updated'
server_name = data_utils.rand_name('server')
new_name = data_utils.rand_name('server') + '_updated'
self.assertRaises(exceptions.NotFound, self.client.update_server,
server_name, name=new_name)
@ -229,7 +229,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
def test_update_server_set_empty_name(self):
# Update name of the server to an empty string
server_name = rand_name('server')
server_name = data_utils.rand_name('server')
new_name = ''
self.assertRaises(exceptions.BadRequest, self.client.update_server,

View File

@ -18,7 +18,7 @@
import netaddr
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
from tempest.test import attr
@ -58,7 +58,7 @@ class VirtualInterfacesTestJSON(base.BaseV2ComputeTest):
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 = rand_name('!@#$%^&*()')
invalid_server_id = data_utils.rand_name('!@#$%^&*()')
self.assertRaises(exceptions.NotFound,
self.client.list_virtual_interfaces,
invalid_server_id)

View File

@ -18,8 +18,7 @@
from tempest.api import compute
from tempest.api.compute import base
from tempest import clients
from tempest.common.utils.data_utils import parse_image_id
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.test import attr
@ -62,18 +61,18 @@ class AuthorizationTestJSON(base.BaseV2ComputeTest):
resp, server = cls.create_test_server(wait_until='ACTIVE')
resp, cls.server = cls.client.get_server(server['id'])
name = rand_name('image')
name = data_utils.rand_name('image')
resp, body = cls.client.create_image(server['id'], name)
image_id = parse_image_id(resp['location'])
image_id = data_utils.parse_image_id(resp['location'])
cls.images_client.wait_for_image_status(image_id, 'ACTIVE')
resp, cls.image = cls.images_client.get_image(image_id)
cls.keypairname = rand_name('keypair')
cls.keypairname = data_utils.rand_name('keypair')
resp, keypair = \
cls.keypairs_client.create_keypair(cls.keypairname)
name = rand_name('security')
description = rand_name('description')
name = data_utils.rand_name('security')
description = data_utils.rand_name('description')
resp, cls.security_group = cls.security_client.create_security_group(
name, description)
@ -191,7 +190,7 @@ class AuthorizationTestJSON(base.BaseV2ComputeTest):
# A create keypair request should fail if the tenant id does not match
# the current user
# POST keypair with other user tenant
k_name = rand_name('keypair-')
k_name = data_utils.rand_name('keypair-')
self.alt_keypairs_client._set_auth()
self.saved_base_url = self.alt_keypairs_client.base_url
try:
@ -241,8 +240,8 @@ class AuthorizationTestJSON(base.BaseV2ComputeTest):
# A create security group request should fail if the tenant id does not
# match the current user
# POST security group with other user tenant
s_name = rand_name('security-')
s_description = rand_name('security')
s_name = data_utils.rand_name('security-')
s_description = data_utils.rand_name('security')
self.saved_base_url = self.alt_security_client.base_url
try:
# Change the base URL to impersonate another user

View File

@ -17,8 +17,7 @@
from tempest.api import compute
from tempest.api.compute import base
from tempest import clients
from tempest.common.utils.data_utils import parse_image_id
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -49,7 +48,7 @@ class ImagesV3TestJSON(base.BaseV3ComputeTest):
def __create_image__(self, server_id, name, meta=None):
resp, body = self.servers_client.create_image(server_id, name, meta)
image_id = parse_image_id(resp['location'])
image_id = data_utils.parse_image_id(resp['location'])
self.addCleanup(self.client.delete_image, image_id)
self.client.wait_for_image_status(image_id, 'ACTIVE')
return resp, body
@ -63,7 +62,7 @@ class ImagesV3TestJSON(base.BaseV3ComputeTest):
self.servers_client.delete_server(server['id'])
self.servers_client.wait_for_server_termination(server['id'])
# Create a new image after server is deleted
name = rand_name('image')
name = data_utils.rand_name('image')
meta = {'image_type': 'test'}
self.assertRaises(exceptions.NotFound,
self.__create_image__,
@ -73,7 +72,7 @@ class ImagesV3TestJSON(base.BaseV3ComputeTest):
def test_create_image_from_invalid_server(self):
# An image should not be created with invalid server id
# Create a new image with invalid server id
name = rand_name('image')
name = data_utils.rand_name('image')
meta = {'image_type': 'test'}
resp = {}
resp['status'] = None
@ -87,7 +86,7 @@ class ImagesV3TestJSON(base.BaseV3ComputeTest):
self.servers_client.wait_for_server_status(server['id'],
'SHUTOFF')
self.addCleanup(self.servers_client.delete_server, server['id'])
snapshot_name = rand_name('test-snap-')
snapshot_name = data_utils.rand_name('test-snap-')
resp, image = self.create_image_from_server(server['id'],
name=snapshot_name,
wait_until='active')
@ -96,7 +95,7 @@ class ImagesV3TestJSON(base.BaseV3ComputeTest):
@attr(type='gate')
def test_delete_queued_image(self):
snapshot_name = rand_name('test-snap-')
snapshot_name = data_utils.rand_name('test-snap-')
resp, server = self.create_test_server(wait_until='ACTIVE')
self.addCleanup(self.servers_client.delete_server, server['id'])
resp, image = self.create_image_from_server(server['id'],
@ -108,7 +107,7 @@ class ImagesV3TestJSON(base.BaseV3ComputeTest):
@attr(type=['negative', 'gate'])
def test_create_image_specify_uuid_35_characters_or_less(self):
# Return an error if Image ID passed is 35 characters or less
snapshot_name = rand_name('test-snap-')
snapshot_name = data_utils.rand_name('test-snap-')
test_uuid = ('a' * 35)
self.assertRaises(exceptions.NotFound,
self.servers_client.create_image,
@ -117,7 +116,7 @@ class ImagesV3TestJSON(base.BaseV3ComputeTest):
@attr(type=['negative', 'gate'])
def test_create_image_specify_uuid_37_characters_or_more(self):
# Return an error if Image ID passed is 37 characters or more
snapshot_name = rand_name('test-snap-')
snapshot_name = data_utils.rand_name('test-snap-')
test_uuid = ('a' * 37)
self.assertRaises(exceptions.NotFound,
self.servers_client.create_image,

View File

@ -22,7 +22,7 @@ import testtools
from tempest.api import compute
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.common.utils.linux.remote_client import RemoteClient
import tempest.config
from tempest import exceptions
@ -112,7 +112,7 @@ class ServerActionsV3TestJSON(base.BaseV3ComputeTest):
def test_rebuild_server(self):
# The server should be rebuilt using the provided image and data
meta = {'rebuild': 'server'}
new_name = rand_name('server')
new_name = data_utils.rand_name('server')
file_contents = 'Test server rebuild.'
personality = [{'path': 'rebuild.txt',
'contents': base64.b64encode(file_contents)}]

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -36,7 +36,7 @@ class VolumesGetTestJSON(base.BaseV2ComputeTest):
def test_volume_create_get_delete(self):
# CREATE, GET, DELETE Volume
volume = None
v_name = rand_name('Volume-%s-') % self._interface
v_name = data_utils.rand_name('Volume-%s-') % self._interface
metadata = {'Type': 'work'}
# Create volume
resp, volume = self.client.create_volume(size=1,
@ -73,7 +73,7 @@ class VolumesGetTestJSON(base.BaseV2ComputeTest):
@attr(type='gate')
def test_volume_get_metadata_none(self):
# CREATE, GET empty metadata dict
v_name = rand_name('Volume-')
v_name = data_utils.rand_name('Volume-')
# Create volume
resp, volume = self.client.create_volume(size=1,
display_name=v_name,

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -43,7 +43,7 @@ class VolumesTestJSON(base.BaseV2ComputeTest):
cls.volume_list = []
cls.volume_id_list = []
for i in range(3):
v_name = rand_name('volume-%s')
v_name = data_utils.rand_name('volume-%s')
metadata = {'Type': 'work'}
v_name += cls._interface
try:

View File

@ -17,7 +17,7 @@
from tempest.api.identity import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -30,9 +30,9 @@ class ServicesTestJSON(base.BaseIdentityAdminTest):
# GET Service
try:
# Creating a Service
name = rand_name('service-')
type = rand_name('type--')
description = rand_name('description-')
name = data_utils.rand_name('service-')
type = data_utils.rand_name('type--')
description = data_utils.rand_name('description-')
resp, service_data = self.client.create_service(
name, type, description=description)
self.assertTrue(resp['status'].startswith('2'))
@ -72,9 +72,9 @@ class ServicesTestJSON(base.BaseIdentityAdminTest):
# Create, List, Verify and Delete Services
services = []
for _ in xrange(3):
name = rand_name('service-')
type = rand_name('type--')
description = rand_name('description-')
name = data_utils.rand_name('service-')
type = data_utils.rand_name('type--')
description = data_utils.rand_name('description-')
resp, service = self.client.create_service(
name, type, description=description)
services.append(service)

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.identity import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
import uuid
@ -28,8 +28,8 @@ class UsersNegativeTestJSON(base.BaseIdentityAdminTest):
@classmethod
def setUpClass(cls):
super(UsersNegativeTestJSON, cls).setUpClass()
cls.alt_user = rand_name('test_user_')
cls.alt_password = rand_name('pass_')
cls.alt_user = data_utils.rand_name('test_user_')
cls.alt_password = data_utils.rand_name('pass_')
cls.alt_email = cls.alt_user + '@testmail.tm'
@attr(type=['negative', 'gate'])
@ -91,7 +91,7 @@ class UsersNegativeTestJSON(base.BaseIdentityAdminTest):
def test_create_user_with_enabled_non_bool(self):
# Attempt to create a user with valid enabled para should fail
self.data.setup_test_tenant()
name = rand_name('test_user_')
name = data_utils.rand_name('test_user_')
self.assertRaises(exceptions.BadRequest, self.client.create_user,
name, self.alt_password,
self.data.tenant['id'],
@ -100,7 +100,7 @@ class UsersNegativeTestJSON(base.BaseIdentityAdminTest):
@attr(type=['negative', 'gate'])
def test_update_user_for_non_existant_user(self):
# Attempt to update a user non-existent user should fail
user_name = rand_name('user-')
user_name = data_utils.rand_name('user-')
non_existent_id = str(uuid.uuid4())
self.assertRaises(exceptions.NotFound, self.client.update_user,
non_existent_id, name=user_name)
@ -220,9 +220,9 @@ class UsersNegativeTestJSON(base.BaseIdentityAdminTest):
# users for a non-existent tenant
# Assign invalid tenant ids
invalid_id = list()
invalid_id.append(rand_name('999'))
invalid_id.append(data_utils.rand_name('999'))
invalid_id.append('alpha')
invalid_id.append(rand_name("dddd@#%%^$"))
invalid_id.append(data_utils.rand_name("dddd@#%%^$"))
invalid_id.append('!@#()$%^&*?<>{}[]')
# List the users with invalid tenant id
for invalid in invalid_id:

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.identity import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -29,13 +29,14 @@ class CredentialsTestJSON(base.BaseIdentityAdminTest):
cls.projects = list()
cls.creds_list = [['project_id', 'user_id', 'id'],
['access', 'secret']]
u_name = rand_name('user-')
u_name = data_utils.rand_name('user-')
u_desc = '%s description' % u_name
u_email = '%s@testmail.tm' % u_name
u_password = rand_name('pass-')
u_password = data_utils.rand_name('pass-')
for i in range(2):
resp, cls.project = cls.v3_client.create_project(
rand_name('project-'), description=rand_name('project-desc-'))
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'))
assert resp['status'] == '201', "Expected %s" % resp['status']
cls.projects.append(cls.project['id'])
@ -59,7 +60,8 @@ class CredentialsTestJSON(base.BaseIdentityAdminTest):
@attr(type='smoke')
def test_credentials_create_get_update_delete(self):
keys = [rand_name('Access-'), rand_name('Secret-')]
keys = [data_utils.rand_name('Access-'),
data_utils.rand_name('Secret-')]
resp, cred = self.creds_client.create_credential(
keys[0], keys[1], self.user_body['id'],
self.projects[0])
@ -70,7 +72,8 @@ class CredentialsTestJSON(base.BaseIdentityAdminTest):
for value2 in self.creds_list[1]:
self.assertIn(value2, cred['blob'])
new_keys = [rand_name('NewAccess-'), rand_name('NewSecret-')]
new_keys = [data_utils.rand_name('NewAccess-'),
data_utils.rand_name('NewSecret-')]
resp, update_body = self.creds_client.update_credential(
cred['id'], access_key=new_keys[0], secret_key=new_keys[1],
project_id=self.projects[1])
@ -97,7 +100,8 @@ class CredentialsTestJSON(base.BaseIdentityAdminTest):
for i in range(2):
resp, cred = self.creds_client.create_credential(
rand_name('Access-'), rand_name('Secret-'),
data_utils.rand_name('Access-'),
data_utils.rand_name('Secret-'),
self.user_body['id'], self.projects[0])
self.assertEqual(resp['status'], '201')
created_cred_ids.append(cred['id'])

View File

@ -17,7 +17,7 @@
from tempest.api.identity import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -38,7 +38,8 @@ class DomainsTestJSON(base.BaseIdentityAdminTest):
fetched_ids = list()
for _ in range(3):
_, domain = self.v3_client.create_domain(
rand_name('domain-'), description=rand_name('domain-desc-'))
data_utils.rand_name('domain-'),
description=data_utils.rand_name('domain-desc-'))
# Delete the domain at the end of this method
self.addCleanup(self._delete_domain, domain['id'])
domain_ids.append(domain['id'])
@ -52,8 +53,8 @@ class DomainsTestJSON(base.BaseIdentityAdminTest):
@attr(type='smoke')
def test_create_update_delete_domain(self):
d_name = rand_name('domain-')
d_desc = rand_name('domain-desc-')
d_name = data_utils.rand_name('domain-')
d_desc = data_utils.rand_name('domain-desc-')
resp_1, domain = self.v3_client.create_domain(
d_name, description=d_desc)
self.assertEqual(resp_1['status'], '201')
@ -70,8 +71,8 @@ class DomainsTestJSON(base.BaseIdentityAdminTest):
self.assertEqual(True, domain['enabled'])
else:
self.assertEqual('true', str(domain['enabled']).lower())
new_desc = rand_name('new-desc-')
new_name = rand_name('new-name-')
new_desc = data_utils.rand_name('new-desc-')
new_name = data_utils.rand_name('new-name-')
resp_2, updated_domain = self.v3_client.update_domain(
domain['id'], name=new_name, description=new_desc)

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.identity import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -29,9 +29,9 @@ class EndPointsTestJSON(base.BaseIdentityAdminTest):
cls.identity_client = cls.client
cls.client = cls.endpoints_client
cls.service_ids = list()
s_name = rand_name('service-')
s_type = rand_name('type--')
s_description = rand_name('description-')
s_name = data_utils.rand_name('service-')
s_type = data_utils.rand_name('type--')
s_description = data_utils.rand_name('description-')
resp, cls.service_data =\
cls.identity_client.create_service(s_name, s_type,
description=s_description)
@ -40,8 +40,8 @@ class EndPointsTestJSON(base.BaseIdentityAdminTest):
# Create endpoints so as to use for LIST and GET test cases
cls.setup_endpoints = list()
for i in range(2):
region = rand_name('region')
url = rand_name('url')
region = data_utils.rand_name('region')
url = data_utils.rand_name('url')
interface = 'public'
resp, endpoint = cls.client.create_endpoint(
cls.service_id, interface, url, region=region, enabled=True)
@ -69,8 +69,8 @@ class EndPointsTestJSON(base.BaseIdentityAdminTest):
@attr(type='gate')
def test_create_list_delete_endpoint(self):
region = rand_name('region')
url = rand_name('url')
region = data_utils.rand_name('region')
url = data_utils.rand_name('url')
interface = 'public'
resp, endpoint =\
self.client.create_endpoint(self.service_id, interface, url,
@ -97,24 +97,24 @@ class EndPointsTestJSON(base.BaseIdentityAdminTest):
def test_update_endpoint(self):
# Creating an endpoint so as to check update endpoint
# with new values
region1 = rand_name('region')
url1 = rand_name('url')
region1 = data_utils.rand_name('region')
url1 = data_utils.rand_name('url')
interface1 = 'public'
resp, endpoint_for_update =\
self.client.create_endpoint(self.service_id, interface1,
url1, region=region1,
enabled=True)
# Creating service so as update endpoint with new service ID
s_name = rand_name('service-')
s_type = rand_name('type--')
s_description = rand_name('description-')
s_name = data_utils.rand_name('service-')
s_type = data_utils.rand_name('type--')
s_description = data_utils.rand_name('description-')
resp, self.service2 =\
self.identity_client.create_service(s_name, s_type,
description=s_description)
self.service_ids.append(self.service2['id'])
# Updating endpoint with new values
region2 = rand_name('region')
url2 = rand_name('url')
region2 = data_utils.rand_name('region')
url2 = data_utils.rand_name('url')
interface2 = 'internal'
resp, endpoint = \
self.client.update_endpoint(endpoint_for_update['id'],

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.identity import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -33,8 +33,8 @@ class PoliciesTestJSON(base.BaseIdentityAdminTest):
policy_ids = list()
fetched_ids = list()
for _ in range(3):
blob = rand_name('BlobName-')
policy_type = rand_name('PolicyType-')
blob = data_utils.rand_name('BlobName-')
policy_type = data_utils.rand_name('PolicyType-')
resp, policy = self.policy_client.create_policy(blob,
policy_type)
# Delete the Policy at the end of this method
@ -51,8 +51,8 @@ class PoliciesTestJSON(base.BaseIdentityAdminTest):
@attr(type='smoke')
def test_create_update_delete_policy(self):
# Test to update policy
blob = rand_name('BlobName-')
policy_type = rand_name('PolicyType-')
blob = data_utils.rand_name('BlobName-')
policy_type = data_utils.rand_name('PolicyType-')
resp, policy = self.policy_client.create_policy(blob, policy_type)
self.addCleanup(self._delete_policy, policy['id'])
self.assertIn('id', policy)
@ -64,7 +64,7 @@ class PoliciesTestJSON(base.BaseIdentityAdminTest):
resp, fetched_policy = self.policy_client.get_policy(policy['id'])
self.assertEqual(resp['status'], '200')
# Update policy
update_type = rand_name('UpdatedPolicyType-')
update_type = data_utils.rand_name('UpdatedPolicyType-')
resp, data = self.policy_client.update_policy(
policy['id'], type=update_type)
self.assertIn('type', data)

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.identity import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -35,7 +35,7 @@ class ProjectsTestJSON(base.BaseIdentityAdminTest):
# Create several projects and delete them
for _ in xrange(3):
resp, project = self.v3_client.create_project(
rand_name('project-new'))
data_utils.rand_name('project-new'))
self.addCleanup(self._delete_project, project['id'])
resp, list_projects = self.v3_client.list_projects()
@ -47,8 +47,8 @@ class ProjectsTestJSON(base.BaseIdentityAdminTest):
@attr(type='gate')
def test_project_create_with_description(self):
# Create project with a description
project_name = rand_name('project-')
project_desc = rand_name('desc-')
project_name = data_utils.rand_name('project-')
project_desc = data_utils.rand_name('desc-')
resp, project = self.v3_client.create_project(
project_name, description=project_desc)
self.v3data.projects.append(project)
@ -66,7 +66,7 @@ class ProjectsTestJSON(base.BaseIdentityAdminTest):
@attr(type='gate')
def test_project_create_enabled(self):
# Create a project that is enabled
project_name = rand_name('project-')
project_name = data_utils.rand_name('project-')
resp, project = self.v3_client.create_project(
project_name, enabled=True)
self.v3data.projects.append(project)
@ -82,7 +82,7 @@ class ProjectsTestJSON(base.BaseIdentityAdminTest):
@attr(type='gate')
def test_project_create_not_enabled(self):
# Create a project that is not enabled
project_name = rand_name('project-')
project_name = data_utils.rand_name('project-')
resp, project = self.v3_client.create_project(
project_name, enabled=False)
self.v3data.projects.append(project)
@ -99,13 +99,13 @@ class ProjectsTestJSON(base.BaseIdentityAdminTest):
@attr(type='gate')
def test_project_update_name(self):
# Update name attribute of a project
p_name1 = rand_name('project-')
p_name1 = data_utils.rand_name('project-')
resp, project = self.v3_client.create_project(p_name1)
self.v3data.projects.append(project)
resp1_name = project['name']
p_name2 = rand_name('project2-')
p_name2 = data_utils.rand_name('project2-')
resp, body = self.v3_client.update_project(project['id'], name=p_name2)
st2 = resp['status']
resp2_name = body['name']
@ -122,14 +122,14 @@ class ProjectsTestJSON(base.BaseIdentityAdminTest):
@attr(type='gate')
def test_project_update_desc(self):
# Update description attribute of a project
p_name = rand_name('project-')
p_desc = rand_name('desc-')
p_name = data_utils.rand_name('project-')
p_desc = data_utils.rand_name('desc-')
resp, project = self.v3_client.create_project(
p_name, description=p_desc)
self.v3data.projects.append(project)
resp1_desc = project['description']
p_desc2 = rand_name('desc2-')
p_desc2 = data_utils.rand_name('desc2-')
resp, body = self.v3_client.update_project(
project['id'], description=p_desc2)
st2 = resp['status']
@ -147,7 +147,7 @@ class ProjectsTestJSON(base.BaseIdentityAdminTest):
@attr(type='gate')
def test_project_update_enable(self):
# Update the enabled attribute of a project
p_name = rand_name('project-')
p_name = data_utils.rand_name('project-')
p_en = False
resp, project = self.v3_client.create_project(p_name, enabled=p_en)
self.v3data.projects.append(project)
@ -173,15 +173,15 @@ class ProjectsTestJSON(base.BaseIdentityAdminTest):
def test_associate_user_to_project(self):
#Associate a user to a project
#Create a Project
p_name = rand_name('project-')
p_name = data_utils.rand_name('project-')
resp, project = self.v3_client.create_project(p_name)
self.v3data.projects.append(project)
#Create a User
u_name = rand_name('user-')
u_name = data_utils.rand_name('user-')
u_desc = u_name + 'description'
u_email = u_name + '@testmail.tm'
u_password = rand_name('pass-')
u_password = data_utils.rand_name('pass-')
resp, user = self.v3_client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email, project_id=project['id'])
@ -207,7 +207,7 @@ class ProjectsTestJSON(base.BaseIdentityAdminTest):
@attr(type=['negative', 'gate'])
def test_project_create_duplicate(self):
# Project names should be unique
project_name = rand_name('project-dup-')
project_name = data_utils.rand_name('project-dup-')
resp, project = self.v3_client.create_project(project_name)
self.v3data.projects.append(project)
@ -217,7 +217,7 @@ class ProjectsTestJSON(base.BaseIdentityAdminTest):
@attr(type=['negative', 'gate'])
def test_create_project_by_unauthorized_user(self):
# Non-admin user should not be authorized to create a project
project_name = rand_name('project-')
project_name = data_utils.rand_name('project-')
self.assertRaises(
exceptions.Unauthorized, self.v3_non_admin_client.create_project,
project_name)
@ -238,7 +238,7 @@ class ProjectsTestJSON(base.BaseIdentityAdminTest):
@attr(type=['negative', 'gate'])
def test_project_delete_by_unauthorized_user(self):
# Non-admin user should not be able to delete a project
project_name = rand_name('project-')
project_name = data_utils.rand_name('project-')
resp, project = self.v3_client.create_project(project_name)
self.v3data.projects.append(project)
self.assertRaises(

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.identity import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -27,23 +27,26 @@ class RolesV3TestJSON(base.BaseIdentityAdminTest):
def setUpClass(cls):
super(RolesV3TestJSON, cls).setUpClass()
cls.fetched_role_ids = list()
u_name = rand_name('user-')
u_name = data_utils.rand_name('user-')
u_desc = '%s description' % u_name
u_email = '%s@testmail.tm' % u_name
u_password = rand_name('pass-')
u_password = data_utils.rand_name('pass-')
resp = [None] * 5
resp[0], cls.project = cls.v3_client.create_project(
rand_name('project-'), description=rand_name('project-desc-'))
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'))
resp[1], cls.domain = cls.v3_client.create_domain(
rand_name('domain-'), description=rand_name('domain-desc-'))
data_utils.rand_name('domain-'),
description=data_utils.rand_name('domain-desc-'))
resp[2], cls.group_body = cls.v3_client.create_group(
rand_name('Group-'), project_id=cls.project['id'],
data_utils.rand_name('Group-'), project_id=cls.project['id'],
domain_id=cls.domain['id'])
resp[3], cls.user_body = cls.v3_client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email, project_id=cls.project['id'],
domain_id=cls.domain['id'])
resp[4], cls.role = cls.v3_client.create_role(rand_name('Role-'))
resp[4], cls.role = cls.v3_client.create_role(
data_utils.rand_name('Role-'))
for r in resp:
assert r['status'] == '201', "Expected: %s" % r['status']
@ -69,14 +72,14 @@ class RolesV3TestJSON(base.BaseIdentityAdminTest):
@attr(type='smoke')
def test_role_create_update_get(self):
r_name = rand_name('Role-')
r_name = data_utils.rand_name('Role-')
resp, role = self.v3_client.create_role(r_name)
self.addCleanup(self.v3_client.delete_role, role['id'])
self.assertEqual(resp['status'], '201')
self.assertIn('name', role)
self.assertEqual(role['name'], r_name)
new_name = rand_name('NewRole-')
new_name = data_utils.rand_name('NewRole-')
resp, updated_role = self.v3_client.update_role(new_name, role['id'])
self.assertEqual(resp['status'], '200')
self.assertIn('name', updated_role)

View File

@ -17,7 +17,7 @@
from tempest.api.identity import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -27,9 +27,9 @@ class ServicesTestJSON(base.BaseIdentityAdminTest):
@attr(type='gate')
def test_update_service(self):
# Update description attribute of service
name = rand_name('service-')
type = rand_name('type--')
description = rand_name('description-')
name = data_utils.rand_name('service-')
type = data_utils.rand_name('type--')
description = data_utils.rand_name('description-')
resp, body = self.client.create_service(
name, type, description=description)
self.assertEqual('200', resp['status'])
@ -39,7 +39,7 @@ class ServicesTestJSON(base.BaseIdentityAdminTest):
s_id = body['id']
resp1_desc = body['description']
s_desc2 = rand_name('desc2-')
s_desc2 = data_utils.rand_name('desc2-')
resp, body = self.service_client.update_service(
s_id, description=s_desc2)
resp2_desc = body['description']

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.identity import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -28,10 +28,10 @@ class UsersTestJSON(base.BaseIdentityAdminTest):
def test_tokens(self):
# Valid user's token is authenticated
# Create a User
u_name = rand_name('user-')
u_name = data_utils.rand_name('user-')
u_desc = '%s-description' % u_name
u_email = '%s@testmail.tm' % u_name
u_password = rand_name('pass-')
u_password = data_utils.rand_name('pass-')
resp, user = self.v3_client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email)

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.identity import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -27,10 +27,10 @@ class UsersV3TestJSON(base.BaseIdentityAdminTest):
def test_user_update(self):
# Test case to check if updating of user attributes is successful.
# Creating first user
u_name = rand_name('user-')
u_name = data_utils.rand_name('user-')
u_desc = u_name + 'description'
u_email = u_name + '@testmail.tm'
u_password = rand_name('pass-')
u_password = data_utils.rand_name('pass-')
resp, user = self.v3_client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email, enabled=False)
@ -38,11 +38,12 @@ class UsersV3TestJSON(base.BaseIdentityAdminTest):
self.addCleanup(self.v3_client.delete_user, user['id'])
# Creating second project for updation
resp, project = self.v3_client.create_project(
rand_name('project-'), description=rand_name('project-desc-'))
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'))
# Delete the Project at the end of this method
self.addCleanup(self.v3_client.delete_project, project['id'])
# Updating user details with new values
u_name2 = rand_name('user2-')
u_name2 = data_utils.rand_name('user2-')
u_email2 = u_name2 + '@testmail.tm'
u_description2 = u_name2 + ' description'
resp, update_user = self.v3_client.update_user(
@ -73,21 +74,23 @@ class UsersV3TestJSON(base.BaseIdentityAdminTest):
assigned_project_ids = list()
fetched_project_ids = list()
_, u_project = self.v3_client.create_project(
rand_name('project-'), description=rand_name('project-desc-'))
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'))
# Delete the Project at the end of this method
self.addCleanup(self.v3_client.delete_project, u_project['id'])
# Create a user.
u_name = rand_name('user-')
u_name = data_utils.rand_name('user-')
u_desc = u_name + 'description'
u_email = u_name + '@testmail.tm'
u_password = rand_name('pass-')
u_password = data_utils.rand_name('pass-')
_, user_body = self.v3_client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email, enabled=False, project_id=u_project['id'])
# Delete the User at the end of this method
self.addCleanup(self.v3_client.delete_user, user_body['id'])
# Creating Role
_, role_body = self.v3_client.create_role(rand_name('role-'))
_, role_body = self.v3_client.create_role(
data_utils.rand_name('role-'))
# Delete the Role at the end of this method
self.addCleanup(self.v3_client.delete_role, role_body['id'])
@ -96,7 +99,8 @@ class UsersV3TestJSON(base.BaseIdentityAdminTest):
for i in range(2):
# Creating project so as to assign role
_, project_body = self.v3_client.create_project(
rand_name('project-'), description=rand_name('project-desc-'))
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'))
_, project = self.v3_client.get_project(project_body['id'])
# Delete the Project at the end of this method
self.addCleanup(self.v3_client.delete_project, project_body['id'])

View File

@ -17,7 +17,7 @@
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
import tempest.test
@ -94,8 +94,8 @@ class DataGenerator(object):
def setup_test_user(self):
"""Set up a test user."""
self.setup_test_tenant()
self.test_user = rand_name('test_user_')
self.test_password = rand_name('pass_')
self.test_user = data_utils.rand_name('test_user_')
self.test_password = data_utils.rand_name('pass_')
self.test_email = self.test_user + '@testmail.tm'
resp, self.user = self.client.create_user(self.test_user,
self.test_password,
@ -105,8 +105,8 @@ class DataGenerator(object):
def setup_test_tenant(self):
"""Set up a test tenant."""
self.test_tenant = rand_name('test_tenant_')
self.test_description = rand_name('desc_')
self.test_tenant = data_utils.rand_name('test_tenant_')
self.test_description = data_utils.rand_name('desc_')
resp, self.tenant = self.client.create_tenant(
name=self.test_tenant,
description=self.test_description)
@ -114,15 +114,15 @@ class DataGenerator(object):
def setup_test_role(self):
"""Set up a test role."""
self.test_role = rand_name('role')
self.test_role = data_utils.rand_name('role')
resp, self.role = self.client.create_role(self.test_role)
self.roles.append(self.role)
def setup_test_v3_user(self):
"""Set up a test v3 user."""
self.setup_test_project()
self.test_user = rand_name('test_user_')
self.test_password = rand_name('pass_')
self.test_user = data_utils.rand_name('test_user_')
self.test_password = data_utils.rand_name('pass_')
self.test_email = self.test_user + '@testmail.tm'
resp, self.v3_user = self.client.create_user(self.test_user,
self.test_password,
@ -132,8 +132,8 @@ class DataGenerator(object):
def setup_test_project(self):
"""Set up a test project."""
self.test_project = rand_name('test_project_')
self.test_description = rand_name('desc_')
self.test_project = data_utils.rand_name('test_project_')
self.test_description = data_utils.rand_name('desc_')
resp, self.project = self.client.create_project(
name=self.test_project,
description=self.test_description)
@ -141,7 +141,7 @@ class DataGenerator(object):
def setup_test_v3_role(self):
"""Set up a test v3 role."""
self.test_role = rand_name('role')
self.test_role = data_utils.rand_name('role')
resp, self.v3_role = self.client.create_role(self.test_role)
self.v3_roles.append(self.v3_role)

View File

@ -18,7 +18,7 @@
import netaddr
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.openstack.common import log as logging
import tempest.test
@ -105,7 +105,7 @@ class BaseNetworkTest(tempest.test.BaseTestCase):
@classmethod
def create_network(cls, network_name=None):
"""Wrapper utility that returns a test network."""
network_name = network_name or rand_name('test-network-')
network_name = network_name or data_utils.rand_name('test-network-')
resp, body = cls.client.create_network(network_name)
network = body['network']
@ -211,7 +211,7 @@ class BaseNetworkTest(tempest.test.BaseTestCase):
"""Wrapper utility that returns a test vpn service."""
resp, body = cls.client.create_vpn_service(
subnet_id, router_id, admin_state_up=True,
name=rand_name("vpnservice-"))
name=data_utils.rand_name("vpnservice-"))
vpnservice = body['vpnservice']
cls.vpnservices.append(vpnservice)
return vpnservice

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.network import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -48,7 +48,7 @@ class FloatingIPTestJSON(base.BaseNetworkTest):
cls.network = cls.create_network()
cls.subnet = cls.create_subnet(cls.network)
cls.router = cls.create_router(
rand_name('router-'),
data_utils.rand_name('router-'),
external_network_id=cls.network_cfg.public_network_id)
resp, _ = cls.client.add_router_interface_with_subnet_id(
cls.router['id'], cls.subnet['id'])

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.network import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -45,8 +45,8 @@ class LoadBalancerJSON(base.BaseNetworkTest):
cls.network = cls.create_network()
cls.name = cls.network['name']
cls.subnet = cls.create_subnet(cls.network)
pool_name = rand_name('pool-')
vip_name = rand_name('vip-')
pool_name = data_utils.rand_name('pool-')
vip_name = data_utils.rand_name('vip-')
cls.pool = cls.create_pool(pool_name, "ROUND_ROBIN",
"HTTP", cls.subnet)
cls.vip = cls.create_vip(vip_name, "HTTP", 80, cls.subnet, cls.pool)
@ -68,8 +68,8 @@ class LoadBalancerJSON(base.BaseNetworkTest):
def test_create_update_delete_pool_vip(self):
# Creates a vip
name = rand_name('vip-')
resp, body = self.client.create_pool(rand_name("pool-"),
name = data_utils.rand_name('vip-')
resp, body = self.client.create_pool(data_utils.rand_name("pool-"),
"ROUND_ROBIN", "HTTP",
self.subnet['id'])
pool = body['pool']

View File

@ -18,7 +18,7 @@
import netaddr
from tempest.api.network import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -66,7 +66,7 @@ class NetworksTestJSON(base.BaseNetworkTest):
@attr(type='smoke')
def test_create_update_delete_network_subnet(self):
# Creates a network
name = rand_name('network-')
name = data_utils.rand_name('network-')
resp, body = self.client.create_network(name)
self.assertEqual('201', resp['status'])
network = body['network']
@ -186,19 +186,19 @@ class NetworksTestJSON(base.BaseNetworkTest):
@attr(type=['negative', 'smoke'])
def test_show_non_existent_network(self):
non_exist_id = rand_name('network')
non_exist_id = data_utils.rand_name('network')
self.assertRaises(exceptions.NotFound, self.client.show_network,
non_exist_id)
@attr(type=['negative', 'smoke'])
def test_show_non_existent_subnet(self):
non_exist_id = rand_name('subnet')
non_exist_id = data_utils.rand_name('subnet')
self.assertRaises(exceptions.NotFound, self.client.show_subnet,
non_exist_id)
@attr(type=['negative', 'smoke'])
def test_show_non_existent_port(self):
non_exist_id = rand_name('port')
non_exist_id = data_utils.rand_name('port')
self.assertRaises(exceptions.NotFound, self.client.show_port,
non_exist_id)
@ -274,7 +274,8 @@ class BulkNetworkOpsJSON(base.BaseNetworkTest):
@attr(type='smoke')
def test_bulk_create_delete_network(self):
# Creates 2 networks in one request
network_names = [rand_name('network-'), rand_name('network-')]
network_names = [data_utils.rand_name('network-'),
data_utils.rand_name('network-')]
resp, body = self.client.create_bulk_network(2, network_names)
created_networks = body['networks']
self.assertEqual('201', resp['status'])
@ -299,7 +300,7 @@ class BulkNetworkOpsJSON(base.BaseNetworkTest):
names = []
networks = [self.network1['id'], self.network2['id']]
for i in range(len(networks)):
names.append(rand_name('subnet-'))
names.append(data_utils.rand_name('subnet-'))
subnet_list = []
# TODO(raies): "for IPv6, version list [4, 6] will be used.
# and cidr for IPv6 will be of IPv6"
@ -332,7 +333,7 @@ class BulkNetworkOpsJSON(base.BaseNetworkTest):
names = []
networks = [self.network1['id'], self.network2['id']]
for i in range(len(networks)):
names.append(rand_name('port-'))
names.append(data_utils.rand_name('port-'))
port_list = []
state = [True, False]
for i in range(len(names)):

View File

@ -18,7 +18,7 @@
from tempest.api.network import base
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -55,8 +55,8 @@ class QuotasTest(base.BaseNetworkTest):
@attr(type='gate')
def test_quotas(self):
# Add a tenant to conduct the test
test_tenant = rand_name('test_tenant_')
test_description = rand_name('desc_')
test_tenant = data_utils.rand_name('test_tenant_')
test_description = data_utils.rand_name('desc_')
_, tenant = self.identity_admin_client.create_tenant(
name=test_tenant,
description=test_description)

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.network import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -57,7 +57,7 @@ class RoutersTest(base.BaseAdminNetworkTest):
# Create a router
# NOTE(salv-orlando): Do not invoke self.create_router
# as we need to check the response code
name = rand_name('router-')
name = data_utils.rand_name('router-')
resp, create_body = self.client.create_router(
name, external_gateway_info={
"network_id": self.network_cfg.public_network_id},
@ -99,7 +99,7 @@ class RoutersTest(base.BaseAdminNetworkTest):
def test_add_remove_router_interface_with_subnet_id(self):
network = self.create_network()
subnet = self.create_subnet(network)
router = self.create_router(rand_name('router-'))
router = self.create_router(data_utils.rand_name('router-'))
# Add router interface with subnet id
resp, interface = self.client.add_router_interface_with_subnet_id(
router['id'], subnet['id'])
@ -118,7 +118,7 @@ class RoutersTest(base.BaseAdminNetworkTest):
def test_add_remove_router_interface_with_port_id(self):
network = self.create_network()
self.create_subnet(network)
router = self.create_router(rand_name('router-'))
router = self.create_router(data_utils.rand_name('router-'))
resp, port_body = self.client.create_port(network['id'])
# add router interface to port created above
resp, interface = self.client.add_router_interface_with_port_id(
@ -160,7 +160,7 @@ class RoutersTest(base.BaseAdminNetworkTest):
@attr(type='smoke')
def test_update_router_set_gateway(self):
router = self.create_router(rand_name('router-'))
router = self.create_router(data_utils.rand_name('router-'))
self.client.update_router(
router['id'],
external_gateway_info={
@ -175,7 +175,7 @@ class RoutersTest(base.BaseAdminNetworkTest):
@attr(type='smoke')
def test_update_router_set_gateway_with_snat_explicit(self):
router = self.create_router(rand_name('router-'))
router = self.create_router(data_utils.rand_name('router-'))
self.admin_client.update_router_with_snat_gw_info(
router['id'],
external_gateway_info={
@ -189,7 +189,7 @@ class RoutersTest(base.BaseAdminNetworkTest):
@attr(type='smoke')
def test_update_router_set_gateway_without_snat(self):
router = self.create_router(rand_name('router-'))
router = self.create_router(data_utils.rand_name('router-'))
self.admin_client.update_router_with_snat_gw_info(
router['id'],
external_gateway_info={
@ -204,7 +204,7 @@ class RoutersTest(base.BaseAdminNetworkTest):
@attr(type='smoke')
def test_update_router_unset_gateway(self):
router = self.create_router(
rand_name('router-'),
data_utils.rand_name('router-'),
external_network_id=self.network_cfg.public_network_id)
self.client.update_router(router['id'], external_gateway_info={})
self._verify_router_gateway(router['id'])
@ -217,7 +217,7 @@ class RoutersTest(base.BaseAdminNetworkTest):
@attr(type='smoke')
def test_update_router_reset_gateway_without_snat(self):
router = self.create_router(
rand_name('router-'),
data_utils.rand_name('router-'),
external_network_id=self.network_cfg.public_network_id)
self.admin_client.update_router_with_snat_gw_info(
router['id'],

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.network import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -39,7 +39,7 @@ class VPNaaSJSON(base.BaseNetworkTest):
super(VPNaaSJSON, cls).setUpClass()
cls.network = cls.create_network()
cls.subnet = cls.create_subnet(cls.network)
cls.router = cls.create_router(rand_name("router-"))
cls.router = cls.create_router(data_utils.rand_name("router-"))
cls.create_router_interface(cls.router['id'], cls.subnet['id'])
cls.vpnservice = cls.create_vpnservice(cls.subnet['id'],
cls.router['id'])
@ -55,7 +55,7 @@ class VPNaaSJSON(base.BaseNetworkTest):
@attr(type='smoke')
def test_create_update_delete_vpn_service(self):
# Creates a VPN service
name = rand_name('vpn-service-')
name = data_utils.rand_name('vpn-service-')
resp, body = self.client.create_vpn_service(self.subnet['id'],
self.router['id'],
name=name,

View File

@ -18,8 +18,7 @@ import testtools
from tempest.api.object_storage import base
from tempest import clients
from tempest.common.utils.data_utils import arbitrary_string
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
from tempest.test import attr
@ -32,7 +31,7 @@ class AccountQuotasTest(base.BaseObjectTest):
@classmethod
def setUpClass(cls):
super(AccountQuotasTest, cls).setUpClass()
cls.container_name = rand_name(name="TestContainer")
cls.container_name = data_utils.rand_name(name="TestContainer")
cls.container_client.create_container(cls.container_name)
cls.data.setup_test_user()
@ -102,8 +101,8 @@ class AccountQuotasTest(base.BaseObjectTest):
"Account Quotas middleware not available")
@attr(type="smoke")
def test_upload_valid_object(self):
object_name = rand_name(name="TestObject")
data = arbitrary_string()
object_name = data_utils.rand_name(name="TestObject")
data = data_utils.arbitrary_string()
resp, _ = self.object_client.create_object(self.container_name,
object_name, data)
@ -113,8 +112,8 @@ class AccountQuotasTest(base.BaseObjectTest):
"Account Quotas middleware not available")
@attr(type=["negative", "smoke"])
def test_upload_large_object(self):
object_name = rand_name(name="TestObject")
data = arbitrary_string(30)
object_name = data_utils.rand_name(name="TestObject")
data = data_utils.arbitrary_string(30)
self.assertRaises(exceptions.OverLimit,
self.object_client.create_object,
self.container_name, object_name, data)

View File

@ -18,7 +18,7 @@
import random
from tempest.api.object_storage import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest.test import HTTP_SUCCESS
@ -30,7 +30,7 @@ class AccountTest(base.BaseObjectTest):
super(AccountTest, cls).setUpClass()
cls.containers = []
for i in xrange(ord('a'), ord('f') + 1):
name = rand_name(name='%s-' % chr(i))
name = data_utils.rand_name(name='%s-' % chr(i))
cls.container_client.create_container(name)
cls.containers.append(name)
cls.containers_count = len(cls.containers)

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.object_storage import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest.test import HTTP_SUCCESS
@ -39,7 +39,7 @@ class ObjectTestACLs(base.BaseObjectTest):
def setUp(self):
super(ObjectTestACLs, self).setUp()
self.container_name = rand_name(name='TestContainer')
self.container_name = data_utils.rand_name(name='TestContainer')
self.container_client.create_container(self.container_name)
def tearDown(self):
@ -50,7 +50,7 @@ class ObjectTestACLs(base.BaseObjectTest):
def test_write_object_without_using_creds(self):
# trying to create object with empty headers
# X-Auth-Token is not provided
object_name = rand_name(name='Object')
object_name = data_utils.rand_name(name='Object')
self.assertRaises(exceptions.Unauthorized,
self.custom_object_client.create_object,
self.container_name, object_name, 'data')
@ -58,7 +58,7 @@ class ObjectTestACLs(base.BaseObjectTest):
@attr(type=['negative', 'gate'])
def test_delete_object_without_using_creds(self):
# create object
object_name = rand_name(name='Object')
object_name = data_utils.rand_name(name='Object')
resp, _ = self.object_client.create_object(self.container_name,
object_name, 'data')
# trying to delete object with empty headers
@ -71,7 +71,7 @@ class ObjectTestACLs(base.BaseObjectTest):
def test_write_object_with_non_authorized_user(self):
# attempt to upload another file using non-authorized user
# User provided token is forbidden. ACL are not set
object_name = rand_name(name='Object')
object_name = data_utils.rand_name(name='Object')
# trying to create object with non-authorized user
self.assertRaises(exceptions.Unauthorized,
self.custom_object_client.create_object,
@ -82,7 +82,7 @@ class ObjectTestACLs(base.BaseObjectTest):
def test_read_object_with_non_authorized_user(self):
# attempt to read object using non-authorized user
# User provided token is forbidden. ACL are not set
object_name = rand_name(name='Object')
object_name = data_utils.rand_name(name='Object')
resp, _ = self.object_client.create_object(
self.container_name, object_name, 'data')
self.assertEqual(resp['status'], '201')
@ -96,7 +96,7 @@ class ObjectTestACLs(base.BaseObjectTest):
def test_delete_object_with_non_authorized_user(self):
# attempt to delete object using non-authorized user
# User provided token is forbidden. ACL are not set
object_name = rand_name(name='Object')
object_name = data_utils.rand_name(name='Object')
resp, _ = self.object_client.create_object(
self.container_name, object_name, 'data')
self.assertEqual(resp['status'], '201')
@ -116,7 +116,7 @@ class ObjectTestACLs(base.BaseObjectTest):
metadata_prefix='')
self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
# create object
object_name = rand_name(name='Object')
object_name = data_utils.rand_name(name='Object')
resp, _ = self.object_client.create_object(self.container_name,
object_name, 'data')
self.assertEqual(resp['status'], '201')
@ -136,7 +136,7 @@ class ObjectTestACLs(base.BaseObjectTest):
metadata_prefix='')
self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
# Trying to write the object without rights
object_name = rand_name(name='Object')
object_name = data_utils.rand_name(name='Object')
self.assertRaises(exceptions.Unauthorized,
self.custom_object_client.create_object,
self.container_name,
@ -154,7 +154,7 @@ class ObjectTestACLs(base.BaseObjectTest):
metadata_prefix='')
self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
# create object
object_name = rand_name(name='Object')
object_name = data_utils.rand_name(name='Object')
resp, _ = self.object_client.create_object(self.container_name,
object_name, 'data')
self.assertEqual(resp['status'], '201')
@ -175,7 +175,7 @@ class ObjectTestACLs(base.BaseObjectTest):
metadata_prefix='')
self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
# Trying to write the object with rights
object_name = rand_name(name='Object')
object_name = data_utils.rand_name(name='Object')
resp, _ = self.custom_object_client.create_object(
self.container_name,
object_name, 'data',
@ -194,7 +194,7 @@ class ObjectTestACLs(base.BaseObjectTest):
metadata_prefix='')
self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
# Trying to write the object without write rights
object_name = rand_name(name='Object')
object_name = data_utils.rand_name(name='Object')
self.assertRaises(exceptions.Unauthorized,
self.custom_object_client.create_object,
self.container_name,
@ -213,7 +213,7 @@ class ObjectTestACLs(base.BaseObjectTest):
metadata_prefix='')
self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
# create object
object_name = rand_name(name='Object')
object_name = data_utils.rand_name(name='Object')
resp, _ = self.object_client.create_object(self.container_name,
object_name, 'data')
self.assertEqual(resp['status'], '201')

View File

@ -18,8 +18,7 @@
import testtools
from tempest.api.object_storage import base
from tempest.common.utils.data_utils import arbitrary_string
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
from tempest.test import attr
@ -46,7 +45,7 @@ class ContainerQuotasTest(base.BaseObjectTest):
Maximum object count of the container.
"""
super(ContainerQuotasTest, self).setUp()
self.container_name = rand_name(name="TestContainer")
self.container_name = data_utils.rand_name(name="TestContainer")
self.container_client.create_container(self.container_name)
metadata = {"quota-bytes": str(QUOTA_BYTES),
"quota-count": str(QUOTA_COUNT), }
@ -62,8 +61,8 @@ class ContainerQuotasTest(base.BaseObjectTest):
@attr(type="smoke")
def test_upload_valid_object(self):
"""Attempts to uploads an object smaller than the bytes quota."""
object_name = rand_name(name="TestObject")
data = arbitrary_string(QUOTA_BYTES)
object_name = data_utils.rand_name(name="TestObject")
data = data_utils.arbitrary_string(QUOTA_BYTES)
nbefore = self._get_bytes_used()
@ -78,8 +77,8 @@ class ContainerQuotasTest(base.BaseObjectTest):
@attr(type="smoke")
def test_upload_large_object(self):
"""Attempts to upload an object lagger than the bytes quota."""
object_name = rand_name(name="TestObject")
data = arbitrary_string(QUOTA_BYTES + 1)
object_name = data_utils.rand_name(name="TestObject")
data = data_utils.arbitrary_string(QUOTA_BYTES + 1)
nbefore = self._get_bytes_used()
@ -95,7 +94,7 @@ class ContainerQuotasTest(base.BaseObjectTest):
def test_upload_too_many_objects(self):
"""Attempts to upload many objects that exceeds the count limit."""
for _ in range(QUOTA_COUNT):
name = rand_name(name="TestObject")
name = data_utils.rand_name(name="TestObject")
self.object_client.create_object(self.container_name, name, "")
nbefore = self._get_object_count()

View File

@ -16,8 +16,7 @@
# under the License.
from tempest.api.object_storage import base
from tempest.common.utils.data_utils import arbitrary_string
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest.test import HTTP_SUCCESS
@ -35,7 +34,7 @@ class ContainerTest(base.BaseObjectTest):
@attr(type='smoke')
def test_create_container(self):
container_name = rand_name(name='TestContainer')
container_name = data_utils.rand_name(name='TestContainer')
resp, body = self.container_client.create_container(container_name)
self.containers.append(container_name)
self.assertIn(resp['status'], ('202', '201'))
@ -43,7 +42,7 @@ class ContainerTest(base.BaseObjectTest):
@attr(type='smoke')
def test_delete_container(self):
# create a container
container_name = rand_name(name='TestContainer')
container_name = data_utils.rand_name(name='TestContainer')
resp, _ = self.container_client.create_container(container_name)
self.containers.append(container_name)
# delete container
@ -56,17 +55,17 @@ class ContainerTest(base.BaseObjectTest):
# add metadata to an object
# create a container
container_name = rand_name(name='TestContainer')
container_name = data_utils.rand_name(name='TestContainer')
resp, _ = self.container_client.create_container(container_name)
self.containers.append(container_name)
# create object
object_name = rand_name(name='TestObject')
data = arbitrary_string()
object_name = data_utils.rand_name(name='TestObject')
data = data_utils.arbitrary_string()
resp, _ = self.object_client.create_object(container_name,
object_name, data)
# set object metadata
meta_key = rand_name(name='Meta-Test-')
meta_value = rand_name(name='MetaValue-')
meta_key = data_utils.rand_name(name='Meta-Test-')
meta_value = data_utils.rand_name(name='MetaValue-')
orig_metadata = {meta_key: meta_value}
resp, _ = self.object_client.update_object_metadata(container_name,
object_name,
@ -87,7 +86,7 @@ class ContainerTest(base.BaseObjectTest):
# update/retrieve/delete container metadata
# create a container
container_name = rand_name(name='TestContainer')
container_name = data_utils.rand_name(name='TestContainer')
resp, _ = self.container_client.create_container(container_name)
self.containers.append(container_name)
# update container metadata

View File

@ -15,8 +15,7 @@
# under the License.
from tempest.api.object_storage import base
from tempest.common.utils.data_utils import arbitrary_string
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -25,15 +24,15 @@ class StaticWebTest(base.BaseObjectTest):
@classmethod
def setUpClass(cls):
super(StaticWebTest, cls).setUpClass()
cls.container_name = rand_name(name="TestContainer")
cls.container_name = data_utils.rand_name(name="TestContainer")
# This header should be posted on the container before every test
cls.headers_public_read_acl = {'Read': '.r:*'}
# Create test container and create one object in it
cls.container_client.create_container(cls.container_name)
cls.object_name = rand_name(name="TestObject")
cls.object_data = arbitrary_string()
cls.object_name = data_utils.rand_name(name="TestObject")
cls.object_data = data_utils.arbitrary_string()
cls.object_client.create_object(cls.container_name,
cls.object_name,
cls.object_data)

View File

@ -18,7 +18,7 @@
import time
from tempest.api.object_storage import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest.test import skip_because
@ -37,9 +37,9 @@ class ContainerSyncTest(base.BaseObjectTest):
int(container_sync_timeout / cls.container_sync_interval)
# define container and object clients
cls.clients = {}
cls.clients[rand_name(name='TestContainerSync')] = \
cls.clients[data_utils.rand_name(name='TestContainerSync')] = \
(cls.container_client, cls.object_client)
cls.clients[rand_name(name='TestContainerSync')] = \
cls.clients[data_utils.rand_name(name='TestContainerSync')] = \
(cls.container_client_alt, cls.object_client_alt)
for cont_name, client in cls.clients.items():
client[0].create_container(cont_name)
@ -71,8 +71,8 @@ class ContainerSyncTest(base.BaseObjectTest):
'Error installing X-Container-Sync-To '
'for the container "%s"' % (cont[0]))
# create object in container
object_name = rand_name(name='TestSyncObject')
data = object_name[::-1] # arbitrary_string()
object_name = data_utils.rand_name(name='TestSyncObject')
data = object_name[::-1] # data_utils.arbitrary_string()
resp, _ = obj_client[0].create_object(cont[0], object_name, data)
self.assertEqual(resp['status'], '201',
'Error creating the object "%s" in'

View File

@ -18,8 +18,7 @@
import time
from tempest.api.object_storage import base
from tempest.common.utils.data_utils import arbitrary_string
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest.test import skip_because
@ -29,7 +28,7 @@ class ObjectExpiryTest(base.BaseObjectTest):
@classmethod
def setUpClass(cls):
super(ObjectExpiryTest, cls).setUpClass()
cls.container_name = rand_name(name='TestContainer')
cls.container_name = data_utils.rand_name(name='TestContainer')
cls.container_client.create_container(cls.container_name)
@classmethod
@ -49,8 +48,8 @@ class ObjectExpiryTest(base.BaseObjectTest):
# "X-Delete-At", after this test case works.
# create object
object_name = rand_name(name='TestObject')
data = arbitrary_string()
object_name = data_utils.rand_name(name='TestObject')
data = data_utils.arbitrary_string()
resp, _ = self.object_client.create_object(self.container_name,
object_name, data)
# update object metadata with expiry time of 3 seconds

View File

@ -18,8 +18,7 @@
import hashlib
from tempest.api.object_storage import base
from tempest.common.utils.data_utils import arbitrary_string
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest.test import HTTP_SUCCESS
@ -28,7 +27,7 @@ class ObjectTest(base.BaseObjectTest):
@classmethod
def setUpClass(cls):
super(ObjectTest, cls).setUpClass()
cls.container_name = rand_name(name='TestContainer')
cls.container_name = data_utils.rand_name(name='TestContainer')
cls.container_client.create_container(cls.container_name)
cls.containers = [cls.container_name]
@ -51,13 +50,13 @@ class ObjectTest(base.BaseObjectTest):
@attr(type='smoke')
def test_create_object(self):
# create object
object_name = rand_name(name='TestObject')
data = arbitrary_string()
object_name = data_utils.rand_name(name='TestObject')
data = data_utils.arbitrary_string()
resp, _ = self.object_client.create_object(self.container_name,
object_name, data)
# create another object
object_name = rand_name(name='TestObject')
data = arbitrary_string()
object_name = data_utils.rand_name(name='TestObject')
data = data_utils.arbitrary_string()
resp, _ = self.object_client.create_object(self.container_name,
object_name, data)
self.assertEqual(resp['status'], '201')
@ -65,8 +64,8 @@ class ObjectTest(base.BaseObjectTest):
@attr(type='smoke')
def test_delete_object(self):
# create object
object_name = rand_name(name='TestObject')
data = arbitrary_string()
object_name = data_utils.rand_name(name='TestObject')
data = data_utils.arbitrary_string()
resp, _ = self.object_client.create_object(self.container_name,
object_name, data)
# delete object
@ -79,13 +78,13 @@ class ObjectTest(base.BaseObjectTest):
# add metadata to storage object, test if metadata is retrievable
# create Object
object_name = rand_name(name='TestObject')
data = arbitrary_string()
object_name = data_utils.rand_name(name='TestObject')
data = data_utils.arbitrary_string()
resp, _ = self.object_client.create_object(self.container_name,
object_name, data)
# set object metadata
meta_key = rand_name(name='test-')
meta_value = rand_name(name='MetaValue-')
meta_key = data_utils.rand_name(name='test-')
meta_value = data_utils.rand_name(name='MetaValue-')
orig_metadata = {meta_key: meta_value}
resp, _ = self.object_client.update_object_metadata(
self.container_name, object_name, orig_metadata)
@ -104,8 +103,8 @@ class ObjectTest(base.BaseObjectTest):
# retrieve object's data (in response body)
# create object
object_name = rand_name(name='TestObject')
data = arbitrary_string()
object_name = data_utils.rand_name(name='TestObject')
data = data_utils.arbitrary_string()
resp, _ = self.object_client.create_object(self.container_name,
object_name, data)
# get object
@ -117,16 +116,16 @@ class ObjectTest(base.BaseObjectTest):
@attr(type='smoke')
def test_copy_object_in_same_container(self):
# create source object
src_object_name = rand_name(name='SrcObject')
src_data = arbitrary_string(size=len(src_object_name) * 2,
base_text=src_object_name)
src_object_name = data_utils.rand_name(name='SrcObject')
src_data = data_utils.arbitrary_string(size=len(src_object_name) * 2,
base_text=src_object_name)
resp, _ = self.object_client.create_object(self.container_name,
src_object_name,
src_data)
# create destination object
dst_object_name = rand_name(name='DstObject')
dst_data = arbitrary_string(size=len(dst_object_name) * 3,
base_text=dst_object_name)
dst_object_name = data_utils.rand_name(name='DstObject')
dst_data = data_utils.arbitrary_string(size=len(dst_object_name) * 3,
base_text=dst_object_name)
resp, _ = self.object_client.create_object(self.container_name,
dst_object_name,
dst_data)
@ -144,8 +143,8 @@ class ObjectTest(base.BaseObjectTest):
# change the content type of an existing object
# create object
object_name = rand_name(name='TestObject')
data = arbitrary_string()
object_name = data_utils.rand_name(name='TestObject')
data = data_utils.arbitrary_string()
self.object_client.create_object(self.container_name,
object_name, data)
# get the old content type
@ -165,15 +164,15 @@ class ObjectTest(base.BaseObjectTest):
@attr(type='smoke')
def test_copy_object_2d_way(self):
# create source object
src_object_name = rand_name(name='SrcObject')
src_data = arbitrary_string(size=len(src_object_name) * 2,
base_text=src_object_name)
src_object_name = data_utils.rand_name(name='SrcObject')
src_data = data_utils.arbitrary_string(size=len(src_object_name) * 2,
base_text=src_object_name)
resp, _ = self.object_client.create_object(self.container_name,
src_object_name, src_data)
# create destination object
dst_object_name = rand_name(name='DstObject')
dst_data = arbitrary_string(size=len(dst_object_name) * 3,
base_text=dst_object_name)
dst_object_name = data_utils.rand_name(name='DstObject')
dst_data = data_utils.arbitrary_string(size=len(dst_object_name) * 3,
base_text=dst_object_name)
resp, _ = self.object_client.create_object(self.container_name,
dst_object_name, dst_data)
# copy source object to destination
@ -189,22 +188,23 @@ class ObjectTest(base.BaseObjectTest):
@attr(type='smoke')
def test_copy_object_across_containers(self):
# create a container to use as asource container
src_container_name = rand_name(name='TestSourceContainer')
src_container_name = data_utils.rand_name(name='TestSourceContainer')
self.container_client.create_container(src_container_name)
self.containers.append(src_container_name)
# create a container to use as a destination container
dst_container_name = rand_name(name='TestDestinationContainer')
dst_container_name = data_utils.rand_name(
name='TestDestinationContainer')
self.container_client.create_container(dst_container_name)
self.containers.append(dst_container_name)
# create object in source container
object_name = rand_name(name='Object')
data = arbitrary_string(size=len(object_name) * 2,
base_text=object_name)
object_name = data_utils.rand_name(name='Object')
data = data_utils.arbitrary_string(size=len(object_name) * 2,
base_text=object_name)
resp, _ = self.object_client.create_object(src_container_name,
object_name, data)
# set object metadata
meta_key = rand_name(name='test-')
meta_value = rand_name(name='MetaValue-')
meta_key = data_utils.rand_name(name='test-')
meta_value = data_utils.rand_name(name='MetaValue-')
orig_metadata = {meta_key: meta_value}
resp, _ = self.object_client.update_object_metadata(src_container_name,
object_name,
@ -226,8 +226,8 @@ class ObjectTest(base.BaseObjectTest):
@attr(type='gate')
def test_object_upload_in_segments(self):
# create object
object_name = rand_name(name='LObject')
data = arbitrary_string()
object_name = data_utils.rand_name(name='LObject')
data = data_utils.arbitrary_string()
segments = 10
data_segments = [data + str(i) for i in xrange(segments)]
# uploading segments
@ -259,8 +259,8 @@ class ObjectTest(base.BaseObjectTest):
# Make a conditional request for an object using the If-None-Match
# header, it should get downloaded only if the local file is different,
# otherwise the response code should be 304 Not Modified
object_name = rand_name(name='TestObject')
data = arbitrary_string()
object_name = data_utils.rand_name(name='TestObject')
data = data_utils.arbitrary_string()
self.object_client.create_object(self.container_name,
object_name, data)
# local copy is identical, no download
@ -281,7 +281,7 @@ class ObjectTest(base.BaseObjectTest):
class PublicObjectTest(base.BaseObjectTest):
def setUp(self):
super(PublicObjectTest, self).setUp()
self.container_name = rand_name(name='TestContainer')
self.container_name = data_utils.rand_name(name='TestContainer')
self.container_client.create_container(self.container_name)
def tearDown(self):
@ -299,9 +299,9 @@ class PublicObjectTest(base.BaseObjectTest):
self.container_name, metadata=cont_headers, metadata_prefix='')
self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
# create object
object_name = rand_name(name='Object')
data = arbitrary_string(size=len(object_name),
base_text=object_name)
object_name = data_utils.rand_name(name='Object')
data = data_utils.arbitrary_string(size=len(object_name),
base_text=object_name)
resp, _ = self.object_client.create_object(self.container_name,
object_name, data)
self.assertEqual(resp['status'], '201')
@ -329,9 +329,9 @@ class PublicObjectTest(base.BaseObjectTest):
self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
# create object
object_name = rand_name(name='Object')
data = arbitrary_string(size=len(object_name) * 1,
base_text=object_name)
object_name = data_utils.rand_name(name='Object')
data = data_utils.arbitrary_string(size=len(object_name) * 1,
base_text=object_name)
resp, _ = self.object_client.create_object(self.container_name,
object_name, data)
self.assertEqual(resp['status'], '201')

View File

@ -21,8 +21,7 @@ import time
import urlparse
from tempest.api.object_storage import base
from tempest.common.utils.data_utils import arbitrary_string
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest.test import HTTP_SUCCESS
@ -33,7 +32,7 @@ class ObjectTempUrlTest(base.BaseObjectTest):
@classmethod
def setUpClass(cls):
super(ObjectTempUrlTest, cls).setUpClass()
cls.container_name = rand_name(name='TestContainer')
cls.container_name = data_utils.rand_name(name='TestContainer')
cls.container_client.create_container(cls.container_name)
cls.containers = [cls.container_name]
@ -66,9 +65,9 @@ class ObjectTempUrlTest(base.BaseObjectTest):
self.key)
# create object
self.object_name = rand_name(name='ObjectTemp')
self.data = arbitrary_string(size=len(self.object_name),
base_text=self.object_name)
self.object_name = data_utils.rand_name(name='ObjectTemp')
self.data = data_utils.arbitrary_string(size=len(self.object_name),
base_text=self.object_name)
self.object_client.create_object(self.container_name,
self.object_name, self.data)
@ -111,8 +110,9 @@ class ObjectTempUrlTest(base.BaseObjectTest):
@attr(type='gate')
def test_put_object_using_temp_url(self):
# make sure the metadata has been set
new_data = arbitrary_string(size=len(self.object_name),
base_text=rand_name(name="random"))
new_data = data_utils.arbitrary_string(
size=len(self.object_name),
base_text=data_utils.rand_name(name="random"))
EXPIRATION_TIME = 10000 # high to ensure the test finishes.
expires = int(time.time() + EXPIRATION_TIME)

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.object_storage import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -44,14 +44,14 @@ class ContainerTest(base.BaseObjectTest):
@attr(type='smoke')
def test_versioned_container(self):
# create container
vers_container_name = rand_name(name='TestVersionContainer')
vers_container_name = data_utils.rand_name(name='TestVersionContainer')
resp, body = self.container_client.create_container(
vers_container_name)
self.containers.append(vers_container_name)
self.assertIn(resp['status'], ('202', '201'))
self.assertContainer(vers_container_name, '0', '0', 'Missing Header')
base_container_name = rand_name(name='TestBaseContainer')
base_container_name = data_utils.rand_name(name='TestBaseContainer')
headers = {'X-versions-Location': vers_container_name}
resp, body = self.container_client.create_container(
base_container_name,
@ -61,7 +61,7 @@ class ContainerTest(base.BaseObjectTest):
self.assertIn(resp['status'], ('202', '201'))
self.assertContainer(base_container_name, '0', '0',
vers_container_name)
object_name = rand_name(name='TestObject')
object_name = data_utils.rand_name(name='TestObject')
# create object
resp, _ = self.object_client.create_object(base_container_name,
object_name, '1')

View File

@ -15,7 +15,7 @@
import time
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.openstack.common import log as logging
import tempest.test
@ -99,7 +99,7 @@ class BaseOrchestrationTest(tempest.test.BaseTestCase):
@classmethod
def _create_keypair(cls, name_start='keypair-heat-'):
kp_name = rand_name(name_start)
kp_name = data_utils.rand_name(name_start)
resp, body = cls.keypairs_client.create_keypair(kp_name)
cls.keypairs.append(kp_name)
return body

View File

@ -15,7 +15,7 @@
import logging
from tempest.api.orchestration import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -30,7 +30,7 @@ class TestServerStackLimits(base.BaseOrchestrationTest):
def setUpClass(cls):
super(TestServerStackLimits, cls).setUpClass()
cls.client = cls.orchestration_client
cls.stack_name = rand_name('heat')
cls.stack_name = data_utils.rand_name('heat')
@attr(type='gate')
def test_exceed_max_template_size_fails(self):

View File

@ -17,7 +17,7 @@ import logging
from tempest.api.orchestration import base
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -101,7 +101,7 @@ Resources:
if not cls.config.service_available.neutron:
raise cls.skipException("Neutron support is required")
cls.network_client = os.network_client
cls.stack_name = rand_name('heat')
cls.stack_name = data_utils.rand_name('heat')
cls.keypair_name = (cls.orchestration_cfg.keypair_name or
cls._create_keypair()['name'])
cls.external_router_id = cls._get_external_router_id()

View File

@ -15,7 +15,7 @@
import logging
from tempest.api.orchestration import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -76,7 +76,7 @@ Resources:
if not cls.orchestration_cfg.image_ref:
raise cls.skipException("No image available to test")
cls.client = cls.orchestration_client
cls.stack_name = rand_name('heat')
cls.stack_name = data_utils.rand_name('heat')
keypair_name = (cls.orchestration_cfg.keypair_name or
cls._create_keypair()['name'])

View File

@ -16,7 +16,7 @@ import json
import testtools
from tempest.api.orchestration import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.common.utils.linux.remote_client import RemoteClient
import tempest.config
from tempest.openstack.common import log as logging
@ -132,7 +132,7 @@ Outputs:
raise cls.skipException("No image available to test")
cls.client = cls.orchestration_client
stack_name = rand_name('heat')
stack_name = data_utils.rand_name('heat')
if cls.orchestration_cfg.keypair_name:
keypair_name = cls.orchestration_cfg.keypair_name
else:

View File

@ -13,7 +13,7 @@
# under the License.
from tempest.api.orchestration import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.openstack.common import log as logging
from tempest.test import attr
@ -39,7 +39,7 @@ class StacksTestJSON(base.BaseOrchestrationTest):
@attr(type='smoke')
def test_stack_crud_no_resources(self):
stack_name = rand_name('heat')
stack_name = data_utils.rand_name('heat')
# create the stack
stack_identifier = self.create_stack(

View File

@ -15,7 +15,7 @@
import logging
from tempest.api.orchestration import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -41,7 +41,7 @@ Resources:
def setUpClass(cls):
super(TemplateYAMLTestJSON, cls).setUpClass()
cls.client = cls.orchestration_client
cls.stack_name = rand_name('heat')
cls.stack_name = data_utils.rand_name('heat')
cls.stack_identifier = cls.create_stack(cls.stack_name, cls.template)
cls.client.wait_for_stack_status(cls.stack_identifier,
'CREATE_COMPLETE')

View File

@ -13,7 +13,7 @@
# under the License.
from tempest.api.volume import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.openstack.common import log as logging
from tempest.services.volume.json.admin import volume_types_client
from tempest.services.volume.json import volumes_client
@ -54,8 +54,8 @@ class VolumeMultiBackendTest(base.BaseVolumeAdminTest):
cls.volume_id_list = []
try:
# Volume/Type creation (uses backend1_name)
type1_name = rand_name('Type-')
vol1_name = rand_name('Volume-')
type1_name = data_utils.rand_name('Type-')
vol1_name = data_utils.rand_name('Volume-')
extra_specs1 = {"volume_backend_name": cls.backend1_name}
resp, cls.type1 = cls.type_client.create_volume_type(
type1_name, extra_specs=extra_specs1)
@ -69,8 +69,8 @@ class VolumeMultiBackendTest(base.BaseVolumeAdminTest):
if cls.backend1_name != cls.backend2_name:
# Volume/Type creation (uses backend2_name)
type2_name = rand_name('Type-')
vol2_name = rand_name('Volume-')
type2_name = data_utils.rand_name('Type-')
vol2_name = data_utils.rand_name('Volume-')
extra_specs2 = {"volume_backend_name": cls.backend2_name}
resp, cls.type2 = cls.type_client.create_volume_type(
type2_name, extra_specs=extra_specs2)

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.volume.base import BaseVolumeTest
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.services.volume.json.admin import volume_types_client
from tempest.test import attr
@ -58,8 +58,8 @@ class VolumeTypesTest(BaseVolumeTest):
def test_create_get_delete_volume_with_volume_type_and_extra_specs(self):
# Create/get/delete volume with volume_type and extra spec.
volume = {}
vol_name = rand_name("volume-")
vol_type_name = rand_name("volume-type-")
vol_name = data_utils.rand_name("volume-")
vol_type_name = data_utils.rand_name("volume-type-")
proto = self.config.volume.storage_protocol
vendor = self.config.volume.vendor_name
extra_specs = {"storage_protocol": proto,
@ -102,7 +102,7 @@ class VolumeTypesTest(BaseVolumeTest):
def test_volume_type_create_get_delete(self):
# Create/get volume type.
body = {}
name = rand_name("volume-type-")
name = data_utils.rand_name("volume-type-")
proto = self.config.volume.storage_protocol
vendor = self.config.volume.vendor_name
extra_specs = {"storage_protocol": proto,

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.volume import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
@ -26,7 +26,7 @@ class VolumeTypesExtraSpecsTest(base.BaseVolumeAdminTest):
@classmethod
def setUpClass(cls):
super(VolumeTypesExtraSpecsTest, cls).setUpClass()
vol_type_name = rand_name('Volume-type-')
vol_type_name = data_utils.rand_name('Volume-type-')
resp, cls.volume_type = cls.client.create_volume_type(vol_type_name)
@classmethod

View File

@ -18,7 +18,7 @@
import uuid
from tempest.api.volume import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -29,7 +29,7 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest):
@classmethod
def setUpClass(cls):
super(ExtraSpecsNegativeTest, cls).setUpClass()
vol_type_name = rand_name('Volume-type-')
vol_type_name = data_utils.rand_name('Volume-type-')
cls.extra_specs = {"spec1": "val1"}
resp, cls.volume_type = cls.client.create_volume_type(vol_type_name,
extra_specs=

View File

@ -16,7 +16,7 @@
# under the License.
from tempest.api.volume import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest.test import services
@ -46,7 +46,7 @@ class VolumesGetTest(base.BaseVolumeTest):
def _volume_create_get_update_delete(self, **kwargs):
# Create a volume, Get it's details and Delete the volume
volume = {}
v_name = rand_name('Volume')
v_name = data_utils.rand_name('Volume')
metadata = {'Type': 'Test'}
# Create a volume
resp, volume = self.client.create_volume(size=1,
@ -88,7 +88,7 @@ class VolumesGetTest(base.BaseVolumeTest):
self.assertEqual(boot_flag, False)
# Update Volume
new_v_name = rand_name('new-Volume')
new_v_name = data_utils.rand_name('new-Volume')
new_desc = 'This is the new description of volume'
resp, update_volume = \
self.client.update_volume(volume['id'],
@ -118,7 +118,7 @@ class VolumesGetTest(base.BaseVolumeTest):
def test_volume_get_metadata_none(self):
# Create a volume without passing metadata, get details, and delete
volume = {}
v_name = rand_name('Volume-')
v_name = data_utils.rand_name('Volume-')
# Create a volume without metadata
resp, volume = self.client.create_volume(size=1,
display_name=v_name,

View File

@ -17,8 +17,7 @@
# under the License.
from tempest.api.volume import base
from tempest.common.utils.data_utils import rand_int_id
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.openstack.common import log as logging
from tempest.test import attr
@ -59,7 +58,7 @@ class VolumesListTest(base.BaseVolumeTest):
cls.volume_list = []
cls.volume_id_list = []
for i in range(3):
v_name = rand_name('volume')
v_name = data_utils.rand_name('volume')
metadata = {'Type': 'work'}
try:
resp, volume = cls.client.create_volume(size=1,
@ -107,7 +106,7 @@ class VolumesListTest(base.BaseVolumeTest):
@attr(type='gate')
def test_volume_list_by_name(self):
volume = self.volume_list[rand_int_id(0, 2)]
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
params = {'display_name': volume['display_name']}
resp, fetched_vol = self.client.list_volumes(params)
self.assertEqual(200, resp.status)
@ -117,7 +116,7 @@ class VolumesListTest(base.BaseVolumeTest):
@attr(type='gate')
def test_volume_list_details_by_name(self):
volume = self.volume_list[rand_int_id(0, 2)]
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
params = {'display_name': volume['display_name']}
resp, fetched_vol = self.client.list_volumes_with_detail(params)
self.assertEqual(200, resp.status)
@ -145,7 +144,7 @@ class VolumesListTest(base.BaseVolumeTest):
@attr(type='gate')
def test_volumes_list_by_availability_zone(self):
volume = self.volume_list[rand_int_id(0, 2)]
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
zone = volume['availability_zone']
params = {'availability_zone': zone}
resp, fetched_list = self.client.list_volumes(params)
@ -156,7 +155,7 @@ class VolumesListTest(base.BaseVolumeTest):
@attr(type='gate')
def test_volumes_list_details_by_availability_zone(self):
volume = self.volume_list[rand_int_id(0, 2)]
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
zone = volume['availability_zone']
params = {'availability_zone': zone}
resp, fetched_list = self.client.list_volumes_with_detail(params)

View File

@ -18,7 +18,7 @@
import uuid
from tempest.api.volume import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@ -32,7 +32,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
cls.client = cls.volumes_client
# Create a test shared instance and volume for attach/detach tests
vol_name = rand_name('Volume-')
vol_name = data_utils.rand_name('Volume-')
cls.volume = cls.create_volume(size=1, display_name=vol_name)
cls.client.wait_for_volume_status(cls.volume['id'], 'available')
@ -54,7 +54,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
def test_create_volume_with_invalid_size(self):
# Should not be able to create volume with invalid size
# in request
v_name = rand_name('Volume-')
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
self.assertRaises(exceptions.BadRequest, self.client.create_volume,
size='#$%', display_name=v_name, metadata=metadata)
@ -63,7 +63,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
def test_create_volume_with_out_passing_size(self):
# Should not be able to create volume without passing size
# in request
v_name = rand_name('Volume-')
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
self.assertRaises(exceptions.BadRequest, self.client.create_volume,
size='', display_name=v_name, metadata=metadata)
@ -71,7 +71,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
@attr(type=['negative', 'gate'])
def test_create_volume_with_size_zero(self):
# Should not be able to create volume with size zero
v_name = rand_name('Volume-')
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
self.assertRaises(exceptions.BadRequest, self.client.create_volume,
size='0', display_name=v_name, metadata=metadata)
@ -79,7 +79,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
@attr(type=['negative', 'gate'])
def test_create_volume_with_size_negative(self):
# Should not be able to create volume with size negative
v_name = rand_name('Volume-')
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
self.assertRaises(exceptions.BadRequest, self.client.create_volume,
size='-1', display_name=v_name, metadata=metadata)
@ -87,7 +87,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
@attr(type=['negative', 'gate'])
def test_create_volume_with_nonexistant_volume_type(self):
# Should not be able to create volume with non-existant volume type
v_name = rand_name('Volume-')
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
self.assertRaises(exceptions.NotFound, self.client.create_volume,
size='1', volume_type=str(uuid.uuid4()),
@ -96,7 +96,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
@attr(type=['negative', 'gate'])
def test_create_volume_with_nonexistant_snapshot_id(self):
# Should not be able to create volume with non-existant snapshot
v_name = rand_name('Volume-')
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
self.assertRaises(exceptions.NotFound, self.client.create_volume,
size='1', snapshot_id=str(uuid.uuid4()),
@ -105,7 +105,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
@attr(type=['negative', 'gate'])
def test_create_volume_with_nonexistant_source_volid(self):
# Should not be able to create volume with non-existant source volume
v_name = rand_name('Volume-')
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
self.assertRaises(exceptions.NotFound, self.client.create_volume,
size='1', source_volid=str(uuid.uuid4()),
@ -113,7 +113,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
@attr(type=['negative', 'gate'])
def test_update_volume_with_nonexistant_volume_id(self):
v_name = rand_name('Volume-')
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
self.assertRaises(exceptions.NotFound, self.client.update_volume,
volume_id=str(uuid.uuid4()), display_name=v_name,
@ -121,7 +121,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
@attr(type=['negative', 'gate'])
def test_update_volume_with_invalid_volume_id(self):
v_name = rand_name('Volume-')
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
self.assertRaises(exceptions.NotFound, self.client.update_volume,
volume_id='#$%%&^&^', display_name=v_name,
@ -129,7 +129,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
@attr(type=['negative', 'gate'])
def test_update_volume_with_empty_volume_id(self):
v_name = rand_name('Volume-')
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
self.assertRaises(exceptions.NotFound, self.client.update_volume,
volume_id='', display_name=v_name,
@ -159,7 +159,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
@attr(type=['negative', 'gate'])
def test_attach_volumes_with_nonexistent_volume_id(self):
srv_name = rand_name('Instance-')
srv_name = data_utils.rand_name('Instance-')
resp, server = self.servers_client.create_server(srv_name,
self.image_ref,
self.flavor_ref)
@ -239,7 +239,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
@attr(type=['negative', 'gate'])
def test_list_volumes_with_nonexistent_name(self):
v_name = rand_name('Volume-')
v_name = data_utils.rand_name('Volume-')
params = {'display_name': v_name}
resp, fetched_volume = self.client.list_volumes(params)
self.assertEqual(200, resp.status)
@ -247,7 +247,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
@attr(type=['negative', 'gate'])
def test_list_volumes_detail_with_nonexistent_name(self):
v_name = rand_name('Volume-')
v_name = data_utils.rand_name('Volume-')
params = {'display_name': v_name}
resp, fetched_volume = self.client.list_volumes_with_detail(params)
self.assertEqual(200, resp.status)

View File

@ -13,7 +13,7 @@
# under the License.
from tempest.api.volume import base
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.openstack.common import log as logging
from tempest.test import attr
@ -40,7 +40,7 @@ class VolumesSnapshotTest(base.BaseVolumeTest):
@attr(type='gate')
def test_snapshot_create_get_list_update_delete(self):
# Create a snapshot
s_name = rand_name('snap')
s_name = data_utils.rand_name('snap')
snapshot = self.create_snapshot(self.volume_origin['id'],
display_name=s_name)
@ -59,7 +59,7 @@ class VolumesSnapshotTest(base.BaseVolumeTest):
self.assertIn(tracking_data, snaps_data)
# Updates snapshot with new values
new_s_name = rand_name('new-snap')
new_s_name = data_utils.rand_name('new-snap')
new_desc = 'This is the new description of snapshot.'
resp, update_snapshot = \
self.snapshots_client.update_snapshot(snapshot['id'],

View File

@ -20,7 +20,7 @@ import keystoneclient.v2_0.client as keystoneclient
import neutronclient.v2_0.client as neutronclient
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
@ -147,17 +147,17 @@ class IsolatedCreds(object):
self.identity_admin_client.tenants.delete(tenant)
def _create_creds(self, suffix=None, admin=False):
rand_name_root = rand_name(self.name)
data_utils.rand_name_root = data_utils.rand_name(self.name)
if suffix:
rand_name_root += suffix
tenant_name = rand_name_root + "-tenant"
data_utils.rand_name_root += suffix
tenant_name = data_utils.rand_name_root + "-tenant"
tenant_desc = tenant_name + "-desc"
tenant = self._create_tenant(name=tenant_name,
description=tenant_desc)
if suffix:
rand_name_root += suffix
username = rand_name_root + "-user"
email = rand_name_root + "@example.com"
data_utils.rand_name_root += suffix
username = data_utils.rand_name_root + "-user"
email = data_utils.rand_name_root + "@example.com"
user = self._create_user(username, self.password,
tenant, email)
if admin:
@ -197,13 +197,13 @@ class IsolatedCreds(object):
network = None
subnet = None
router = None
rand_name_root = rand_name(self.name)
network_name = rand_name_root + "-network"
data_utils.rand_name_root = data_utils.rand_name(self.name)
network_name = data_utils.rand_name_root + "-network"
network = self._create_network(network_name, tenant_id)
try:
subnet_name = rand_name_root + "-subnet"
subnet_name = data_utils.rand_name_root + "-subnet"
subnet = self._create_subnet(subnet_name, tenant_id, network['id'])
router_name = rand_name_root + "-router"
router_name = data_utils.rand_name_root + "-router"
router = self._create_router(router_name, tenant_id)
self._add_router_interface(router['id'], subnet['id'])
except Exception:

View File

@ -34,7 +34,7 @@ from novaclient import exceptions as nova_exceptions
from tempest.api.network import common as net_common
from tempest.common import isolated_creds
from tempest.common import ssh
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.common.utils.linux.remote_client import RemoteClient
from tempest import exceptions
import tempest.manager
@ -399,7 +399,7 @@ class OfficialClientTest(tempest.test.BaseTestCase):
if client is None:
client = self.compute_client
if name is None:
name = rand_name('scenario-server-')
name = data_utils.rand_name('scenario-server-')
if image is None:
image = self.config.compute.image_ref
if flavor is None:
@ -423,7 +423,7 @@ class OfficialClientTest(tempest.test.BaseTestCase):
if client is None:
client = self.volume_client
if name is None:
name = rand_name('scenario-volume-')
name = data_utils.rand_name('scenario-volume-')
LOG.debug("Creating a volume (size: %s, name: %s)", size, name)
volume = client.volumes.create(size=size, display_name=name,
snapshot_id=snapshot_id,
@ -441,7 +441,7 @@ class OfficialClientTest(tempest.test.BaseTestCase):
if image_client is None:
image_client = self.image_client
if name is None:
name = rand_name('scenario-snapshot-')
name = data_utils.rand_name('scenario-snapshot-')
LOG.debug("Creating a snapshot image for server: %s", server.name)
image_id = compute_client.servers.create_image(server, name)
self.addCleanup(image_client.images.delete, image_id)
@ -456,7 +456,7 @@ class OfficialClientTest(tempest.test.BaseTestCase):
if client is None:
client = self.compute_client
if name is None:
name = rand_name('scenario-keypair-')
name = data_utils.rand_name('scenario-keypair-')
keypair = client.keypairs.create(name)
self.assertEqual(keypair.name, name)
self.set_resource(name, keypair)
@ -510,7 +510,7 @@ class NetworkScenarioTest(OfficialClientTest):
if client is None:
client = self.compute_client
# Create security group
sg_name = rand_name(namestart)
sg_name = data_utils.rand_name(namestart)
sg_desc = sg_name + " description"
secgroup = client.security_groups.create(sg_name, sg_desc)
self.assertEqual(secgroup.name, sg_name)
@ -523,7 +523,7 @@ class NetworkScenarioTest(OfficialClientTest):
return secgroup
def _create_network(self, tenant_id, namestart='network-smoke-'):
name = rand_name(namestart)
name = data_utils.rand_name(namestart)
body = dict(
network=dict(
name=name,
@ -579,11 +579,11 @@ class NetworkScenarioTest(OfficialClientTest):
subnet = net_common.DeletableSubnet(client=self.network_client,
**result['subnet'])
self.assertEqual(subnet.cidr, str(subnet_cidr))
self.set_resource(rand_name(namestart), subnet)
self.set_resource(data_utils.rand_name(namestart), subnet)
return subnet
def _create_port(self, network, namestart='port-quotatest-'):
name = rand_name(namestart)
name = data_utils.rand_name(namestart)
body = dict(
port=dict(name=name,
network_id=network.id,
@ -612,7 +612,7 @@ class NetworkScenarioTest(OfficialClientTest):
floating_ip = net_common.DeletableFloatingIp(
client=self.network_client,
**result['floatingip'])
self.set_resource(rand_name('floatingip-'), floating_ip)
self.set_resource(data_utils.rand_name('floatingip-'), floating_ip)
return floating_ip
def _ping_ip_address(self, ip_address):
@ -675,7 +675,7 @@ class OrchestrationScenarioTest(OfficialClientTest):
@classmethod
def _stack_rand_name(cls):
return rand_name(cls.__name__ + '-')
return data_utils.rand_name(cls.__name__ + '-')
@classmethod
def _get_default_network(cls):

View File

@ -15,7 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest.test import services
@ -47,7 +47,7 @@ class TestLargeOpsScenario(manager.NetworkScenarioTest):
self.volume_client.volumes, volume_id, status)
def _image_create(self, name, fmt, path, properties={}):
name = rand_name('%s-' % name)
name = data_utils.rand_name('%s-' % name)
image_file = open(path, 'rb')
self.addCleanup(image_file.close)
params = {
@ -82,7 +82,7 @@ class TestLargeOpsScenario(manager.NetworkScenarioTest):
properties=properties)
def nova_boot(self):
name = rand_name('scenario-server-')
name = data_utils.rand_name('scenario-server-')
client = self.compute_client
flavor_id = self.config.compute.flavor_ref
secgroup = self._create_security_group()

View File

@ -15,7 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest.test import services
@ -48,7 +48,7 @@ class TestMinimumBasicScenario(manager.OfficialClientTest):
self.volume_client.volumes, volume_id, status)
def _image_create(self, name, fmt, path, properties={}):
name = rand_name('%s-' % name)
name = data_utils.rand_name('%s-' % name)
image_file = open(path, 'rb')
self.addCleanup(image_file.close)
params = {

View File

@ -18,7 +18,7 @@
from tempest.api.network import common as net_common
from tempest.common import debug
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import config
from tempest.openstack.common import log as logging
from tempest.scenario import manager
@ -144,7 +144,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
"'public_network_id' has been defined.")
def _create_router(self, tenant_id, namestart='router-smoke-'):
name = rand_name(namestart)
name = data_utils.rand_name(namestart)
body = dict(
router=dict(
name=name,
@ -161,7 +161,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
def _create_keypairs(self):
self.keypairs[self.tenant_id] = self.create_keypair(
name=rand_name('keypair-smoke-'))
name=data_utils.rand_name('keypair-smoke-'))
def _create_security_groups(self):
self.security_groups[self.tenant_id] = self._create_security_group()
@ -214,7 +214,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
def _create_servers(self):
for i, network in enumerate(self.networks):
name = rand_name('server-smoke-%d-' % i)
name = data_utils.rand_name('server-smoke-%d-' % i)
server = self._create_server(name, network)
self.servers.append(server)

View File

@ -15,7 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest.test import services
@ -41,7 +41,7 @@ class TestServerBasicOps(manager.OfficialClientTest):
self.keypair = self.create_keypair()
def create_security_group(self):
sg_name = rand_name('secgroup-smoke')
sg_name = data_utils.rand_name('secgroup-smoke')
sg_desc = sg_name + " description"
self.secgroup = self.compute_client.security_groups.create(sg_name,
sg_desc)

View File

@ -19,7 +19,7 @@ import time
from cinderclient import exceptions as cinder_exceptions
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.scenario import manager
@ -75,7 +75,7 @@ class TestStampPattern(manager.OfficialClientTest):
return linux_client.ssh_client
def _create_volume_snapshot(self, volume):
snapshot_name = rand_name('scenario-snapshot-')
snapshot_name = data_utils.rand_name('scenario-snapshot-')
volume_snapshots = self.volume_client.volume_snapshots
snapshot = volume_snapshots.create(
volume.id, display_name=snapshot_name)

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.scenario import manager
from tempest.test import services
@ -34,7 +34,7 @@ class TestVolumeBootPattern(manager.OfficialClientTest):
def _create_volume_from_image(self):
img_uuid = self.config.compute.image_ref
vol_name = rand_name('volume-origin')
vol_name = data_utils.rand_name('volume-origin')
return self.create_volume(name=vol_name, imageRef=img_uuid)
def _boot_instance_from_volume(self, vol_id, keypair):
@ -53,7 +53,7 @@ class TestVolumeBootPattern(manager.OfficialClientTest):
def _create_snapshot_from_volume(self, vol_id):
volume_snapshots = self.volume_client.volume_snapshots
snap_name = rand_name('snapshot')
snap_name = data_utils.rand_name('snapshot')
snap = volume_snapshots.create(volume_id=vol_id,
force=True,
display_name=snap_name)
@ -64,7 +64,7 @@ class TestVolumeBootPattern(manager.OfficialClientTest):
return snap
def _create_volume_from_snapshot(self, snap_id):
vol_name = rand_name('volume')
vol_name = data_utils.rand_name('volume')
return self.create_volume(name=vol_name, snapshot_id=snap_id)
def _stop_instances(self, instances):
@ -88,7 +88,7 @@ class TestVolumeBootPattern(manager.OfficialClientTest):
def _ssh_to_server(self, server, keypair):
if self.config.compute.use_floatingip_for_ssh:
floating_ip = self.compute_client.floating_ips.create()
fip_name = rand_name('scenario-fip')
fip_name = data_utils.rand_name('scenario-fip')
self.set_resource(fip_name, floating_ip)
server.add_floating_ip(floating_ip)
ip = floating_ip.ip
@ -104,7 +104,7 @@ class TestVolumeBootPattern(manager.OfficialClientTest):
return ssh_client.exec_command('cat /tmp/text')
def _write_text(self, ssh_client):
text = rand_name('text-')
text = data_utils.rand_name('text-')
ssh_client.exec_command('echo "%s" > /tmp/text; sync' % (text))
return self._get_content(ssh_client)

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
import tempest.stress.stressaction as stressaction
@ -23,7 +23,7 @@ class ServerCreateDestroyTest(stressaction.StressAction):
self.flavor = self.manager.config.compute.flavor_ref
def run(self):
name = rand_name("instance")
name = data_utils.rand_name("instance")
self.logger.info("creating %s" % name)
resp, server = self.manager.servers_client.create_server(
name, self.image, self.flavor)

View File

@ -15,7 +15,7 @@
import socket
import subprocess
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
import tempest.stress.stressaction as stressaction
import tempest.test
@ -64,7 +64,7 @@ class FloatingStress(stressaction.StressAction):
raise RuntimeError("Cannot ping the machine.")
def _create_vm(self):
self.name = name = rand_name("instance")
self.name = name = data_utils.rand_name("instance")
servers_client = self.manager.servers_client
self.logger.info("creating %s" % name)
vm_args = self.vm_extra_args.copy()
@ -87,8 +87,8 @@ class FloatingStress(stressaction.StressAction):
def _create_sec_group(self):
sec_grp_cli = self.manager.security_groups_client
s_name = rand_name('sec_grp-')
s_description = rand_name('desc-')
s_name = data_utils.rand_name('sec_grp-')
s_description = data_utils.rand_name('desc-')
_, _sec_grp = sec_grp_cli.create_security_group(s_name,
s_description)
self.sec_grp = _sec_grp['id']

View File

@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
import tempest.stress.stressaction as stressaction
@ -23,7 +23,7 @@ class VolumeAttachDeleteTest(stressaction.StressAction):
def run(self):
# Step 1: create volume
name = rand_name("volume")
name = data_utils.rand_name("volume")
self.logger.info("creating volume: %s" % name)
resp, volume = self.manager.volumes_client.create_volume(size=1,
display_name=
@ -34,7 +34,7 @@ class VolumeAttachDeleteTest(stressaction.StressAction):
self.logger.info("created volume: %s" % volume['id'])
# Step 2: create vm instance
vm_name = rand_name("instance")
vm_name = data_utils.rand_name("instance")
self.logger.info("creating vm: %s" % vm_name)
resp, server = self.manager.servers_client.create_server(
vm_name, self.image, self.flavor)

View File

@ -10,14 +10,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
import tempest.stress.stressaction as stressaction
class VolumeCreateDeleteTest(stressaction.StressAction):
def run(self):
name = rand_name("volume")
name = data_utils.rand_name("volume")
self.logger.info("creating %s" % name)
volumes_client = self.manager.volumes_client
resp, volume = volumes_client.create_volume(size=1,

View File

@ -19,7 +19,7 @@ import time
from tempest import clients
from tempest.common import ssh
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.openstack.common import importutils
from tempest.openstack.common import log as logging
@ -131,8 +131,8 @@ def stress_openstack(tests, duration, max_runs=None, stop_on_error=False):
manager = clients.Manager()
for p_number in xrange(test.get('threads', default_thread_num)):
if test.get('use_isolated_tenants', False):
username = rand_name("stress_user")
tenant_name = rand_name("stress_tenant")
username = data_utils.rand_name("stress_user")
tenant_name = data_utils.rand_name("stress_tenant")
password = "pass"
identity_client = admin_manager.identity_client
_, tenant = identity_client.create_tenant(name=tenant_name)

View File

@ -18,7 +18,7 @@
from boto import exception
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.common.utils.linux.remote_client import RemoteClient
from tempest import exceptions
from tempest.openstack.common import log as logging
@ -50,8 +50,8 @@ class InstanceRunTest(BotoTestCase):
aki_manifest = config.boto.aki_manifest
ari_manifest = config.boto.ari_manifest
cls.instance_type = config.boto.instance_type
cls.bucket_name = rand_name("s3bucket-")
cls.keypair_name = rand_name("keypair-")
cls.bucket_name = data_utils.rand_name("s3bucket-")
cls.keypair_name = data_utils.rand_name("keypair-")
cls.keypair = cls.ec2_client.create_key_pair(cls.keypair_name)
cls.addResourceCleanUp(cls.ec2_client.delete_key_pair,
cls.keypair_name)
@ -61,13 +61,13 @@ class InstanceRunTest(BotoTestCase):
cls.bucket_name)
s3_upload_dir(bucket, cls.materials_path)
cls.images = {"ami":
{"name": rand_name("ami-name-"),
{"name": data_utils.rand_name("ami-name-"),
"location": cls.bucket_name + "/" + ami_manifest},
"aki":
{"name": rand_name("aki-name-"),
{"name": data_utils.rand_name("aki-name-"),
"location": cls.bucket_name + "/" + aki_manifest},
"ari":
{"name": rand_name("ari-name-"),
{"name": data_utils.rand_name("ari-name-"),
"location": cls.bucket_name + "/" + ari_manifest}}
for image in cls.images.itervalues():
image["image_id"] = cls.ec2_client.register_image(
@ -238,7 +238,7 @@ class InstanceRunTest(BotoTestCase):
def test_integration_1(self):
# EC2 1. integration test (not strict)
image_ami = self.ec2_client.get_image(self.images["ami"]["image_id"])
sec_group_name = rand_name("securitygroup-")
sec_group_name = data_utils.rand_name("securitygroup-")
group_desc = sec_group_name + " security group description "
security_group = self.ec2_client.create_security_group(sec_group_name,
group_desc)
@ -285,7 +285,7 @@ class InstanceRunTest(BotoTestCase):
ssh = RemoteClient(address.public_ip,
self.os.config.compute.ssh_user,
pkey=self.keypair.material)
text = rand_name("Pattern text for console output -")
text = data_utils.rand_name("Pattern text for console output -")
resp = ssh.write_to_console(text)
self.assertFalse(resp)

View File

@ -16,7 +16,7 @@
# under the License.
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest.test import skip_because
from tempest.thirdparty.boto.test import BotoTestCase
@ -40,7 +40,7 @@ class EC2KeysTest(BotoTestCase):
@attr(type='smoke')
def test_create_ec2_keypair(self):
# EC2 create KeyPair
key_name = rand_name("keypair-")
key_name = data_utils.rand_name("keypair-")
self.addResourceCleanUp(self.client.delete_key_pair, key_name)
keypair = self.client.create_key_pair(key_name)
self.assertTrue(compare_key_pairs(keypair,
@ -50,7 +50,7 @@ class EC2KeysTest(BotoTestCase):
@attr(type='smoke')
def test_delete_ec2_keypair(self):
# EC2 delete KeyPair
key_name = rand_name("keypair-")
key_name = data_utils.rand_name("keypair-")
self.client.create_key_pair(key_name)
self.client.delete_key_pair(key_name)
self.assertEqual(None, self.client.get_key_pair(key_name))
@ -58,7 +58,7 @@ class EC2KeysTest(BotoTestCase):
@attr(type='smoke')
def test_get_ec2_keypair(self):
# EC2 get KeyPair
key_name = rand_name("keypair-")
key_name = data_utils.rand_name("keypair-")
self.addResourceCleanUp(self.client.delete_key_pair, key_name)
keypair = self.client.create_key_pair(key_name)
self.assertTrue(compare_key_pairs(keypair,
@ -67,7 +67,7 @@ class EC2KeysTest(BotoTestCase):
@attr(type='smoke')
def test_duplicate_ec2_keypair(self):
# EC2 duplicate KeyPair
key_name = rand_name("keypair-")
key_name = data_utils.rand_name("keypair-")
self.addResourceCleanUp(self.client.delete_key_pair, key_name)
keypair = self.client.create_key_pair(key_name)
self.assertBotoError(self.ec.client.InvalidKeyPair.Duplicate,

View File

@ -16,7 +16,7 @@
# under the License.
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest.thirdparty.boto.test import BotoTestCase
@ -32,7 +32,7 @@ class EC2SecurityGroupTest(BotoTestCase):
@attr(type='smoke')
def test_create_authorize_security_group(self):
# EC2 Create, authorize/revoke security group
group_name = rand_name("securty_group-")
group_name = data_utils.rand_name("securty_group-")
group_description = group_name + " security group description "
group = self.client.create_security_group(group_name,
group_description)

View File

@ -16,7 +16,7 @@
# under the License.
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest.test import skip_because
from tempest.thirdparty.boto.test import BotoTestCase
@ -34,7 +34,7 @@ class S3BucketsTest(BotoTestCase):
@attr(type='smoke')
def test_create_and_get_delete_bucket(self):
# S3 Create, get and delete bucket
bucket_name = rand_name("s3bucket-")
bucket_name = data_utils.rand_name("s3bucket-")
cleanup_key = self.addResourceCleanUp(self.client.delete_bucket,
bucket_name)
bucket = self.client.create_bucket(bucket_name)

View File

@ -18,7 +18,7 @@
import os
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest.thirdparty.boto.test import BotoTestCase
from tempest.thirdparty.boto.utils.s3 import s3_upload_dir
@ -43,7 +43,7 @@ class S3ImagesTest(BotoTestCase):
cls.ami_path = cls.materials_path + os.sep + cls.ami_manifest
cls.aki_path = cls.materials_path + os.sep + cls.aki_manifest
cls.ari_path = cls.materials_path + os.sep + cls.ari_manifest
cls.bucket_name = rand_name("bucket-")
cls.bucket_name = data_utils.rand_name("bucket-")
bucket = cls.s3_client.create_bucket(cls.bucket_name)
cls.addResourceCleanUp(cls.destroy_bucket,
cls.s3_client.connection_data,
@ -53,7 +53,7 @@ class S3ImagesTest(BotoTestCase):
@attr(type='smoke')
def test_register_get_deregister_ami_image(self):
# Register and deregister ami image
image = {"name": rand_name("ami-name-"),
image = {"name": data_utils.rand_name("ami-name-"),
"location": self.bucket_name + "/" + self.ami_manifest,
"type": "ami"}
image["image_id"] = self.images_client.register_image(
@ -76,7 +76,7 @@ class S3ImagesTest(BotoTestCase):
def test_register_get_deregister_aki_image(self):
# Register and deregister aki image
image = {"name": rand_name("aki-name-"),
image = {"name": data_utils.rand_name("aki-name-"),
"location": self.bucket_name + "/" + self.aki_manifest,
"type": "aki"}
image["image_id"] = self.images_client.register_image(
@ -99,7 +99,7 @@ class S3ImagesTest(BotoTestCase):
def test_register_get_deregister_ari_image(self):
# Register and deregister ari image
image = {"name": rand_name("ari-name-"),
image = {"name": data_utils.rand_name("ari-name-"),
"location": "/" + self.bucket_name + "/" + self.ari_manifest,
"type": "ari"}
image["image_id"] = self.images_client.register_image(

View File

@ -20,7 +20,7 @@ import contextlib
import boto.s3.key
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest.thirdparty.boto.test import BotoTestCase
@ -36,8 +36,8 @@ class S3BucketsTest(BotoTestCase):
@attr(type='smoke')
def test_create_get_delete_object(self):
# S3 Create, get and delete object
bucket_name = rand_name("s3bucket-")
object_name = rand_name("s3object-")
bucket_name = data_utils.rand_name("s3bucket-")
object_name = data_utils.rand_name("s3object-")
content = 'x' * 42
bucket = self.client.create_bucket(bucket_name)
self.addResourceCleanUp(self.destroy_bucket,