Pass resource_name_prefix from tests
The resource_name_prefix was introduced by [1] and in order to allow users to fully customize the prefix of all resources created by tempest, it needs to be used in tests. [1] https://review.opendev.org/c/openstack/tempest/+/897231 Change-Id: I1e23d7a276b32e236fc8897d265c037773eca79d
This commit is contained in:
parent
17053d69e5
commit
213d0a4c68
@ -51,7 +51,9 @@ class AgentsAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
# If you try to create an agent with the same hypervisor,
|
||||
# os and architecture as an existing agent, Nova will return
|
||||
# an HTTPConflict or HTTPServerError.
|
||||
kwargs[rand_key] = data_utils.rand_name(kwargs[rand_key])
|
||||
kwargs[rand_key] = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=kwargs[rand_key])
|
||||
return kwargs
|
||||
|
||||
@decorators.idempotent_id('1fc6bdc8-0b6d-4cc7-9f30-9b04fabe5b90')
|
||||
|
@ -15,10 +15,13 @@
|
||||
|
||||
from tempest.api.compute import base
|
||||
from tempest.common import tempest_fixtures as fixtures
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
|
||||
"""Tests Aggregates API that require admin privileges"""
|
||||
@ -40,7 +43,9 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
|
||||
if v['status'] == 'enabled' and v['state'] == 'up']
|
||||
|
||||
def _create_test_aggregate(self):
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
aggregate_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.aggregate_name_prefix)
|
||||
aggregate = (self.client.create_aggregate(name=aggregate_name)
|
||||
['aggregate'])
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
@ -50,7 +55,9 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
|
||||
@decorators.idempotent_id('86a1cb14-da37-4a70-b056-903fd56dfe29')
|
||||
def test_aggregate_create_as_user(self):
|
||||
"""Regular user is not allowed to create an aggregate"""
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
aggregate_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.aggregate_name_prefix)
|
||||
self.assertRaises(lib_exc.Forbidden,
|
||||
self.aggregates_client.create_aggregate,
|
||||
name=aggregate_name)
|
||||
@ -125,7 +132,9 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
|
||||
def test_aggregate_add_non_exist_host(self):
|
||||
"""Adding a non-exist host to an aggregate should fail"""
|
||||
while True:
|
||||
non_exist_host = data_utils.rand_name('nonexist_host')
|
||||
non_exist_host = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name='nonexist_host')
|
||||
if non_exist_host not in self.hosts:
|
||||
break
|
||||
aggregate = self._create_test_aggregate()
|
||||
|
@ -51,7 +51,8 @@ class ServersWithSpecificFlavorTestJSON(base.BaseV2ComputeAdminTest):
|
||||
|
||||
def create_flavor_with_ephemeral(ephem_disk):
|
||||
name = 'flavor_with_ephemeral_%s' % ephem_disk
|
||||
flavor_name = data_utils.rand_name(name)
|
||||
flavor_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name=name)
|
||||
|
||||
ram = flavor_base['ram']
|
||||
vcpus = flavor_base['vcpus']
|
||||
|
@ -16,10 +16,13 @@
|
||||
import uuid
|
||||
|
||||
from tempest.api.compute import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
"""Tests Flavors API Create and Delete that require admin privileges"""
|
||||
@ -76,7 +79,9 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
|
||||
This operation requires the user to have 'admin' role
|
||||
"""
|
||||
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
|
||||
flavor_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.flavor_name_prefix)
|
||||
|
||||
# Create the flavor
|
||||
self.create_flavor(name=flavor_name,
|
||||
@ -107,7 +112,9 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
self.assertEqual(flavor['OS-FLV-EXT-DATA:ephemeral'], 0)
|
||||
self.assertEqual(flavor['os-flavor-access:is_public'], True)
|
||||
|
||||
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
|
||||
flavor_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.flavor_name_prefix)
|
||||
new_flavor_id = data_utils.rand_int_id(start=1000)
|
||||
|
||||
# Create the flavor
|
||||
@ -143,7 +150,9 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
tenant is not automatically added access list.
|
||||
This operation requires the user to have 'admin' role
|
||||
"""
|
||||
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
|
||||
flavor_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.flavor_name_prefix)
|
||||
|
||||
# Create the flavor
|
||||
self.create_flavor(name=flavor_name,
|
||||
@ -178,7 +187,9 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
|
||||
Try to List/Get flavor with another user
|
||||
"""
|
||||
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
|
||||
flavor_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.flavor_name_prefix)
|
||||
|
||||
# Create the flavor
|
||||
self.create_flavor(name=flavor_name,
|
||||
@ -192,8 +203,11 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
@decorators.idempotent_id('fb9cbde6-3a0e-41f2-a983-bdb0a823c44e')
|
||||
def test_is_public_string_variations(self):
|
||||
"""Test creating public and non public flavors"""
|
||||
flavor_name_not_public = data_utils.rand_name(self.flavor_name_prefix)
|
||||
flavor_name_public = data_utils.rand_name(self.flavor_name_prefix)
|
||||
prefix = CONF.resource_name_prefix
|
||||
flavor_name_not_public = data_utils.rand_name(
|
||||
prefix=prefix, name=self.flavor_name_prefix)
|
||||
flavor_name_public = data_utils.rand_name(
|
||||
prefix=prefix, name=self.flavor_name_prefix)
|
||||
|
||||
# Create a non public flavor
|
||||
self.create_flavor(name=flavor_name_not_public,
|
||||
|
@ -14,9 +14,12 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.compute import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class FlavorsExtraSpecsTestJSON(base.BaseV2ComputeAdminTest):
|
||||
"""Tests Flavor Extra Spec API extension.
|
||||
@ -28,7 +31,8 @@ class FlavorsExtraSpecsTestJSON(base.BaseV2ComputeAdminTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(FlavorsExtraSpecsTestJSON, cls).resource_setup()
|
||||
flavor_name = data_utils.rand_name('test_flavor')
|
||||
flavor_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='test_flavor')
|
||||
ram = 512
|
||||
vcpus = 1
|
||||
disk = 10
|
||||
@ -139,7 +143,9 @@ class FlavorMetadataValidation(base.BaseV2ComputeAdminTest):
|
||||
@decorators.idempotent_id('d3114f03-b0f2-4dc7-be11-70c0abc178b3')
|
||||
def test_flavor_update_with_custom_namespace(self):
|
||||
"""Test flavor creation with a custom namespace, key and value"""
|
||||
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
|
||||
flavor_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.flavor_name_prefix)
|
||||
flavor_id = self.create_flavor(ram=self.ram,
|
||||
vcpus=self.vcpus,
|
||||
disk=self.disk,
|
||||
|
@ -15,10 +15,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.compute import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class FlavorsExtraSpecsNegativeTestJSON(base.BaseV2ComputeAdminTest):
|
||||
"""Negative Tests Flavor Extra Spec API extension.
|
||||
@ -30,7 +33,8 @@ class FlavorsExtraSpecsNegativeTestJSON(base.BaseV2ComputeAdminTest):
|
||||
def resource_setup(cls):
|
||||
super(FlavorsExtraSpecsNegativeTestJSON, cls).resource_setup()
|
||||
|
||||
flavor_name = data_utils.rand_name('test_flavor')
|
||||
flavor_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='test_flavor')
|
||||
ram = 512
|
||||
vcpus = 1
|
||||
disk = 10
|
||||
|
@ -14,9 +14,12 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.compute.keypairs import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class KeyPairsV210TestJSON(base.BaseKeypairTest):
|
||||
"""Tests KeyPairs API with microversion higher than 2.9"""
|
||||
@ -33,7 +36,8 @@ class KeyPairsV210TestJSON(base.BaseKeypairTest):
|
||||
def _create_and_check_keypairs(self, user_id):
|
||||
key_list = list()
|
||||
for _ in range(2):
|
||||
k_name = data_utils.rand_name('keypair')
|
||||
k_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='keypair')
|
||||
keypair = self.create_keypair(k_name,
|
||||
keypair_type='ssh',
|
||||
user_id=user_id,
|
||||
|
@ -214,7 +214,8 @@ class LiveMigrationTest(LiveMigrationTestBase):
|
||||
self.assertEqual(volume_id1, volume_id2)
|
||||
|
||||
def _create_net_subnet(self, name, cidr):
|
||||
net_name = data_utils.rand_name(name=name)
|
||||
net_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name=name)
|
||||
net = self.networks_client.create_network(name=net_name)['network']
|
||||
self.addClassResourceCleanup(
|
||||
self.networks_client.delete_network, net['id'])
|
||||
@ -228,7 +229,8 @@ class LiveMigrationTest(LiveMigrationTestBase):
|
||||
return net
|
||||
|
||||
def _create_port(self, network_id, name):
|
||||
name = data_utils.rand_name(name=name)
|
||||
name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name=name)
|
||||
port = self.ports_client.create_port(name=name,
|
||||
network_id=network_id)['port']
|
||||
self.addClassResourceCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
@ -244,7 +246,8 @@ class LiveMigrationTest(LiveMigrationTestBase):
|
||||
subport = self._create_port(network_id=net['id'], name='subport')
|
||||
|
||||
trunk = self.trunks_client.create_trunk(
|
||||
name=data_utils.rand_name('trunk'),
|
||||
name=data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='trunk'),
|
||||
port_id=parent['id'],
|
||||
sub_ports=[{"segmentation_id": 42, "port_id": subport['id'],
|
||||
"segmentation_type": "vlan"}]
|
||||
|
@ -43,7 +43,8 @@ class LiveMigrationNegativeTest(base.BaseV2ComputeAdminTest):
|
||||
@decorators.idempotent_id('7fb7856e-ae92-44c9-861a-af62d7830bcb')
|
||||
def test_invalid_host_for_migration(self):
|
||||
"""Test migrating to an invalid host should not change the status"""
|
||||
target_host = data_utils.rand_name('host')
|
||||
target_host = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='host')
|
||||
server = self.create_test_server(wait_until="ACTIVE")
|
||||
|
||||
self.assertRaises(lib_exc.BadRequest, self._migrate_server_to,
|
||||
|
@ -74,7 +74,9 @@ class MigrationsAdminTest(base.BaseV2ComputeAdminTest):
|
||||
flavor = self.admin_flavors_client.show_flavor(
|
||||
self.flavor_ref)['flavor']
|
||||
flavor = self.admin_flavors_client.create_flavor(
|
||||
name=data_utils.rand_name('test_resize_flavor_'),
|
||||
name=data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name='test_resize_flavor_'),
|
||||
ram=flavor['ram'],
|
||||
disk=flavor['disk'],
|
||||
vcpus=flavor['vcpus']
|
||||
|
@ -43,7 +43,9 @@ class QuotasAdminTestBase(base.BaseV2ComputeAdminTest):
|
||||
|
||||
def _get_updated_quotas(self):
|
||||
# Verify that GET shows the updated quota set of project
|
||||
project_name = data_utils.rand_name('cpu_quota_project')
|
||||
project_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name='cpu_quota_project')
|
||||
project_desc = project_name + '-desc'
|
||||
project = identity.identity_utils(self.os_admin).create_project(
|
||||
name=project_name, description=project_desc)
|
||||
@ -59,7 +61,9 @@ class QuotasAdminTestBase(base.BaseV2ComputeAdminTest):
|
||||
self.assertEqual(5120, quota_set['ram']['limit'])
|
||||
|
||||
# Verify that GET shows the updated quota set of user
|
||||
user_name = data_utils.rand_name('cpu_quota_user')
|
||||
user_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name='cpu_quota_user')
|
||||
password = data_utils.rand_password()
|
||||
email = user_name + '@testmail.tm'
|
||||
user = identity.identity_utils(self.os_admin).create_user(
|
||||
@ -157,7 +161,9 @@ class QuotasAdminTestJSON(QuotasAdminTestBase):
|
||||
'Legacy quota update not available with unified limits')
|
||||
def test_delete_quota(self):
|
||||
"""Test admin can delete the compute quota set for a project"""
|
||||
project_name = data_utils.rand_name('ram_quota_project')
|
||||
project_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name='ram_quota_project')
|
||||
project_desc = project_name + '-desc'
|
||||
project = identity.identity_utils(self.os_admin).create_project(
|
||||
name=project_name, description=project_desc)
|
||||
|
@ -133,8 +133,9 @@ class QuotasSecurityGroupAdminNegativeTest(QuotasAdminNegativeTestBase):
|
||||
# when we reach limit maxSecurityGroupRules
|
||||
self._update_quota('security_group_rules', 0)
|
||||
|
||||
s_name = data_utils.rand_name('securitygroup')
|
||||
s_description = data_utils.rand_name('description')
|
||||
prefix = CONF.resource_name_prefix
|
||||
s_name = data_utils.rand_name(prefix=prefix, name='securitygroup')
|
||||
s_description = data_utils.rand_name(prefix=prefix, name='description')
|
||||
securitygroup = self.sg_client.create_security_group(
|
||||
name=s_name, description=s_description)['security_group']
|
||||
self.addCleanup(self.sg_client.delete_security_group,
|
||||
|
@ -15,9 +15,12 @@
|
||||
|
||||
from tempest.api.compute import base
|
||||
from tempest.common import utils
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class SecurityGroupsTestAdminJSON(base.BaseV2ComputeAdminTest):
|
||||
"""Test security groups API that requires admin privilege
|
||||
@ -57,9 +60,11 @@ class SecurityGroupsTestAdminJSON(base.BaseV2ComputeAdminTest):
|
||||
# List of all security groups created
|
||||
security_group_list = []
|
||||
# Create two security groups for a non-admin tenant
|
||||
prefix = CONF.resource_name_prefix
|
||||
for _ in range(2):
|
||||
name = data_utils.rand_name('securitygroup')
|
||||
description = data_utils.rand_name('description')
|
||||
name = data_utils.rand_name(prefix=prefix, name='securitygroup')
|
||||
description = data_utils.rand_name(
|
||||
prefix=prefix, name='description')
|
||||
securitygroup = self.client.create_security_group(
|
||||
name=name, description=description)['security_group']
|
||||
self.addCleanup(self._delete_security_group,
|
||||
@ -69,8 +74,9 @@ class SecurityGroupsTestAdminJSON(base.BaseV2ComputeAdminTest):
|
||||
client_tenant_id = securitygroup['tenant_id']
|
||||
# Create two security groups for admin tenant
|
||||
for _ in range(2):
|
||||
name = data_utils.rand_name('securitygroup')
|
||||
description = data_utils.rand_name('description')
|
||||
name = data_utils.rand_name(prefix=prefix, name='securitygroup')
|
||||
description = data_utils.rand_name(
|
||||
prefix=prefix, name='description')
|
||||
adm_securitygroup = self.adm_client.create_security_group(
|
||||
name=name, description=description)['security_group']
|
||||
self.addCleanup(self._delete_security_group,
|
||||
|
@ -37,11 +37,14 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
def resource_setup(cls):
|
||||
super(ServersAdminTestJSON, cls).resource_setup()
|
||||
|
||||
cls.s1_name = data_utils.rand_name(cls.__name__ + '-server')
|
||||
prefix = CONF.resource_name_prefix
|
||||
cls.s1_name = data_utils.rand_name(prefix=prefix,
|
||||
name=cls.__name__ + '-server')
|
||||
server = cls.create_test_server(name=cls.s1_name)
|
||||
cls.s1_id = server['id']
|
||||
|
||||
cls.s2_name = data_utils.rand_name(cls.__name__ + '-server')
|
||||
cls.s2_name = data_utils.rand_name(prefix=prefix,
|
||||
name=cls.__name__ + '-server')
|
||||
server = cls.create_test_server(name=cls.s2_name,
|
||||
wait_until='ACTIVE')
|
||||
cls.s2_id = server['id']
|
||||
|
@ -223,7 +223,9 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
|
||||
`compute.create_test_server` call.
|
||||
"""
|
||||
if 'name' not in kwargs:
|
||||
kwargs['name'] = data_utils.rand_name(cls.__name__ + "-server")
|
||||
kwargs['name'] = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=cls.__name__ + "-server")
|
||||
|
||||
request_version = api_version_request.APIVersionRequest(
|
||||
cls.request_microversion)
|
||||
@ -260,10 +262,13 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
|
||||
|
||||
@classmethod
|
||||
def create_security_group(cls, name=None, description=None):
|
||||
prefix = CONF.resource_name_prefix
|
||||
if name is None:
|
||||
name = data_utils.rand_name(cls.__name__ + "-securitygroup")
|
||||
name = data_utils.rand_name(
|
||||
prefix=prefix, name=cls.__name__ + "-securitygroup")
|
||||
if description is None:
|
||||
description = data_utils.rand_name('description')
|
||||
description = data_utils.rand_name(
|
||||
prefix=prefix, name='description')
|
||||
body = cls.security_groups_client.create_security_group(
|
||||
name=name, description=description)['security_group']
|
||||
cls.addClassResourceCleanup(
|
||||
@ -276,7 +281,9 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
|
||||
@classmethod
|
||||
def create_test_server_group(cls, name="", policy=None):
|
||||
if not name:
|
||||
name = data_utils.rand_name(cls.__name__ + "-Server-Group")
|
||||
name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=cls.__name__ + "-Server-Group")
|
||||
if cls.is_requested_microversion_compatible('2.63'):
|
||||
policy = policy or ['affinity']
|
||||
if not isinstance(policy, list):
|
||||
@ -324,8 +331,11 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
|
||||
If compute microversion >= 2.36, the returned image response will
|
||||
be from the image service API rather than the compute image proxy API.
|
||||
"""
|
||||
name = kwargs.pop('name',
|
||||
data_utils.rand_name(cls.__name__ + "-image"))
|
||||
name = kwargs.pop(
|
||||
'name',
|
||||
data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=cls.__name__ + "-image"))
|
||||
wait_until = kwargs.pop('wait_until', None)
|
||||
wait_for_server = kwargs.pop('wait_for_server', True)
|
||||
|
||||
@ -501,7 +511,9 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
|
||||
if 'size' not in kwargs:
|
||||
kwargs['size'] = CONF.volume.volume_size
|
||||
if 'display_name' not in kwargs:
|
||||
vol_name = data_utils.rand_name(cls.__name__ + '-volume')
|
||||
vol_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=cls.__name__ + '-volume')
|
||||
kwargs['display_name'] = vol_name
|
||||
if image_ref is not None:
|
||||
kwargs['imageRef'] = image_ref
|
||||
@ -595,7 +607,8 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
|
||||
def create_volume_snapshot(self, volume_id, name=None, description=None,
|
||||
metadata=None, force=False):
|
||||
name = name or data_utils.rand_name(
|
||||
self.__class__.__name__ + '-snapshot')
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__ + '-snapshot')
|
||||
snapshot = self.snapshots_client.create_snapshot(
|
||||
volume_id=volume_id,
|
||||
force=force,
|
||||
@ -652,7 +665,9 @@ class BaseV2ComputeAdminTest(BaseV2ComputeTest):
|
||||
def create_flavor(self, ram, vcpus, disk, name=None,
|
||||
is_public='True', **kwargs):
|
||||
if name is None:
|
||||
name = data_utils.rand_name(self.__class__.__name__ + "-flavor")
|
||||
name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__ + "-flavor")
|
||||
id = kwargs.pop('id', data_utils.rand_int_id(start=1000))
|
||||
client = self.admin_flavors_client
|
||||
flavor = client.create_flavor(
|
||||
|
@ -44,7 +44,8 @@ class FlavorsV2NegativeTest(base.BaseV2ComputeTest):
|
||||
size = random.randint(1024, 4096)
|
||||
image_file = io.BytesIO(data_utils.random_bytes(size))
|
||||
params = {
|
||||
'name': data_utils.rand_name('image'),
|
||||
'name': data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='image'),
|
||||
'container_format': CONF.image.container_formats[0],
|
||||
'disk_format': CONF.image.disk_formats[0],
|
||||
'min_ram': min_img_ram,
|
||||
|
@ -52,9 +52,12 @@ class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
|
||||
def resource_setup(cls):
|
||||
super(ImagesMetadataTestJSON, cls).resource_setup()
|
||||
cls.image_id = None
|
||||
|
||||
image_name_kwargs = {
|
||||
'prefix': CONF.resource_name_prefix,
|
||||
'name': 'image'
|
||||
}
|
||||
params = {
|
||||
'name': data_utils.rand_name('image'),
|
||||
'name': data_utils.rand_name(**image_name_kwargs),
|
||||
'container_format': 'bare',
|
||||
'disk_format': 'raw',
|
||||
'visibility': 'private'
|
||||
|
@ -57,7 +57,8 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
|
||||
# in task_state image_snapshot
|
||||
self.addCleanup(waiters.wait_for_server_status, self.servers_client,
|
||||
server['id'], 'ACTIVE')
|
||||
snapshot_name = data_utils.rand_name('test-snap')
|
||||
snapshot_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='test-snap')
|
||||
try:
|
||||
image = self.create_image_from_server(server['id'],
|
||||
name=snapshot_name,
|
||||
@ -83,7 +84,8 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
|
||||
waiters.wait_for_server_status(self.servers_client,
|
||||
server['id'], 'SHUTOFF')
|
||||
self.addCleanup(self.servers_client.delete_server, server['id'])
|
||||
snapshot_name = data_utils.rand_name('test-snap')
|
||||
snapshot_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='test-snap')
|
||||
image = self.create_image_from_server(server['id'],
|
||||
name=snapshot_name,
|
||||
wait_until='ACTIVE',
|
||||
@ -102,7 +104,8 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
|
||||
server['id'], 'PAUSED')
|
||||
self.addCleanup(self.servers_client.delete_server, server['id'])
|
||||
|
||||
snapshot_name = data_utils.rand_name('test-snap')
|
||||
snapshot_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='test-snap')
|
||||
image = self.create_image_from_server(server['id'],
|
||||
name=snapshot_name,
|
||||
wait_until='ACTIVE',
|
||||
@ -121,7 +124,8 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
|
||||
server['id'], 'SUSPENDED')
|
||||
self.addCleanup(self.servers_client.delete_server, server['id'])
|
||||
|
||||
snapshot_name = data_utils.rand_name('test-snap')
|
||||
snapshot_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='test-snap')
|
||||
image = self.create_image_from_server(server['id'],
|
||||
name=snapshot_name,
|
||||
wait_until='ACTIVE',
|
||||
@ -136,7 +140,8 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
|
||||
self.addCleanup(self.servers_client.delete_server, server['id'])
|
||||
|
||||
# Snapshot it
|
||||
snapshot_name = data_utils.rand_name('test-snap')
|
||||
snapshot_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='test-snap')
|
||||
image = self.create_image_from_server(server['id'],
|
||||
name=snapshot_name,
|
||||
wait_until='ACTIVE',
|
||||
|
@ -66,8 +66,12 @@ class ImagesNegativeTestJSON(ImagesNegativeTestBase):
|
||||
"""Check server image should not be created with invalid server id"""
|
||||
# Create a new image with invalid server id
|
||||
meta = {'image_type': 'test'}
|
||||
self.assertRaises(lib_exc.NotFound, self.create_image_from_server,
|
||||
data_utils.rand_name('invalid'), metadata=meta)
|
||||
self.assertRaises(
|
||||
lib_exc.NotFound,
|
||||
self.create_image_from_server,
|
||||
data_utils.rand_name(prefix=CONF.resource_name_prefix,
|
||||
name='invalid'),
|
||||
metadata=meta)
|
||||
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('ec176029-73dc-4037-8d72-2e4ff60cf538')
|
||||
@ -76,7 +80,8 @@ class ImagesNegativeTestJSON(ImagesNegativeTestBase):
|
||||
|
||||
Return an error if server id passed is 35 characters or less
|
||||
"""
|
||||
snapshot_name = data_utils.rand_name('test-snap')
|
||||
snapshot_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='test-snap')
|
||||
test_uuid = ('a' * 35)
|
||||
self.assertRaises(lib_exc.NotFound, self.client.create_image,
|
||||
test_uuid, name=snapshot_name)
|
||||
@ -88,7 +93,8 @@ class ImagesNegativeTestJSON(ImagesNegativeTestBase):
|
||||
|
||||
Return an error if sever id passed is 37 characters or more
|
||||
"""
|
||||
snapshot_name = data_utils.rand_name('test-snap')
|
||||
snapshot_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='test-snap')
|
||||
test_uuid = ('a' * 37)
|
||||
self.assertRaises(lib_exc.NotFound, self.client.create_image,
|
||||
test_uuid, name=snapshot_name)
|
||||
@ -105,8 +111,10 @@ class ImagesDeleteNegativeTestJSON(ImagesNegativeTestBase):
|
||||
@decorators.idempotent_id('381acb65-785a-4942-94ce-d8f8c84f1f0f')
|
||||
def test_delete_image_with_invalid_image_id(self):
|
||||
"""Check an image should not be deleted with invalid image id"""
|
||||
self.assertRaises(lib_exc.NotFound, self.client.delete_image,
|
||||
data_utils.rand_name('invalid'))
|
||||
self.assertRaises(
|
||||
lib_exc.NotFound, self.client.delete_image,
|
||||
data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='invalid'))
|
||||
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('137aef61-39f7-44a1-8ddf-0adf82511701')
|
||||
|
@ -66,7 +66,8 @@ class ImagesOneServerTestJSON(base.BaseV2ComputeTest):
|
||||
MIN_RAM = 'min_ram'
|
||||
|
||||
# Create a new image
|
||||
name = data_utils.rand_name('image')
|
||||
name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='image')
|
||||
meta = {'image_type': 'test'}
|
||||
image = self.create_image_from_server(self.server_id, name=name,
|
||||
metadata=meta,
|
||||
@ -104,6 +105,8 @@ class ImagesOneServerTestJSON(base.BaseV2ComputeTest):
|
||||
# We use a string with 3 byte utf-8 character due to nova/glance which
|
||||
# will return 400(Bad Request) if we attempt to send a name which has
|
||||
# 4 byte utf-8 character.
|
||||
utf8_name = data_utils.rand_name(b'\xe2\x82\xa1'.decode('utf-8'))
|
||||
utf8_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=b'\xe2\x82\xa1'.decode('utf-8'))
|
||||
self.create_image_from_server(self.server_id, name=utf8_name,
|
||||
wait_until='ACTIVE')
|
||||
|
@ -56,8 +56,12 @@ class ListImageFiltersTestJSON(base.BaseV2ComputeTest):
|
||||
super(ListImageFiltersTestJSON, cls).resource_setup()
|
||||
|
||||
def _create_image():
|
||||
image_name_kwargs = {
|
||||
'prefix': CONF.resource_name_prefix,
|
||||
'name': cls.__name__ + '-image'
|
||||
}
|
||||
params = {
|
||||
'name': data_utils.rand_name(cls.__name__ + '-image'),
|
||||
'name': data_utils.rand_name(**image_name_kwargs),
|
||||
'container_format': 'bare',
|
||||
'disk_format': 'raw',
|
||||
'visibility': 'private'
|
||||
|
@ -14,8 +14,11 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.compute import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class BaseKeypairTest(base.BaseV2ComputeTest):
|
||||
"""Base test case class for all keypair API tests."""
|
||||
@ -32,7 +35,8 @@ class BaseKeypairTest(base.BaseV2ComputeTest):
|
||||
client = self.keypairs_client
|
||||
if keypair_name is None:
|
||||
keypair_name = data_utils.rand_name(
|
||||
self.__class__.__name__ + '-keypair')
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__ + '-keypair')
|
||||
kwargs = {'name': keypair_name}
|
||||
delete_params = {}
|
||||
if pub_key:
|
||||
|
@ -14,9 +14,12 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.compute.keypairs import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class KeyPairsV2TestJSON(base.BaseKeypairTest):
|
||||
"""Test keypairs API with compute microversion less than 2.2"""
|
||||
@ -54,7 +57,8 @@ class KeyPairsV2TestJSON(base.BaseKeypairTest):
|
||||
@decorators.idempotent_id('6c1d3123-4519-4742-9194-622cb1714b7d')
|
||||
def test_keypair_create_delete(self):
|
||||
"""Test create/delete keypair"""
|
||||
k_name = data_utils.rand_name('keypair')
|
||||
k_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='keypair')
|
||||
keypair = self.create_keypair(k_name)
|
||||
key_name = keypair['name']
|
||||
self.assertEqual(key_name, k_name,
|
||||
@ -64,7 +68,8 @@ class KeyPairsV2TestJSON(base.BaseKeypairTest):
|
||||
@decorators.idempotent_id('a4233d5d-52d8-47cc-9a25-e1864527e3df')
|
||||
def test_get_keypair_detail(self):
|
||||
"""Test getting keypair detail by keypair name"""
|
||||
k_name = data_utils.rand_name('keypair')
|
||||
k_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='keypair')
|
||||
self.create_keypair(k_name)
|
||||
keypair_detail = self.keypairs_client.show_keypair(k_name)['keypair']
|
||||
self.assertEqual(keypair_detail['name'], k_name,
|
||||
@ -74,7 +79,8 @@ class KeyPairsV2TestJSON(base.BaseKeypairTest):
|
||||
@decorators.idempotent_id('39c90c6a-304a-49dd-95ec-2366129def05')
|
||||
def test_keypair_create_with_pub_key(self):
|
||||
"""Test creating keypair with a given public key"""
|
||||
k_name = data_utils.rand_name('keypair')
|
||||
k_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='keypair')
|
||||
pub_key = ("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs"
|
||||
"Ne3/1ILNCqFyfYWDeTKLD6jEXC2OQHLmietMWW+/vd"
|
||||
"aZq7KZEwO0jhglaFjU1mpqq4Gz5RX156sCTNM9vRbw"
|
||||
|
@ -15,10 +15,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.compute.keypairs import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class KeyPairsNegativeTestJSON(base.BaseKeypairTest):
|
||||
"""Negative tests of keypairs API"""
|
||||
@ -35,7 +38,9 @@ class KeyPairsNegativeTestJSON(base.BaseKeypairTest):
|
||||
@decorators.idempotent_id('7cc32e47-4c42-489d-9623-c5e2cb5a2fa5')
|
||||
def test_keypair_delete_nonexistent_key(self):
|
||||
"""Test non-existent key deletion should throw a proper error"""
|
||||
k_name = data_utils.rand_name("keypair-non-existent")
|
||||
k_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name="keypair-non-existent")
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
self.keypairs_client.delete_keypair,
|
||||
k_name)
|
||||
@ -60,7 +65,8 @@ class KeyPairsNegativeTestJSON(base.BaseKeypairTest):
|
||||
@decorators.idempotent_id('0359a7f1-f002-4682-8073-0c91e4011b7c')
|
||||
def test_create_keypair_with_duplicate_name(self):
|
||||
"""Test keypairs with duplicate names should not be created"""
|
||||
k_name = data_utils.rand_name('keypair')
|
||||
k_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='keypair')
|
||||
self.keypairs_client.create_keypair(name=k_name)
|
||||
# Now try the same keyname to create another key
|
||||
self.assertRaises(lib_exc.Conflict, self.create_keypair,
|
||||
|
@ -13,9 +13,12 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.compute.keypairs import test_keypairs
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class KeyPairsV22TestJSON(test_keypairs.KeyPairsV2TestJSON):
|
||||
"""Test keypairs API with compute microversion greater than 2.1"""
|
||||
@ -29,7 +32,8 @@ class KeyPairsV22TestJSON(test_keypairs.KeyPairsV2TestJSON):
|
||||
self.assertEqual(keypair_type, keypair['type'])
|
||||
|
||||
def _test_keypairs_create_list_show(self, keypair_type=None):
|
||||
k_name = data_utils.rand_name('keypair')
|
||||
k_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='keypair')
|
||||
keypair = self.create_keypair(k_name, keypair_type=keypair_type)
|
||||
# Verify whether 'type' is present in keypair create response of
|
||||
# version 2.2 and it is with default value 'ssh'.
|
||||
|
@ -14,10 +14,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.compute.security_groups import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class SecurityGroupRulesNegativeTestJSON(base.BaseSecurityGroupsTest):
|
||||
"""Negative tests of security group rules API
|
||||
@ -59,7 +62,8 @@ class SecurityGroupRulesNegativeTestJSON(base.BaseSecurityGroupsTest):
|
||||
with parent group id which is not integer.
|
||||
"""
|
||||
# Adding rules to the non int Security Group id
|
||||
parent_group_id = data_utils.rand_name('non_int_id')
|
||||
parent_group_id = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='non_int_id')
|
||||
ip_protocol = 'tcp'
|
||||
from_port = 22
|
||||
to_port = 22
|
||||
@ -105,7 +109,8 @@ class SecurityGroupRulesNegativeTestJSON(base.BaseSecurityGroupsTest):
|
||||
sg = self.create_security_group()
|
||||
# Adding rules to the created Security Group
|
||||
parent_group_id = sg['id']
|
||||
ip_protocol = data_utils.rand_name('999')
|
||||
ip_protocol = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='999')
|
||||
from_port = 22
|
||||
to_port = 22
|
||||
|
||||
|
@ -15,10 +15,13 @@
|
||||
|
||||
from tempest.api.compute.security_groups import base
|
||||
from tempest.common import waiters
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class SecurityGroupsTestJSON(base.BaseSecurityGroupsTest):
|
||||
"""Test security groups API with compute microversion less than 2.36"""
|
||||
@ -69,7 +72,8 @@ class SecurityGroupsTestJSON(base.BaseSecurityGroupsTest):
|
||||
Security group should be created, fetched and deleted
|
||||
with char space between name along with leading and trailing spaces.
|
||||
"""
|
||||
s_name = ' %s ' % data_utils.rand_name('securitygroup ')
|
||||
s_name = ' %s ' % data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='securitygroup ')
|
||||
securitygroup = self.create_security_group(name=s_name)
|
||||
securitygroup_name = securitygroup['name']
|
||||
self.assertEqual(securitygroup_name, s_name,
|
||||
@ -133,8 +137,9 @@ class SecurityGroupsTestJSON(base.BaseSecurityGroupsTest):
|
||||
securitygroup = self.create_security_group()
|
||||
securitygroup_id = securitygroup['id']
|
||||
# Update the name and description
|
||||
s_new_name = data_utils.rand_name('sg-hth')
|
||||
s_new_des = data_utils.rand_name('description-hth')
|
||||
prefix = CONF.resource_name_prefix
|
||||
s_new_name = data_utils.rand_name(prefix=prefix, name='sg-hth')
|
||||
s_new_des = data_utils.rand_name(prefix=prefix, name='description-hth')
|
||||
self.client.update_security_group(securitygroup_id,
|
||||
name=s_new_name,
|
||||
description=s_new_des)
|
||||
|
@ -55,7 +55,8 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest):
|
||||
as an empty string, or group name with white spaces, or group name
|
||||
with chars more than 255.
|
||||
"""
|
||||
s_description = data_utils.rand_name('description')
|
||||
s_description = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='description')
|
||||
# Create Security Group with empty string as group name
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.client.create_security_group,
|
||||
@ -81,7 +82,8 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest):
|
||||
longer than 255 chars. Empty description is allowed by the API
|
||||
reference, however.
|
||||
"""
|
||||
s_name = data_utils.rand_name('securitygroup')
|
||||
s_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='securitygroup')
|
||||
# Create Security Group with group description longer than 255 chars
|
||||
s_description = 'description-'.ljust(260, '0')
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
@ -94,8 +96,10 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
def test_security_group_create_with_duplicate_name(self):
|
||||
"""Test creating security group with duplicate name should fail"""
|
||||
s_name = data_utils.rand_name('securitygroup')
|
||||
s_description = data_utils.rand_name('description')
|
||||
s_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='securitygroup')
|
||||
s_description = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='description')
|
||||
self.create_security_group(name=s_name, description=s_description)
|
||||
# Now try the Security Group with the same 'Name'
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
@ -138,10 +142,13 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
def test_update_security_group_with_invalid_sg_id(self):
|
||||
"""Test updating security group with invalid group id should fail"""
|
||||
s_name = data_utils.rand_name('sg')
|
||||
s_description = data_utils.rand_name('description')
|
||||
s_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='sg')
|
||||
s_description = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='description')
|
||||
# Create a non int sg_id
|
||||
sg_id_invalid = data_utils.rand_name('sg')
|
||||
sg_id_invalid = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='sg')
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.client.update_security_group, sg_id_invalid,
|
||||
name=s_name, description=s_description)
|
||||
@ -179,8 +186,10 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest):
|
||||
def test_update_non_existent_security_group(self):
|
||||
"""Test updating a non existent security group should fail"""
|
||||
non_exist_id = self.generate_random_security_group_id()
|
||||
s_name = data_utils.rand_name('sg')
|
||||
s_description = data_utils.rand_name('description')
|
||||
s_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='sg')
|
||||
s_description = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='description')
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
self.client.update_security_group,
|
||||
non_exist_id, name=s_name,
|
||||
|
@ -161,7 +161,9 @@ class AttachInterfacesTestJSON(AttachInterfacesTestBase):
|
||||
network_id = ifs[0]['net_id']
|
||||
port = self.ports_client.create_port(
|
||||
network_id=network_id,
|
||||
name=data_utils.rand_name(self.__class__.__name__))
|
||||
name=data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__))
|
||||
port_id = port['port']['id']
|
||||
self.addCleanup(self.ports_client.delete_port, port_id)
|
||||
iface = self.interfaces_client.create_interface(
|
||||
@ -324,7 +326,9 @@ class AttachInterfacesTestJSON(AttachInterfacesTestBase):
|
||||
|
||||
port = self.ports_client.create_port(
|
||||
network_id=network_id,
|
||||
name=data_utils.rand_name(self.__class__.__name__))
|
||||
name=data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__))
|
||||
port_id = port['port']['id']
|
||||
self.addCleanup(self.ports_client.delete_port, port_id)
|
||||
|
||||
|
@ -53,7 +53,9 @@ 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 = data_utils.rand_name(cls.__name__ + '-server')
|
||||
cls.name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=cls.__name__ + '-server')
|
||||
cls.password = data_utils.rand_password()
|
||||
disk_config = cls.disk_config
|
||||
server_initial = cls.create_test_server(
|
||||
|
@ -67,7 +67,9 @@ class ServersTestMultiNic(base.BaseV2ComputeTest):
|
||||
cls.subnets_client = cls.os_primary.subnets_client
|
||||
|
||||
def _create_net_subnet_ret_net_from_cidr(self, cidr):
|
||||
name_net = data_utils.rand_name(self.__class__.__name__)
|
||||
name_net = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__)
|
||||
net = self.networks_client.create_network(name=name_net)
|
||||
self.addCleanup(self.networks_client.delete_network,
|
||||
net['network']['id'])
|
||||
|
@ -172,11 +172,15 @@ class TaggedBootDevicesTest(DeviceTaggingBase):
|
||||
|
||||
# Create networks
|
||||
net1 = self.networks_client.create_network(
|
||||
name=data_utils.rand_name('device-tagging-net1'))['network']
|
||||
name=data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name='device-tagging-net1'))['network']
|
||||
self.addCleanup(self.networks_client.delete_network, net1['id'])
|
||||
|
||||
net2 = self.networks_client.create_network(
|
||||
name=data_utils.rand_name('device-tagging-net2'))['network']
|
||||
name=data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name='device-tagging-net2'))['network']
|
||||
self.addCleanup(self.networks_client.delete_network, net2['id'])
|
||||
|
||||
# Create subnets
|
||||
@ -195,13 +199,17 @@ class TaggedBootDevicesTest(DeviceTaggingBase):
|
||||
# Create ports
|
||||
self.port1 = self.ports_client.create_port(
|
||||
network_id=net1['id'],
|
||||
name=data_utils.rand_name(self.__class__.__name__),
|
||||
name=data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__),
|
||||
fixed_ips=[{'subnet_id': subnet1['id']}])['port']
|
||||
self.addCleanup(self.ports_client.delete_port, self.port1['id'])
|
||||
|
||||
self.port2 = self.ports_client.create_port(
|
||||
network_id=net1['id'],
|
||||
name=data_utils.rand_name(self.__class__.__name__),
|
||||
name=data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__),
|
||||
fixed_ips=[{'subnet_id': subnet1['id']}])['port']
|
||||
self.addCleanup(self.ports_client.delete_port, self.port2['id'])
|
||||
|
||||
@ -215,7 +223,9 @@ class TaggedBootDevicesTest(DeviceTaggingBase):
|
||||
wait_until='SSHABLE',
|
||||
validation_resources=validation_resources,
|
||||
config_drive=config_drive_enabled,
|
||||
name=data_utils.rand_name('device-tagging-server'),
|
||||
name=data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name='device-tagging-server'),
|
||||
networks=[
|
||||
# Validation network for ssh
|
||||
{
|
||||
@ -378,7 +388,8 @@ class TaggedAttachmentsTest(DeviceTaggingBase):
|
||||
# Create network
|
||||
net = self.networks_client.create_network(
|
||||
name=data_utils.rand_name(
|
||||
'tagged-attachments-test-net'))['network']
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name='tagged-attachments-test-net'))['network']
|
||||
self.addCleanup(self.networks_client.delete_network, net['id'])
|
||||
|
||||
# Create subnet
|
||||
@ -400,7 +411,9 @@ class TaggedAttachmentsTest(DeviceTaggingBase):
|
||||
validatable=True,
|
||||
validation_resources=validation_resources,
|
||||
config_drive=config_drive_enabled,
|
||||
name=data_utils.rand_name('device-tagging-server'),
|
||||
name=data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name='device-tagging-server'),
|
||||
networks=[{'uuid': self.get_tenant_network()['id']}],
|
||||
wait_until='SSHABLE')
|
||||
self.addCleanup(self.delete_server, server['id'])
|
||||
|
@ -48,17 +48,23 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
|
||||
else:
|
||||
cls.fixed_network_name = None
|
||||
network_kwargs = fixed_network.set_networks_kwarg(network)
|
||||
cls.s1_name = data_utils.rand_name(cls.__name__ + '-instance')
|
||||
cls.s1_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=cls.__name__ + '-instance')
|
||||
cls.s1 = cls.create_test_server(name=cls.s1_name, **network_kwargs)
|
||||
|
||||
cls.s2_name = data_utils.rand_name(cls.__name__ + '-instance')
|
||||
cls.s2_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=cls.__name__ + '-instance')
|
||||
# If image_ref_alt is "" or None then we still want to boot a server
|
||||
# but we rely on `testtools.skipUnless` decorator to actually skip
|
||||
# the irrelevant tests.
|
||||
cls.s2 = cls.create_test_server(
|
||||
name=cls.s2_name, image_id=cls.image_ref_alt or cls.image_ref)
|
||||
|
||||
cls.s3_name = data_utils.rand_name(cls.__name__ + '-instance')
|
||||
cls.s3_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=cls.__name__ + '-instance')
|
||||
cls.s3 = cls.create_test_server(name=cls.s3_name,
|
||||
flavor=cls.flavor_ref_alt,
|
||||
wait_until='ACTIVE')
|
||||
|
@ -133,7 +133,9 @@ class ServerActionsBase(base.BaseV2ComputeTest):
|
||||
['addresses'])
|
||||
# The server should be rebuilt using the provided image and data
|
||||
meta = {'rebuild': 'server'}
|
||||
new_name = data_utils.rand_name(self.__class__.__name__ + '-server')
|
||||
new_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__ + '-server')
|
||||
password = 'rebuildPassw0rd'
|
||||
rebuilt_server = self.client.rebuild_server(
|
||||
server_id,
|
||||
@ -575,7 +577,8 @@ class ServerActionsTestOtherB(ServerActionsBase):
|
||||
raise lib_exc.InvalidConfiguration(
|
||||
'api_v2 must be True in [image-feature-enabled].')
|
||||
|
||||
backup1 = data_utils.rand_name('backup-1')
|
||||
backup1 = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='backup-1')
|
||||
resp = self.client.create_backup(self.server_id,
|
||||
backup_type='daily',
|
||||
rotation=2,
|
||||
@ -603,7 +606,8 @@ class ServerActionsTestOtherB(ServerActionsBase):
|
||||
waiters.wait_for_image_status(glance_client,
|
||||
image1_id, 'active')
|
||||
|
||||
backup2 = data_utils.rand_name('backup-2')
|
||||
backup2 = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='backup-2')
|
||||
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
|
||||
resp = self.client.create_backup(self.server_id,
|
||||
backup_type='daily',
|
||||
@ -639,7 +643,8 @@ class ServerActionsTestOtherB(ServerActionsBase):
|
||||
|
||||
# create the third one, due to the rotation is 2,
|
||||
# the first one will be deleted
|
||||
backup3 = data_utils.rand_name('backup-3')
|
||||
backup3 = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='backup-3')
|
||||
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
|
||||
resp = self.client.create_backup(self.server_id,
|
||||
backup_type='daily',
|
||||
@ -796,7 +801,8 @@ class ServersAaction247Test(base.BaseV2ComputeTest):
|
||||
def test_create_backup(self):
|
||||
server = self.create_test_server(wait_until='ACTIVE')
|
||||
|
||||
backup1 = data_utils.rand_name('backup-1')
|
||||
backup1 = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='backup-1')
|
||||
# Just check create_back to verify the schema with 2.47
|
||||
self.servers_client.create_backup(server['id'],
|
||||
backup_type='daily',
|
||||
@ -859,7 +865,9 @@ class ServerActionsV293TestJSON(base.BaseV2ComputeTest):
|
||||
|
||||
# The server should be rebuilt using the provided image and data
|
||||
meta = {'rebuild': 'server'}
|
||||
new_name = data_utils.rand_name(self.__class__.__name__ + '-server')
|
||||
new_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__ + '-server')
|
||||
password = 'rebuildPassw0rd'
|
||||
rebuilt_server = self.servers_client.rebuild_server(
|
||||
server['id'],
|
||||
|
@ -17,9 +17,12 @@ import testtools
|
||||
|
||||
from tempest.api.compute import base
|
||||
from tempest.common import compute
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ServerGroupTestJSON(base.BaseV2ComputeTest):
|
||||
"""These tests check for the server-group APIs.
|
||||
@ -80,7 +83,8 @@ class ServerGroupTestJSON(base.BaseV2ComputeTest):
|
||||
|
||||
def _create_delete_server_group(self, policy):
|
||||
# Create and Delete the server-group with given policy
|
||||
name = data_utils.rand_name('server-group')
|
||||
name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='server-group')
|
||||
server_group = self._create_server_group(name, policy)
|
||||
self._delete_server_group(server_group)
|
||||
|
||||
@ -99,7 +103,8 @@ class ServerGroupTestJSON(base.BaseV2ComputeTest):
|
||||
def test_create_delete_multiple_server_groups_with_same_name_policy(self):
|
||||
"""Test Create/Delete the server-groups with same name and policy"""
|
||||
server_groups = []
|
||||
server_group_name = data_utils.rand_name('server-group')
|
||||
server_group_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='server-group')
|
||||
for _ in range(0, 2):
|
||||
server_groups.append(self._create_server_group(server_group_name,
|
||||
self.policy))
|
||||
|
@ -14,9 +14,12 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.compute import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ServerTagsTestJSON(base.BaseV2ComputeTest):
|
||||
"""Test server tags with compute microversion greater than 2.25"""
|
||||
@ -51,7 +54,8 @@ class ServerTagsTestJSON(base.BaseV2ComputeTest):
|
||||
self.assertEmpty(fetched_tags)
|
||||
|
||||
# Add server tag to the server.
|
||||
assigned_tag = data_utils.rand_name('tag')
|
||||
assigned_tag = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='tag')
|
||||
self._update_server_tags(self.server['id'], assigned_tag)
|
||||
|
||||
# Check that added tag exists.
|
||||
@ -67,11 +71,16 @@ class ServerTagsTestJSON(base.BaseV2ComputeTest):
|
||||
def test_update_all_tags(self):
|
||||
"""Test updating all server tags"""
|
||||
# Add server tags to the server.
|
||||
tags = [data_utils.rand_name('tag'), data_utils.rand_name('tag')]
|
||||
kwargs = {
|
||||
'prefix': CONF.resource_name_prefix,
|
||||
'name': 'tag'
|
||||
}
|
||||
tags = [data_utils.rand_name(**kwargs), data_utils.rand_name(**kwargs)]
|
||||
self._update_server_tags(self.server['id'], tags)
|
||||
|
||||
# Replace tags with new tags and check that they are present.
|
||||
new_tags = [data_utils.rand_name('tag'), data_utils.rand_name('tag')]
|
||||
new_tags = [data_utils.rand_name(**kwargs),
|
||||
data_utils.rand_name(**kwargs)]
|
||||
replaced_tags = self.client.update_all_tags(
|
||||
self.server['id'], new_tags)['tags']
|
||||
self.assertCountEqual(new_tags, replaced_tags)
|
||||
@ -83,9 +92,13 @@ class ServerTagsTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.idempotent_id('a63b2a74-e918-4b7c-bcab-10c855f3a57e')
|
||||
def test_delete_all_tags(self):
|
||||
"""Test deleting all server tags"""
|
||||
kwargs = {
|
||||
'prefix': CONF.resource_name_prefix,
|
||||
'name': 'tag'
|
||||
}
|
||||
# Add server tags to the server.
|
||||
assigned_tags = [data_utils.rand_name('tag'),
|
||||
data_utils.rand_name('tag')]
|
||||
assigned_tags = [data_utils.rand_name(**kwargs),
|
||||
data_utils.rand_name(**kwargs)]
|
||||
self._update_server_tags(self.server['id'], assigned_tags)
|
||||
|
||||
# Delete tags from the server and check that they were deleted.
|
||||
@ -97,7 +110,8 @@ class ServerTagsTestJSON(base.BaseV2ComputeTest):
|
||||
def test_check_tag_existence(self):
|
||||
"""Test checking server tag existence"""
|
||||
# Add server tag to the server.
|
||||
assigned_tag = data_utils.rand_name('tag')
|
||||
assigned_tag = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='tag')
|
||||
self._update_server_tags(self.server['id'], assigned_tag)
|
||||
|
||||
# Check that added tag exists. Throws a 404 if not found, else a 204,
|
||||
|
@ -60,7 +60,8 @@ class ServersTestJSON(base.BaseV2ComputeTest):
|
||||
"""Test creating a server with already existing name is allowed"""
|
||||
# TODO(sdague): clear out try, we do cleanup one layer up
|
||||
server_name = data_utils.rand_name(
|
||||
self.__class__.__name__ + '-server')
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__ + '-server')
|
||||
server = self.create_test_server(name=server_name,
|
||||
wait_until='ACTIVE')
|
||||
id1 = server['id']
|
||||
@ -79,7 +80,8 @@ class ServersTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.idempotent_id('f9e15296-d7f9-4e62-b53f-a04e89160833')
|
||||
def test_create_specify_keypair(self):
|
||||
"""Test creating server with keypair"""
|
||||
key_name = data_utils.rand_name('key')
|
||||
key_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='key')
|
||||
self.keypairs_client.create_keypair(name=key_name)
|
||||
self.addCleanup(self.keypairs_client.delete_keypair, key_name)
|
||||
self.keypairs_client.list_keypairs()
|
||||
@ -91,7 +93,8 @@ class ServersTestJSON(base.BaseV2ComputeTest):
|
||||
|
||||
def _update_server_name(self, server_id, status, prefix_name='server'):
|
||||
# The server name should be changed to the provided value
|
||||
new_name = data_utils.rand_name(prefix_name)
|
||||
new_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name=prefix_name)
|
||||
|
||||
# Update the server with a new name
|
||||
self.client.update_server(server_id,
|
||||
@ -159,7 +162,9 @@ class ServersTestJSON(base.BaseV2ComputeTest):
|
||||
will return 400(Bad Request) if we attempt to send a name which has
|
||||
4 byte utf-8 character.
|
||||
"""
|
||||
utf8_name = data_utils.rand_name(b'\xe2\x82\xa1'.decode('utf-8'))
|
||||
utf8_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=b'\xe2\x82\xa1'.decode('utf-8'))
|
||||
self.create_test_server(name=utf8_name, wait_until='ACTIVE')
|
||||
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
from tempest.api.compute import base
|
||||
from tempest.common import waiters
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
@ -30,6 +31,8 @@ from tempest.lib import decorators
|
||||
# their integration tests, you can add tests to cover those schema
|
||||
# in this file.
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ServerShowV254Test(base.BaseV2ComputeTest):
|
||||
"""Test servers API schema for compute microversion greater than 2.53"""
|
||||
@ -41,7 +44,8 @@ class ServerShowV254Test(base.BaseV2ComputeTest):
|
||||
"""Test rebuilding server with microversion greater than 2.53"""
|
||||
server = self.create_test_server(wait_until='ACTIVE')
|
||||
keypair_name = data_utils.rand_name(
|
||||
self.__class__.__name__ + '-keypair')
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__ + '-keypair')
|
||||
kwargs = {'name': keypair_name}
|
||||
self.keypairs_client.create_keypair(**kwargs)
|
||||
self.addCleanup(self.keypairs_client.delete_keypair,
|
||||
|
@ -267,7 +267,8 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
def test_create_with_non_existent_keypair(self):
|
||||
"""Creating a server with non-existent keypair should fail"""
|
||||
# Pass a non-existent keypair while creating a server
|
||||
key_name = data_utils.rand_name('key')
|
||||
key_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='key')
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.create_test_server,
|
||||
key_name=key_name)
|
||||
@ -288,7 +289,8 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
"""Updating name of a non-existent server should fail"""
|
||||
nonexistent_server = data_utils.rand_uuid()
|
||||
new_name = data_utils.rand_name(
|
||||
self.__class__.__name__ + '-server') + '_updated'
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__ + '-server') + '_updated'
|
||||
|
||||
self.assertRaises(lib_exc.NotFound, self.client.update_server,
|
||||
nonexistent_server, name=new_name)
|
||||
|
@ -53,7 +53,9 @@ class VolumesSnapshotsTestJSON(base.BaseV2ComputeTest):
|
||||
volume = self.create_volume()
|
||||
self.addCleanup(self.delete_volume, volume['id'])
|
||||
|
||||
s_name = data_utils.rand_name(self.__class__.__name__ + '-Snapshot')
|
||||
s_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__ + '-Snapshot')
|
||||
# Create snapshot
|
||||
snapshot = self.snapshots_client.create_snapshot(
|
||||
volume_id=volume['id'],
|
||||
|
@ -47,7 +47,9 @@ class VolumesGetTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.idempotent_id('f10f25eb-9775-4d9d-9cbe-1cf54dae9d5f')
|
||||
def test_volume_create_get_delete(self):
|
||||
"""Test create/get/delete volume"""
|
||||
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
|
||||
v_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__ + '-Volume')
|
||||
metadata = {'Type': 'work'}
|
||||
# Create volume
|
||||
volume = self.create_volume(size=CONF.volume.volume_size,
|
||||
|
@ -64,7 +64,9 @@ class VolumesNegativeTest(base.BaseV2ComputeTest):
|
||||
@decorators.idempotent_id('5125ae14-152b-40a7-b3c5-eae15e9022ef')
|
||||
def test_create_volume_with_invalid_size(self):
|
||||
"""Test creating volume with invalid size should fail"""
|
||||
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
|
||||
v_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__ + '-Volume')
|
||||
metadata = {'Type': 'work'}
|
||||
self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
|
||||
size='#$%', display_name=v_name, metadata=metadata)
|
||||
@ -73,7 +75,9 @@ class VolumesNegativeTest(base.BaseV2ComputeTest):
|
||||
@decorators.idempotent_id('131cb3a1-75cc-4d40-b4c3-1317f64719b0')
|
||||
def test_create_volume_without_passing_size(self):
|
||||
"""Test creating volume without specifying size should fail"""
|
||||
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
|
||||
v_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__ + '-Volume')
|
||||
metadata = {'Type': 'work'}
|
||||
self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
|
||||
size='', display_name=v_name, metadata=metadata)
|
||||
@ -82,7 +86,9 @@ class VolumesNegativeTest(base.BaseV2ComputeTest):
|
||||
@decorators.idempotent_id('8cce995e-0a83-479a-b94d-e1e40b8a09d1')
|
||||
def test_create_volume_with_size_zero(self):
|
||||
"""Test creating volume with size=0 should fail"""
|
||||
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
|
||||
v_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__ + '-Volume')
|
||||
metadata = {'Type': 'work'}
|
||||
self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
|
||||
size='0', display_name=v_name, metadata=metadata)
|
||||
@ -97,9 +103,11 @@ class VolumesNegativeTest(base.BaseV2ComputeTest):
|
||||
@decorators.idempotent_id('62972737-124b-4513-b6cf-2f019f178494')
|
||||
def test_delete_invalid_volume_id(self):
|
||||
"""Test deleting volume with an invalid volume id should fail"""
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
self.assertRaises(
|
||||
lib_exc.NotFound,
|
||||
self.client.delete_volume,
|
||||
data_utils.rand_name('invalid'))
|
||||
data_utils.rand_name(prefix=CONF.resource_name_prefix,
|
||||
name='invalid'))
|
||||
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('0d1417c5-4ae8-4c2c-adc5-5f0b864253e5')
|
||||
|
@ -14,9 +14,12 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class EndPointsTestJSON(base.BaseIdentityV2AdminTest):
|
||||
"""Test keystone v2 endpoints"""
|
||||
@ -24,9 +27,12 @@ class EndPointsTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(EndPointsTestJSON, cls).resource_setup()
|
||||
s_name = data_utils.rand_name('service')
|
||||
s_type = data_utils.rand_name('type')
|
||||
s_description = data_utils.rand_name('description')
|
||||
s_name = data_utils.rand_name(
|
||||
name='service', prefix=CONF.resource_name_prefix)
|
||||
s_type = data_utils.rand_name(
|
||||
name='type', prefix=CONF.resource_name_prefix)
|
||||
s_description = data_utils.rand_name(
|
||||
name='description', prefix=CONF.resource_name_prefix)
|
||||
service_data = cls.services_client.create_service(
|
||||
name=s_name, type=s_type,
|
||||
description=s_description)['OS-KSADM:service']
|
||||
@ -36,7 +42,8 @@ class EndPointsTestJSON(base.BaseIdentityV2AdminTest):
|
||||
# Create endpoints so as to use for LIST and GET test cases
|
||||
cls.setup_endpoints = list()
|
||||
for _ in range(2):
|
||||
region = data_utils.rand_name('region')
|
||||
region = data_utils.rand_name(
|
||||
name='region', prefix=CONF.resource_name_prefix)
|
||||
url = data_utils.rand_url()
|
||||
endpoint = cls.endpoints_client.create_endpoint(
|
||||
service_id=cls.service_id,
|
||||
@ -65,7 +72,8 @@ class EndPointsTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@decorators.idempotent_id('9974530a-aa28-4362-8403-f06db02b26c1')
|
||||
def test_create_list_delete_endpoint(self):
|
||||
"""Test creating, listing and deleting a keystone endpoint"""
|
||||
region = data_utils.rand_name('region')
|
||||
region = data_utils.rand_name(
|
||||
name='region', prefix=CONF.resource_name_prefix)
|
||||
url = data_utils.rand_url()
|
||||
endpoint = self.endpoints_client.create_endpoint(
|
||||
service_id=self.service_id,
|
||||
|
@ -14,10 +14,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class RolesTestJSON(base.BaseIdentityV2AdminTest):
|
||||
|
||||
@ -26,7 +29,8 @@ class RolesTestJSON(base.BaseIdentityV2AdminTest):
|
||||
super(RolesTestJSON, cls).resource_setup()
|
||||
cls.roles = list()
|
||||
for _ in range(5):
|
||||
role_name = data_utils.rand_name(name='role')
|
||||
role_name = data_utils.rand_name(
|
||||
name='role', prefix=CONF.resource_name_prefix)
|
||||
role = cls.roles_client.create_role(name=role_name)['role']
|
||||
cls.addClassResourceCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
@ -57,7 +61,8 @@ class RolesTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@decorators.idempotent_id('c62d909d-6c21-48c0-ae40-0a0760e6db5e')
|
||||
def test_role_create_delete(self):
|
||||
"""Role should be created, verified, and deleted."""
|
||||
role_name = data_utils.rand_name(name='role-test')
|
||||
role_name = data_utils.rand_name(
|
||||
name='role-test', prefix=CONF.resource_name_prefix)
|
||||
body = self.roles_client.create_role(name=role_name)['role']
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.roles_client.delete_role, body['id'])
|
||||
|
@ -14,10 +14,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
"""Negative tests of keystone roles via v2 API"""
|
||||
@ -55,7 +58,8 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@decorators.idempotent_id('585c8998-a8a4-4641-a5dd-abef7a8ced00')
|
||||
def test_create_role_by_unauthorized_user(self):
|
||||
"""Test non-admin user should not be able to create role via v2 API"""
|
||||
role_name = data_utils.rand_name(name='role')
|
||||
role_name = data_utils.rand_name(
|
||||
name='role', prefix=CONF.resource_name_prefix)
|
||||
self.assertRaises(lib_exc.Forbidden,
|
||||
self.non_admin_roles_client.create_role,
|
||||
name=role_name)
|
||||
@ -66,7 +70,8 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
"""Test creating role without a valid token via v2 API should fail"""
|
||||
token = self.client.auth_provider.get_token()
|
||||
self.client.delete_token(token)
|
||||
role_name = data_utils.rand_name(name='role')
|
||||
role_name = data_utils.rand_name(
|
||||
name='role', prefix=CONF.resource_name_prefix)
|
||||
self.assertRaises(lib_exc.Unauthorized,
|
||||
self.roles_client.create_role, name=role_name)
|
||||
self.client.auth_provider.clear_auth()
|
||||
@ -75,7 +80,8 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@decorators.idempotent_id('c0cde2c8-81c1-4bb0-8fe2-cf615a3547a8')
|
||||
def test_role_create_duplicate(self):
|
||||
"""Test role names should be unique via v2 API"""
|
||||
role_name = data_utils.rand_name(name='role-dup')
|
||||
role_name = data_utils.rand_name(
|
||||
name='role-dup', prefix=CONF.resource_name_prefix)
|
||||
body = self.roles_client.create_role(name=role_name)['role']
|
||||
role1_id = body.get('id')
|
||||
self.addCleanup(self.roles_client.delete_role, role1_id)
|
||||
@ -86,7 +92,8 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@decorators.idempotent_id('15347635-b5b1-4a87-a280-deb2bd6d865e')
|
||||
def test_delete_role_by_unauthorized_user(self):
|
||||
"""Test non-admin user should not be able to delete role via v2 API"""
|
||||
role_name = data_utils.rand_name(name='role')
|
||||
role_name = data_utils.rand_name(
|
||||
name='role', prefix=CONF.resource_name_prefix)
|
||||
body = self.roles_client.create_role(name=role_name)['role']
|
||||
self.addCleanup(self.roles_client.delete_role, body['id'])
|
||||
role_id = body.get('id')
|
||||
@ -97,7 +104,8 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@decorators.idempotent_id('44b60b20-70de-4dac-beaf-a3fc2650a16b')
|
||||
def test_delete_role_request_without_token(self):
|
||||
"""Test deleting role without a valid token via v2 API should fail"""
|
||||
role_name = data_utils.rand_name(name='role')
|
||||
role_name = data_utils.rand_name(
|
||||
name='role', prefix=CONF.resource_name_prefix)
|
||||
body = self.roles_client.create_role(name=role_name)['role']
|
||||
self.addCleanup(self.roles_client.delete_role, body['id'])
|
||||
role_id = body.get('id')
|
||||
|
@ -14,10 +14,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ServicesTestJSON(base.BaseIdentityV2AdminTest):
|
||||
"""Test identity services via v2 API"""
|
||||
@ -34,9 +37,12 @@ class ServicesTestJSON(base.BaseIdentityV2AdminTest):
|
||||
"""Test verifies the identity service create/get/delete via v2 API"""
|
||||
# GET Service
|
||||
# Creating a Service
|
||||
name = data_utils.rand_name('service')
|
||||
s_type = data_utils.rand_name('type')
|
||||
description = data_utils.rand_name('description')
|
||||
name = data_utils.rand_name(
|
||||
name='service', prefix=CONF.resource_name_prefix)
|
||||
s_type = data_utils.rand_name(
|
||||
name='type', prefix=CONF.resource_name_prefix)
|
||||
description = data_utils.rand_name(
|
||||
name='description', prefix=CONF.resource_name_prefix)
|
||||
service_data = self.services_client.create_service(
|
||||
name=name, type=s_type,
|
||||
description=description)['OS-KSADM:service']
|
||||
@ -70,8 +76,10 @@ class ServicesTestJSON(base.BaseIdentityV2AdminTest):
|
||||
|
||||
Create a service only with name and type.
|
||||
"""
|
||||
name = data_utils.rand_name('service')
|
||||
s_type = data_utils.rand_name('type')
|
||||
name = data_utils.rand_name(
|
||||
name='service', prefix=CONF.resource_name_prefix)
|
||||
s_type = data_utils.rand_name(
|
||||
name='type', prefix=CONF.resource_name_prefix)
|
||||
service = self.services_client.create_service(
|
||||
name=name, type=s_type)['OS-KSADM:service']
|
||||
self.assertIn('id', service)
|
||||
@ -87,9 +95,12 @@ class ServicesTestJSON(base.BaseIdentityV2AdminTest):
|
||||
"""Test Create/List/Verify/Delete of identity service via v2 API"""
|
||||
services = []
|
||||
for _ in range(3):
|
||||
name = data_utils.rand_name('service')
|
||||
s_type = data_utils.rand_name('type')
|
||||
description = data_utils.rand_name('description')
|
||||
name = data_utils.rand_name(
|
||||
name='service', prefix=CONF.resource_name_prefix)
|
||||
s_type = data_utils.rand_name(
|
||||
name='type', prefix=CONF.resource_name_prefix)
|
||||
description = data_utils.rand_name(
|
||||
name='description', prefix=CONF.resource_name_prefix)
|
||||
|
||||
service = self.services_client.create_service(
|
||||
name=name, type=s_type,
|
||||
|
@ -14,10 +14,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
"""Negative tests of keystone tenants via v2 API"""
|
||||
@ -77,7 +80,8 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@decorators.idempotent_id('af16f44b-a849-46cb-9f13-a751c388f739')
|
||||
def test_tenant_create_duplicate(self):
|
||||
"""Test tenant names should be unique via v2 API"""
|
||||
tenant_name = data_utils.rand_name(name='tenant')
|
||||
tenant_name = data_utils.rand_name(
|
||||
name='tenant', prefix=CONF.resource_name_prefix)
|
||||
self.setup_test_tenant(name=tenant_name)
|
||||
self.assertRaises(lib_exc.Conflict, self.tenants_client.create_tenant,
|
||||
name=tenant_name)
|
||||
@ -89,7 +93,8 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
|
||||
Non-admin user should not be authorized to create a tenant via v2 API.
|
||||
"""
|
||||
tenant_name = data_utils.rand_name(name='tenant')
|
||||
tenant_name = data_utils.rand_name(
|
||||
name='tenant', prefix=CONF.resource_name_prefix)
|
||||
self.assertRaises(lib_exc.Forbidden,
|
||||
self.non_admin_tenants_client.create_tenant,
|
||||
name=tenant_name)
|
||||
@ -98,7 +103,8 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@decorators.idempotent_id('a3ee9d7e-6920-4dd5-9321-d4b2b7f0a638')
|
||||
def test_create_tenant_request_without_token(self):
|
||||
"""Test creating tenant without a token via v2 API is not allowed"""
|
||||
tenant_name = data_utils.rand_name(name='tenant')
|
||||
tenant_name = data_utils.rand_name(
|
||||
name='tenant', prefix=CONF.resource_name_prefix)
|
||||
token = self.client.auth_provider.get_token()
|
||||
self.client.delete_token(token)
|
||||
self.assertRaises(lib_exc.Unauthorized,
|
||||
|
@ -14,9 +14,12 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class TenantsTestJSON(base.BaseIdentityV2AdminTest):
|
||||
"""Test identity tenants via v2 API"""
|
||||
@ -46,7 +49,8 @@ class TenantsTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@decorators.idempotent_id('d25e9f24-1310-4d29-b61b-d91299c21d6d')
|
||||
def test_tenant_create_with_description(self):
|
||||
"""Test creating tenant with a description via v2 API"""
|
||||
tenant_desc = data_utils.rand_name(name='desc')
|
||||
tenant_desc = data_utils.rand_name(
|
||||
name='desc', prefix=CONF.resource_name_prefix)
|
||||
tenant = self.setup_test_tenant(description=tenant_desc)
|
||||
tenant_id = tenant['id']
|
||||
desc1 = tenant['description']
|
||||
@ -83,12 +87,14 @@ class TenantsTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@decorators.idempotent_id('781f2266-d128-47f3-8bdb-f70970add238')
|
||||
def test_tenant_update_name(self):
|
||||
"""Test updating name attribute of a tenant via v2 API"""
|
||||
t_name1 = data_utils.rand_name(name='tenant')
|
||||
t_name1 = data_utils.rand_name(
|
||||
name='tenant', prefix=CONF.resource_name_prefix)
|
||||
tenant = self.setup_test_tenant(name=t_name1)
|
||||
t_id = tenant['id']
|
||||
resp1_name = tenant['name']
|
||||
|
||||
t_name2 = data_utils.rand_name(name='tenant2')
|
||||
t_name2 = data_utils.rand_name(
|
||||
name='tenant2', prefix=CONF.resource_name_prefix)
|
||||
body = self.tenants_client.update_tenant(t_id, name=t_name2)['tenant']
|
||||
resp2_name = body['name']
|
||||
self.assertNotEqual(resp1_name, resp2_name)
|
||||
@ -105,12 +111,14 @@ class TenantsTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@decorators.idempotent_id('859fcfe1-3a03-41ef-86f9-b19a47d1cd87')
|
||||
def test_tenant_update_desc(self):
|
||||
"""Test updating description attribute of a tenant via v2 API"""
|
||||
t_desc = data_utils.rand_name(name='desc')
|
||||
t_desc = data_utils.rand_name(
|
||||
name='desc', prefix=CONF.resource_name_prefix)
|
||||
tenant = self.setup_test_tenant(description=t_desc)
|
||||
t_id = tenant['id']
|
||||
resp1_desc = tenant['description']
|
||||
|
||||
t_desc2 = data_utils.rand_name(name='desc2')
|
||||
t_desc2 = data_utils.rand_name(
|
||||
name='desc2', prefix=CONF.resource_name_prefix)
|
||||
body = self.tenants_client.update_tenant(t_id, description=t_desc2)
|
||||
updated_tenant = body['tenant']
|
||||
resp2_desc = updated_tenant['description']
|
||||
|
@ -29,7 +29,8 @@ class TokensTestJSON(base.BaseIdentityV2AdminTest):
|
||||
def test_create_check_get_delete_token(self):
|
||||
"""Test getting create/check/get/delete token for user via v2 API"""
|
||||
# get a token by username and password
|
||||
user_name = data_utils.rand_name(name='user')
|
||||
user_name = data_utils.rand_name(
|
||||
name='user', prefix=CONF.resource_name_prefix)
|
||||
user_password = data_utils.rand_password()
|
||||
# first:create a tenant
|
||||
tenant = self.setup_test_tenant()
|
||||
@ -67,7 +68,8 @@ class TokensTestJSON(base.BaseIdentityV2AdminTest):
|
||||
"""
|
||||
|
||||
# Create a user.
|
||||
user_name = data_utils.rand_name(name='user')
|
||||
user_name = data_utils.rand_name(
|
||||
name='user', prefix=CONF.resource_name_prefix)
|
||||
user_password = data_utils.rand_password()
|
||||
tenant_id = None # No default tenant so will get unscoped token.
|
||||
user = self.create_test_user(name=user_name,
|
||||
@ -76,10 +78,12 @@ class TokensTestJSON(base.BaseIdentityV2AdminTest):
|
||||
email='')
|
||||
|
||||
# Create a couple tenants.
|
||||
tenant1_name = data_utils.rand_name(name='tenant')
|
||||
tenant1_name = data_utils.rand_name(
|
||||
name='tenant', prefix=CONF.resource_name_prefix)
|
||||
tenant1 = self.setup_test_tenant(name=tenant1_name)
|
||||
|
||||
tenant2_name = data_utils.rand_name(name='tenant')
|
||||
tenant2_name = data_utils.rand_name(
|
||||
name='tenant', prefix=CONF.resource_name_prefix)
|
||||
tenant2 = self.setup_test_tenant(name=tenant2_name)
|
||||
|
||||
# Create a role
|
||||
|
@ -18,9 +18,12 @@ import time
|
||||
from testtools import matchers
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class UsersTestJSON(base.BaseIdentityV2AdminTest):
|
||||
"""Test keystone users via v2 API"""
|
||||
@ -28,7 +31,8 @@ class UsersTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(UsersTestJSON, cls).resource_setup()
|
||||
cls.alt_user = data_utils.rand_name('test_user')
|
||||
cls.alt_user = data_utils.rand_name(
|
||||
name='test_user', prefix=CONF.resource_name_prefix)
|
||||
cls.alt_email = cls.alt_user + '@testmail.tm'
|
||||
|
||||
@decorators.attr(type='smoke')
|
||||
@ -43,7 +47,8 @@ class UsersTestJSON(base.BaseIdentityV2AdminTest):
|
||||
def test_create_user_with_enabled(self):
|
||||
"""Test creating a user with enabled : False via v2 API"""
|
||||
tenant = self.setup_test_tenant()
|
||||
name = data_utils.rand_name('test_user')
|
||||
name = data_utils.rand_name(
|
||||
name='test_user', prefix=CONF.resource_name_prefix)
|
||||
user = self.create_test_user(name=name,
|
||||
tenantId=tenant['id'],
|
||||
email=self.alt_email,
|
||||
@ -59,7 +64,8 @@ class UsersTestJSON(base.BaseIdentityV2AdminTest):
|
||||
user = self.create_test_user(tenantId=tenant['id'])
|
||||
|
||||
# Updating user details with new values
|
||||
u_name2 = data_utils.rand_name('user2')
|
||||
u_name2 = data_utils.rand_name(
|
||||
name='user2', prefix=CONF.resource_name_prefix)
|
||||
u_email2 = u_name2 + '@testmail.tm'
|
||||
update_user = self.users_client.update_user(user['id'], name=u_name2,
|
||||
email=u_email2,
|
||||
|
@ -14,10 +14,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
"""Negative tests of identity users via v2 API"""
|
||||
@ -25,7 +28,8 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(UsersNegativeTestJSON, cls).resource_setup()
|
||||
cls.alt_user = data_utils.rand_name('test_user')
|
||||
cls.alt_user = data_utils.rand_name(
|
||||
'test_user', prefix=CONF.resource_name_prefix)
|
||||
cls.alt_password = data_utils.rand_password()
|
||||
cls.alt_email = cls.alt_user + '@testmail.tm'
|
||||
|
||||
@ -106,7 +110,8 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
def test_create_user_with_enabled_non_bool(self):
|
||||
"""Creating a user with invalid enabled para via v2 API should fail"""
|
||||
tenant = self.setup_test_tenant()
|
||||
name = data_utils.rand_name('test_user')
|
||||
name = data_utils.rand_name(
|
||||
'test_user', prefix=CONF.resource_name_prefix)
|
||||
self.assertRaises(lib_exc.BadRequest, self.users_client.create_user,
|
||||
name=name, password=self.alt_password,
|
||||
tenantId=tenant['id'],
|
||||
@ -116,7 +121,8 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@decorators.idempotent_id('3d07e294-27a0-4144-b780-a2a1bf6fee19')
|
||||
def test_update_user_for_non_existent_user(self):
|
||||
"""Updating a non-existent user via v2 API should fail"""
|
||||
user_name = data_utils.rand_name('user')
|
||||
user_name = data_utils.rand_name(
|
||||
'user', prefix=CONF.resource_name_prefix)
|
||||
non_existent_id = data_utils.rand_uuid()
|
||||
self.assertRaises(lib_exc.NotFound, self.users_client.update_user,
|
||||
non_existent_id, name=user_name)
|
||||
|
@ -15,9 +15,12 @@
|
||||
from oslo_serialization import jsonutils as json
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class CredentialsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
"""Test keystone credentials"""
|
||||
@ -35,8 +38,11 @@ class CredentialsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
['access', 'secret']]
|
||||
for _ in range(2):
|
||||
project = cls.projects_client.create_project(
|
||||
data_utils.rand_name('project'),
|
||||
description=data_utils.rand_name('project-desc'))['project']
|
||||
data_utils.rand_name(
|
||||
name='project', prefix=CONF.resource_name_prefix),
|
||||
description=data_utils.rand_name(
|
||||
name='project-desc',
|
||||
prefix=CONF.resource_name_prefix))['project']
|
||||
cls.addClassResourceCleanup(
|
||||
cls.projects_client.delete_project, project['id'])
|
||||
cls.projects.append(project['id'])
|
||||
@ -50,8 +56,10 @@ class CredentialsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
@decorators.idempotent_id('7cd59bf9-bda4-4c72-9467-d21cab278355')
|
||||
def test_credentials_create_get_update_delete(self):
|
||||
"""Test creating, getting, updating, deleting of credentials"""
|
||||
prefix = CONF.resource_name_prefix
|
||||
blob = '{"access": "%s", "secret": "%s"}' % (
|
||||
data_utils.rand_name('Access'), data_utils.rand_name('Secret'))
|
||||
data_utils.rand_name(name='Access', prefix=prefix),
|
||||
data_utils.rand_name(name='Secret', prefix=prefix))
|
||||
cred = self.creds_client.create_credential(
|
||||
user_id=self.user_body['id'], project_id=self.projects[0],
|
||||
blob=blob, type='ec2')['credential']
|
||||
@ -61,8 +69,8 @@ class CredentialsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
for value2 in self.creds_list[1]:
|
||||
self.assertIn(value2, cred['blob'])
|
||||
|
||||
new_keys = [data_utils.rand_name('NewAccess'),
|
||||
data_utils.rand_name('NewSecret')]
|
||||
new_keys = [data_utils.rand_name(name='NewAccess', prefix=prefix),
|
||||
data_utils.rand_name(name='NewSecret', prefix=prefix)]
|
||||
blob = '{"access": "%s", "secret": "%s"}' % (new_keys[0], new_keys[1])
|
||||
update_body = self.creds_client.update_credential(
|
||||
cred['id'], blob=blob, project_id=self.projects[1],
|
||||
@ -88,10 +96,12 @@ class CredentialsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
"""Test listing credentials"""
|
||||
created_cred_ids = list()
|
||||
fetched_cred_ids = list()
|
||||
prefix = CONF.resource_name_prefix
|
||||
|
||||
for _ in range(2):
|
||||
blob = '{"access": "%s", "secret": "%s"}' % (
|
||||
data_utils.rand_name('Access'), data_utils.rand_name('Secret'))
|
||||
data_utils.rand_name(name='Access', prefix=prefix),
|
||||
data_utils.rand_name(name='Secret', prefix=prefix))
|
||||
cred = self.creds_client.create_credential(
|
||||
user_id=self.user_body['id'], project_id=self.projects[0],
|
||||
blob=blob, type='ec2')['credential']
|
||||
|
@ -42,7 +42,8 @@ class TestDefaultProjectId(base.BaseIdentityV3AdminTest):
|
||||
def test_default_project_id(self):
|
||||
"""Creating a token without project will default to user's project"""
|
||||
# create a domain
|
||||
dom_name = data_utils.rand_name('dom')
|
||||
dom_name = data_utils.rand_name(
|
||||
name='dom', prefix=CONF.resource_name_prefix)
|
||||
domain_body = self.domains_client.create_domain(
|
||||
name=dom_name)['domain']
|
||||
dom_id = domain_body['id']
|
||||
@ -57,7 +58,8 @@ class TestDefaultProjectId(base.BaseIdentityV3AdminTest):
|
||||
|
||||
# create a user in the domain, with the previous project as his
|
||||
# default project
|
||||
user_name = data_utils.rand_name('user')
|
||||
user_name = data_utils.rand_name(
|
||||
name='user', prefix=CONF.resource_name_prefix)
|
||||
user_pass = data_utils.rand_password()
|
||||
user_body = self.users_client.create_user(
|
||||
name=user_name,
|
||||
|
@ -14,11 +14,14 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class DomainConfigurationTestJSON(base.BaseIdentityV3AdminTest):
|
||||
"""Test domain configuration"""
|
||||
@ -150,7 +153,8 @@ class DomainConfigurationTestJSON(base.BaseIdentityV3AdminTest):
|
||||
domain, _ = self._create_domain_and_config(self.custom_config)
|
||||
|
||||
# Check that updating configuration groups work.
|
||||
new_driver = data_utils.rand_name('driver')
|
||||
new_driver = data_utils.rand_name(
|
||||
name='driver', prefix=CONF.resource_name_prefix)
|
||||
new_limit = data_utils.rand_int_id(0, 100)
|
||||
new_group_config = {'identity': {'driver': new_driver,
|
||||
'list_limit': new_limit}}
|
||||
@ -162,7 +166,8 @@ class DomainConfigurationTestJSON(base.BaseIdentityV3AdminTest):
|
||||
self.assertEqual(new_limit, updated_config['identity']['list_limit'])
|
||||
|
||||
# Check that updating individual configuration group options work.
|
||||
new_driver = data_utils.rand_name('driver')
|
||||
new_driver = data_utils.rand_name(
|
||||
name='driver', prefix=CONF.resource_name_prefix)
|
||||
|
||||
updated_config = self.client.update_domain_group_option_config(
|
||||
domain['id'], 'identity', 'driver', driver=new_driver)['config']
|
||||
|
@ -76,9 +76,10 @@ class DomainsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
@decorators.idempotent_id('f2f5b44a-82e8-4dad-8084-0661ea3b18cf')
|
||||
def test_create_update_delete_domain(self):
|
||||
"""Test creating, updating and deleting domain"""
|
||||
prefix = CONF.resource_name_prefix
|
||||
# Create domain
|
||||
d_name = data_utils.rand_name('domain')
|
||||
d_desc = data_utils.rand_name('domain-desc')
|
||||
d_name = data_utils.rand_name(name='domain', prefix=prefix)
|
||||
d_desc = data_utils.rand_name(name='domain-desc', prefix=prefix)
|
||||
domain = self.domains_client.create_domain(
|
||||
name=d_name, description=d_desc)['domain']
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
@ -92,8 +93,8 @@ class DomainsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
self.assertEqual(d_desc, domain['description'])
|
||||
self.assertEqual(True, domain['enabled'])
|
||||
# Update domain
|
||||
new_desc = data_utils.rand_name('new-desc')
|
||||
new_name = data_utils.rand_name('new-name')
|
||||
new_desc = data_utils.rand_name(name='new-desc', prefix=prefix)
|
||||
new_name = data_utils.rand_name(name='new-name', prefix=prefix)
|
||||
updated_domain = self.domains_client.update_domain(
|
||||
domain['id'], name=new_name, description=new_desc,
|
||||
enabled=False)['domain']
|
||||
@ -139,8 +140,10 @@ class DomainsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
def test_create_domain_with_disabled_status(self):
|
||||
"""Test creating domain with disabled status"""
|
||||
# Create domain with enabled status as false
|
||||
d_name = data_utils.rand_name('domain')
|
||||
d_desc = data_utils.rand_name('domain-desc')
|
||||
d_name = data_utils.rand_name(
|
||||
name='domain', prefix=CONF.resource_name_prefix)
|
||||
d_desc = data_utils.rand_name(
|
||||
name='domain-desc', prefix=CONF.resource_name_prefix)
|
||||
domain = self.domains_client.create_domain(
|
||||
name=d_name, description=d_desc, enabled=False)['domain']
|
||||
self.addCleanup(self.domains_client.delete_domain, domain['id'])
|
||||
@ -152,7 +155,8 @@ class DomainsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
def test_create_domain_without_description(self):
|
||||
"""Test creating domain without description"""
|
||||
# Create domain only with name
|
||||
d_name = data_utils.rand_name('domain')
|
||||
d_name = data_utils.rand_name(
|
||||
name='domain', prefix=CONF.resource_name_prefix)
|
||||
domain = self.domains_client.create_domain(name=d_name)['domain']
|
||||
self.addCleanup(self.delete_domain, domain['id'])
|
||||
expected_data = {'name': d_name, 'enabled': True}
|
||||
|
@ -14,10 +14,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class DomainsNegativeTestJSON(base.BaseIdentityV3AdminTest):
|
||||
"""Negative tests of identity domains"""
|
||||
@ -73,7 +76,8 @@ class DomainsNegativeTestJSON(base.BaseIdentityV3AdminTest):
|
||||
@decorators.idempotent_id('e6f9e4a2-4f36-4be8-bdbc-4e199ae29427')
|
||||
def test_domain_create_duplicate(self):
|
||||
"""Test creating domain with duplicate name should fail"""
|
||||
domain_name = data_utils.rand_name('domain-dup')
|
||||
domain_name = data_utils.rand_name(
|
||||
name='domain-dup', prefix=CONF.resource_name_prefix)
|
||||
domain = self.domains_client.create_domain(name=domain_name)['domain']
|
||||
domain_id = domain['id']
|
||||
self.addCleanup(self.delete_domain, domain_id)
|
||||
|
@ -14,10 +14,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class EndPointGroupsTest(base.BaseIdentityV3AdminTest):
|
||||
"""Test endpoint groups"""
|
||||
@ -42,8 +45,10 @@ class EndPointGroupsTest(base.BaseIdentityV3AdminTest):
|
||||
cls.addClassResourceCleanup(
|
||||
cls.services_client.delete_service, service_id)
|
||||
|
||||
name = data_utils.rand_name('service_group')
|
||||
description = data_utils.rand_name('description')
|
||||
name = data_utils.rand_name(
|
||||
name='service_group', prefix=CONF.resource_name_prefix)
|
||||
description = data_utils.rand_name(
|
||||
name='description', prefix=CONF.resource_name_prefix)
|
||||
filters = {'service_id': service_id}
|
||||
|
||||
endpoint_group = cls.client.create_endpoint_group(
|
||||
@ -57,9 +62,10 @@ class EndPointGroupsTest(base.BaseIdentityV3AdminTest):
|
||||
|
||||
@classmethod
|
||||
def _create_service(cls):
|
||||
s_name = data_utils.rand_name('service')
|
||||
s_type = data_utils.rand_name('type')
|
||||
s_description = data_utils.rand_name('description')
|
||||
prefix = CONF.resource_name_prefix
|
||||
s_name = data_utils.rand_name(name='service', prefix=prefix)
|
||||
s_type = data_utils.rand_name(name='type', prefix=prefix)
|
||||
s_description = data_utils.rand_name(name='description', prefix=prefix)
|
||||
service_data = (
|
||||
cls.services_client.create_service(name=s_name,
|
||||
type=s_type,
|
||||
@ -73,8 +79,10 @@ class EndPointGroupsTest(base.BaseIdentityV3AdminTest):
|
||||
"""Test create/list/show/check/delete of endpoint group"""
|
||||
service_id = self._create_service()
|
||||
self.addCleanup(self.services_client.delete_service, service_id)
|
||||
name = data_utils.rand_name('service_group')
|
||||
description = data_utils.rand_name('description')
|
||||
name = data_utils.rand_name(
|
||||
name='service_group', prefix=CONF.resource_name_prefix)
|
||||
description = data_utils.rand_name(
|
||||
name='description', prefix=CONF.resource_name_prefix)
|
||||
filters = {'service_id': service_id}
|
||||
|
||||
endpoint_group = self.client.create_endpoint_group(
|
||||
@ -135,8 +143,10 @@ class EndPointGroupsTest(base.BaseIdentityV3AdminTest):
|
||||
# with new values
|
||||
service1_id = self._create_service()
|
||||
self.addCleanup(self.services_client.delete_service, service1_id)
|
||||
name = data_utils.rand_name('service_group')
|
||||
description = data_utils.rand_name('description')
|
||||
name = data_utils.rand_name(
|
||||
name='service_group', prefix=CONF.resource_name_prefix)
|
||||
description = data_utils.rand_name(
|
||||
name='description', prefix=CONF.resource_name_prefix)
|
||||
filters = {'service_id': service1_id}
|
||||
|
||||
endpoint_group = self.client.create_endpoint_group(
|
||||
@ -149,8 +159,10 @@ class EndPointGroupsTest(base.BaseIdentityV3AdminTest):
|
||||
# Creating new attr values to update endpoint group
|
||||
service2_id = self._create_service()
|
||||
self.addCleanup(self.services_client.delete_service, service2_id)
|
||||
name2 = data_utils.rand_name('service_group2')
|
||||
description2 = data_utils.rand_name('description2')
|
||||
name2 = data_utils.rand_name(
|
||||
name='service_group2', prefix=CONF.resource_name_prefix)
|
||||
description2 = data_utils.rand_name(
|
||||
name='description2', prefix=CONF.resource_name_prefix)
|
||||
filters = {'service_id': service2_id}
|
||||
|
||||
# Updating endpoint group with new attr values
|
||||
|
@ -14,10 +14,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class EndPointsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
"""Test keystone endpoints"""
|
||||
@ -46,7 +49,8 @@ class EndPointsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
cls.addClassResourceCleanup(
|
||||
cls.services_client.delete_service, service['id'])
|
||||
|
||||
region_name = data_utils.rand_name('region')
|
||||
region_name = data_utils.rand_name(
|
||||
'region', prefix=CONF.resource_name_prefix)
|
||||
url = data_utils.rand_url()
|
||||
endpoint = cls.client.create_endpoint(
|
||||
service_id=cls.service_ids[i], interface=interfaces[i],
|
||||
@ -60,12 +64,14 @@ class EndPointsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
|
||||
@classmethod
|
||||
def _create_service(cls, s_name=None, s_type=None, s_description=None):
|
||||
prefix = CONF.resource_name_prefix
|
||||
if s_name is None:
|
||||
s_name = data_utils.rand_name('service')
|
||||
s_name = data_utils.rand_name(name='service', prefix=prefix)
|
||||
if s_type is None:
|
||||
s_type = data_utils.rand_name('type')
|
||||
s_type = data_utils.rand_name(name='type', prefix=prefix)
|
||||
if s_description is None:
|
||||
s_description = data_utils.rand_name('description')
|
||||
s_description = data_utils.rand_name(
|
||||
name='description', prefix=prefix)
|
||||
service_data = (
|
||||
cls.services_client.create_service(name=s_name, type=s_type,
|
||||
description=s_description))
|
||||
@ -115,7 +121,8 @@ class EndPointsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
@decorators.idempotent_id('0e2446d2-c1fd-461b-a729-b9e73e3e3b37')
|
||||
def test_create_list_show_delete_endpoint(self):
|
||||
"""Test creating, listing, showing and deleting keystone endpoint"""
|
||||
region_name = data_utils.rand_name('region')
|
||||
region_name = data_utils.rand_name(
|
||||
name='region', prefix=CONF.resource_name_prefix)
|
||||
url = data_utils.rand_url()
|
||||
interface = 'public'
|
||||
endpoint = self.client.create_endpoint(service_id=self.service_ids[0],
|
||||
@ -162,16 +169,17 @@ class EndPointsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
# endpoint_for_update is deleted, otherwise we will get a 404 error
|
||||
# when deleting endpoint_for_update if endpoint's service is deleted.
|
||||
|
||||
prefix = CONF.resource_name_prefix
|
||||
# Creating service for updating endpoint with new service ID
|
||||
s_name = data_utils.rand_name('service')
|
||||
s_type = data_utils.rand_name('type')
|
||||
s_description = data_utils.rand_name('description')
|
||||
s_name = data_utils.rand_name(name='service', prefix=prefix)
|
||||
s_type = data_utils.rand_name(name='type', prefix=prefix)
|
||||
s_description = data_utils.rand_name(name='description', prefix=prefix)
|
||||
service2 = self._create_service(s_name=s_name, s_type=s_type,
|
||||
s_description=s_description)
|
||||
self.addCleanup(self.services_client.delete_service, service2['id'])
|
||||
|
||||
# Creating an endpoint so as to check update endpoint with new values
|
||||
region1_name = data_utils.rand_name('region')
|
||||
region1_name = data_utils.rand_name(name='region', prefix=prefix)
|
||||
url1 = data_utils.rand_url()
|
||||
interface1 = 'public'
|
||||
endpoint_for_update = (
|
||||
@ -183,7 +191,7 @@ class EndPointsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
self.addCleanup(self.regions_client.delete_region, region1['id'])
|
||||
|
||||
# Updating endpoint with new values
|
||||
region2_name = data_utils.rand_name('region')
|
||||
region2_name = data_utils.rand_name(name='region', prefix=prefix)
|
||||
url2 = data_utils.rand_url()
|
||||
interface2 = 'internal'
|
||||
endpoint = self.client.update_endpoint(endpoint_for_update['id'],
|
||||
|
@ -14,10 +14,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest):
|
||||
"""Negative tests of endpoint"""
|
||||
@ -34,10 +37,11 @@ class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest):
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
prefix = CONF.resource_name_prefix
|
||||
super(EndpointsNegativeTestJSON, cls).resource_setup()
|
||||
s_name = data_utils.rand_name('service')
|
||||
s_type = data_utils.rand_name('type')
|
||||
s_description = data_utils.rand_name('description')
|
||||
s_name = data_utils.rand_name(name='service', prefix=prefix)
|
||||
s_type = data_utils.rand_name(name='type', prefix=prefix)
|
||||
s_description = data_utils.rand_name(name='description', prefix=prefix)
|
||||
service_data = (
|
||||
cls.services_client.create_service(name=s_name, type=s_type,
|
||||
description=s_description)
|
||||
@ -56,7 +60,8 @@ class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest):
|
||||
"""
|
||||
interface = 'public'
|
||||
url = data_utils.rand_url()
|
||||
region = data_utils.rand_name('region')
|
||||
region = data_utils.rand_name(
|
||||
name='region', prefix=CONF.resource_name_prefix)
|
||||
self.assertRaises(lib_exc.BadRequest, self.client.create_endpoint,
|
||||
service_id=self.service_id, interface=interface,
|
||||
url=url, region=region, enabled='False')
|
||||
@ -70,7 +75,8 @@ class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest):
|
||||
"""
|
||||
interface = 'public'
|
||||
url = data_utils.rand_url()
|
||||
region = data_utils.rand_name('region')
|
||||
region = data_utils.rand_name(
|
||||
name='region', prefix=CONF.resource_name_prefix)
|
||||
self.assertRaises(lib_exc.BadRequest, self.client.create_endpoint,
|
||||
service_id=self.service_id, interface=interface,
|
||||
url=url, region=region, enabled='True')
|
||||
@ -78,7 +84,8 @@ class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest):
|
||||
def _assert_update_raises_bad_request(self, enabled):
|
||||
|
||||
# Create an endpoint
|
||||
region1_name = data_utils.rand_name('region')
|
||||
region1_name = data_utils.rand_name(
|
||||
name='region', prefix=CONF.resource_name_prefix)
|
||||
url1 = data_utils.rand_url()
|
||||
interface1 = 'public'
|
||||
endpoint_for_update = (
|
||||
|
@ -38,9 +38,10 @@ class GroupsV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
@decorators.idempotent_id('2e80343b-6c81-4ac3-88c7-452f3e9d5129')
|
||||
def test_group_create_update_get(self):
|
||||
"""Test creating, updating and getting keystone group"""
|
||||
prefix = CONF.resource_name_prefix
|
||||
# Verify group creation works.
|
||||
name = data_utils.rand_name('Group')
|
||||
description = data_utils.rand_name('Description')
|
||||
name = data_utils.rand_name(name='Group', prefix=prefix)
|
||||
description = data_utils.rand_name(name='Description', prefix=prefix)
|
||||
group = self.setup_test_group(name=name, domain_id=self.domain['id'],
|
||||
description=description)
|
||||
self.assertEqual(group['name'], name)
|
||||
@ -48,8 +49,10 @@ class GroupsV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
self.assertEqual(self.domain['id'], group['domain_id'])
|
||||
|
||||
# Verify updating name and description works.
|
||||
first_name_update = data_utils.rand_name('UpdateGroup')
|
||||
first_desc_update = data_utils.rand_name('UpdateDescription')
|
||||
first_name_update = data_utils.rand_name(
|
||||
name='UpdateGroup', prefix=prefix)
|
||||
first_desc_update = data_utils.rand_name(
|
||||
name='UpdateDescription', prefix=prefix)
|
||||
updated_group = self.groups_client.update_group(
|
||||
group['id'], name=first_name_update,
|
||||
description=first_desc_update)['group']
|
||||
@ -65,7 +68,7 @@ class GroupsV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
# Verify that updating a single field for a group (name) leaves the
|
||||
# other fields (description, domain_id) unchanged.
|
||||
second_name_update = data_utils.rand_name(
|
||||
self.__class__.__name__ + 'UpdateGroup')
|
||||
self.__class__.__name__ + 'UpdateGroup', prefix=prefix)
|
||||
updated_group = self.groups_client.update_group(
|
||||
group['id'], name=second_name_update)['group']
|
||||
self.assertEqual(second_name_update, updated_group['name'])
|
||||
|
@ -37,20 +37,21 @@ class InheritsV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(InheritsV3TestJSON, cls).resource_setup()
|
||||
u_name = data_utils.rand_name('user-')
|
||||
prefix = CONF.resource_name_prefix
|
||||
u_name = data_utils.rand_name(name='user-', prefix=prefix)
|
||||
u_desc = '%s description' % u_name
|
||||
u_email = '%s@testmail.tm' % u_name
|
||||
u_password = data_utils.rand_password()
|
||||
cls.domain = cls.create_domain()
|
||||
cls.project = cls.projects_client.create_project(
|
||||
data_utils.rand_name('project-'),
|
||||
description=data_utils.rand_name('project-desc-'),
|
||||
data_utils.rand_name(name='project-', prefix=prefix),
|
||||
description=data_utils.rand_name('project-desc-', prefix=prefix),
|
||||
domain_id=cls.domain['id'])['project']
|
||||
cls.addClassResourceCleanup(cls.projects_client.delete_project,
|
||||
cls.project['id'])
|
||||
cls.group = cls.groups_client.create_group(
|
||||
name=data_utils.rand_name('group-'), project_id=cls.project['id'],
|
||||
domain_id=cls.domain['id'])['group']
|
||||
name=data_utils.rand_name(name='group-', prefix=prefix),
|
||||
project_id=cls.project['id'], domain_id=cls.domain['id'])['group']
|
||||
cls.addClassResourceCleanup(cls.groups_client.delete_group,
|
||||
cls.group['id'])
|
||||
if not CONF.identity_feature_enabled.immutable_user_source:
|
||||
|
@ -45,20 +45,21 @@ class ListProjectsTestJSON(BaseListProjectsTestJSON):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(ListProjectsTestJSON, cls).resource_setup()
|
||||
prefix = CONF.resource_name_prefix
|
||||
domain_id = cls.os_admin.credentials.domain_id
|
||||
# Create project with domain
|
||||
p1_name = data_utils.rand_name(cls.__name__)
|
||||
p1_name = data_utils.rand_name(cls.__name__, prefix=prefix)
|
||||
cls.p1 = cls.projects_client.create_project(
|
||||
p1_name, enabled=False, domain_id=domain_id)['project']
|
||||
cls.addClassResourceCleanup(cls.projects_client.delete_project,
|
||||
cls.p1['id'])
|
||||
# Create default project
|
||||
p2_name = data_utils.rand_name(cls.__name__)
|
||||
p2_name = data_utils.rand_name(cls.__name__, prefix=prefix)
|
||||
cls.p2 = cls.projects_client.create_project(p2_name)['project']
|
||||
cls.addClassResourceCleanup(cls.projects_client.delete_project,
|
||||
cls.p2['id'])
|
||||
# Create a new project (p3) using p2 as parent project
|
||||
p3_name = data_utils.rand_name(cls.__name__)
|
||||
p3_name = data_utils.rand_name(cls.__name__, prefix=prefix)
|
||||
cls.p3 = cls.projects_client.create_project(
|
||||
p3_name, parent_id=cls.p2['id'])['project']
|
||||
cls.addClassResourceCleanup(cls.projects_client.delete_project,
|
||||
@ -99,7 +100,8 @@ class ListProjectsStaticTestJSON(BaseListProjectsTestJSON):
|
||||
cls.p1 = cls.projects_client.show_project(
|
||||
cls.os_primary.credentials.project_id)['project']
|
||||
# Create a test project
|
||||
p2_name = data_utils.rand_name(cls.__name__)
|
||||
p2_name = data_utils.rand_name(
|
||||
cls.__name__, prefix=CONF.resource_name_prefix)
|
||||
p2_domain_id = CONF.identity.default_domain_id
|
||||
cls.p2 = cls.projects_client.create_project(
|
||||
p2_name, domain_id=p2_domain_id)['project']
|
||||
|
@ -45,14 +45,15 @@ class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(UsersV3TestJSON, cls).resource_setup()
|
||||
alt_user = data_utils.rand_name('test_user')
|
||||
prefix = CONF.resource_name_prefix
|
||||
alt_user = data_utils.rand_name(name='test_user', prefix=prefix)
|
||||
alt_password = data_utils.rand_password()
|
||||
cls.alt_email = alt_user + '@testmail.tm'
|
||||
# Create a domain
|
||||
cls.domain = cls.create_domain()
|
||||
# Create user with Domain
|
||||
cls.users = list()
|
||||
u1_name = data_utils.rand_name('test_user')
|
||||
u1_name = data_utils.rand_name(name='test_user', prefix=prefix)
|
||||
cls.domain_enabled_user = cls.users_client.create_user(
|
||||
name=u1_name, password=alt_password,
|
||||
email=cls.alt_email, domain_id=cls.domain['id'])['user']
|
||||
@ -60,7 +61,7 @@ class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
cls.domain_enabled_user['id'])
|
||||
cls.users.append(cls.domain_enabled_user)
|
||||
# Create default not enabled user
|
||||
u2_name = data_utils.rand_name('test_user')
|
||||
u2_name = data_utils.rand_name(name='test_user', prefix=prefix)
|
||||
cls.non_domain_enabled_user = cls.users_client.create_user(
|
||||
name=u2_name, password=alt_password,
|
||||
email=cls.alt_email, enabled=False)['user']
|
||||
|
@ -14,11 +14,14 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class OAUTHConsumersV3Test(base.BaseIdentityV3AdminTest):
|
||||
# NOTE: force_tenant_isolation is true in the base class by default but
|
||||
@ -28,7 +31,8 @@ class OAUTHConsumersV3Test(base.BaseIdentityV3AdminTest):
|
||||
|
||||
def _create_consumer(self):
|
||||
"""Creates a consumer with a random description."""
|
||||
description = data_utils.rand_name('test_create_consumer')
|
||||
description = data_utils.rand_name(
|
||||
name='test_create_consumer', prefix=CONF.resource_name_prefix)
|
||||
consumer = self.oauth_consumers_client.create_consumer(
|
||||
description)['consumer']
|
||||
# cleans up created consumers after tests
|
||||
@ -70,7 +74,8 @@ class OAUTHConsumersV3Test(base.BaseIdentityV3AdminTest):
|
||||
# create a new consumer to update
|
||||
consumer = self._create_consumer()
|
||||
# create new description
|
||||
new_description = data_utils.rand_name('test_update_consumer')
|
||||
new_description = data_utils.rand_name(
|
||||
name='test_update_consumer', prefix=CONF.resource_name_prefix)
|
||||
# update consumer
|
||||
self.oauth_consumers_client.update_consumer(consumer['id'],
|
||||
new_description)
|
||||
|
@ -14,9 +14,12 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class PoliciesTestJSON(base.BaseIdentityV3AdminTest):
|
||||
"""Test keystone policies"""
|
||||
@ -30,8 +33,10 @@ class PoliciesTestJSON(base.BaseIdentityV3AdminTest):
|
||||
policy_ids = list()
|
||||
fetched_ids = list()
|
||||
for _ in range(3):
|
||||
blob = data_utils.rand_name('BlobName')
|
||||
policy_type = data_utils.rand_name('PolicyType')
|
||||
blob = data_utils.rand_name(
|
||||
name='BlobName', prefix=CONF.resource_name_prefix)
|
||||
policy_type = data_utils.rand_name(
|
||||
name='PolicyType', prefix=CONF.resource_name_prefix)
|
||||
policy = self.policies_client.create_policy(
|
||||
blob=blob, type=policy_type)['policy']
|
||||
# Delete the Policy at the end of this method
|
||||
@ -48,8 +53,9 @@ class PoliciesTestJSON(base.BaseIdentityV3AdminTest):
|
||||
@decorators.idempotent_id('e544703a-2f03-4cf2-9b0f-350782fdb0d3')
|
||||
def test_create_update_delete_policy(self):
|
||||
"""Test to update keystone policy"""
|
||||
blob = data_utils.rand_name('BlobName')
|
||||
policy_type = data_utils.rand_name('PolicyType')
|
||||
prefix = CONF.resource_name_prefix
|
||||
blob = data_utils.rand_name(name='BlobName', prefix=prefix)
|
||||
policy_type = data_utils.rand_name(name='PolicyType', prefix=prefix)
|
||||
policy = self.policies_client.create_policy(blob=blob,
|
||||
type=policy_type)['policy']
|
||||
self.addCleanup(self._delete_policy, policy['id'])
|
||||
@ -59,7 +65,7 @@ class PoliciesTestJSON(base.BaseIdentityV3AdminTest):
|
||||
self.assertEqual(blob, policy['blob'])
|
||||
self.assertEqual(policy_type, policy['type'])
|
||||
# Update policy
|
||||
update_type = data_utils.rand_name('UpdatedPolicyType')
|
||||
update_type = data_utils.rand_name('UpdatedPolicyType', prefix=prefix)
|
||||
data = self.policies_client.update_policy(
|
||||
policy['id'], type=update_type)['policy']
|
||||
self.assertIn('type', data)
|
||||
|
@ -40,7 +40,7 @@ class IdentityV3ProjectTagsTest(base.BaseIdentityV3AdminTest):
|
||||
project = self.setup_test_project()
|
||||
|
||||
# Create a tag for testing.
|
||||
tag = data_utils.rand_name('tag')
|
||||
tag = data_utils.rand_name('tag', prefix=CONF.resource_name_prefix)
|
||||
# NOTE(felipemonteiro): The response body for create is empty.
|
||||
self.project_tags_client.update_project_tag(project['id'], tag)
|
||||
|
||||
@ -49,7 +49,8 @@ class IdentityV3ProjectTagsTest(base.BaseIdentityV3AdminTest):
|
||||
project['id'], tag)
|
||||
|
||||
# Verify that updating the project tags works.
|
||||
tags_to_update = [data_utils.rand_name('tag') for _ in range(3)]
|
||||
tags_to_update = [data_utils.rand_name(
|
||||
'tag', prefix=CONF.resource_name_prefix) for _ in range(3)]
|
||||
updated_tags = self.project_tags_client.update_all_project_tags(
|
||||
project['id'], tags_to_update)['tags']
|
||||
self.assertEqual(sorted(tags_to_update), sorted(updated_tags))
|
||||
|
@ -33,7 +33,8 @@ class ProjectsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
@decorators.idempotent_id('0ecf465c-0dc4-4532-ab53-91ffeb74d12d')
|
||||
def test_project_create_with_description(self):
|
||||
"""Test creating project with a description"""
|
||||
project_desc = data_utils.rand_name('desc')
|
||||
project_desc = data_utils.rand_name(
|
||||
name='desc', prefix=CONF.resource_name_prefix)
|
||||
project = self.setup_test_project(description=project_desc)
|
||||
project_id = project['id']
|
||||
desc1 = project['description']
|
||||
@ -48,7 +49,8 @@ class ProjectsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
def test_project_create_with_domain(self):
|
||||
"""Test creating project with a domain"""
|
||||
domain = self.setup_test_domain()
|
||||
project_name = data_utils.rand_name('project')
|
||||
project_name = data_utils.rand_name(
|
||||
name='project', prefix=CONF.resource_name_prefix)
|
||||
project = self.setup_test_project(
|
||||
name=project_name, domain_id=domain['id'])
|
||||
project_id = project['id']
|
||||
@ -64,7 +66,8 @@ class ProjectsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
domain = self.setup_test_domain()
|
||||
domain_id = domain['id']
|
||||
|
||||
root_project_name = data_utils.rand_name('root_project')
|
||||
root_project_name = data_utils.rand_name(
|
||||
name='root_project', prefix=CONF.resource_name_prefix)
|
||||
root_project = self.setup_test_project(
|
||||
name=root_project_name, domain_id=domain_id)
|
||||
|
||||
@ -76,7 +79,8 @@ class ProjectsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
self.assertEqual(domain_id, parent_id)
|
||||
|
||||
# Create a project using root_project_id as parent_id
|
||||
project_name = data_utils.rand_name('project')
|
||||
project_name = data_utils.rand_name(
|
||||
name='project', prefix=CONF.resource_name_prefix)
|
||||
project = self.setup_test_project(
|
||||
name=project_name, domain_id=domain_id, parent_id=root_project_id)
|
||||
parent_id = project['parent_id']
|
||||
@ -127,12 +131,14 @@ class ProjectsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
@decorators.idempotent_id('f608f368-048c-496b-ad63-d286c26dab6b')
|
||||
def test_project_update_name(self):
|
||||
"""Test updating name attribute of a project"""
|
||||
p_name1 = data_utils.rand_name('project')
|
||||
p_name1 = data_utils.rand_name(
|
||||
name='project', prefix=CONF.resource_name_prefix)
|
||||
project = self.setup_test_project(name=p_name1)
|
||||
|
||||
resp1_name = project['name']
|
||||
|
||||
p_name2 = data_utils.rand_name('project2')
|
||||
p_name2 = data_utils.rand_name(
|
||||
name='project2', prefix=CONF.resource_name_prefix)
|
||||
body = self.projects_client.update_project(project['id'],
|
||||
name=p_name2)['project']
|
||||
resp2_name = body['name']
|
||||
@ -148,11 +154,13 @@ class ProjectsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
@decorators.idempotent_id('f138b715-255e-4a7d-871d-351e1ef2e153')
|
||||
def test_project_update_desc(self):
|
||||
"""Test updating description attribute of a project"""
|
||||
p_desc = data_utils.rand_name('desc')
|
||||
p_desc = data_utils.rand_name(
|
||||
name='desc', prefix=CONF.resource_name_prefix)
|
||||
project = self.setup_test_project(description=p_desc)
|
||||
resp1_desc = project['description']
|
||||
|
||||
p_desc2 = data_utils.rand_name('desc2')
|
||||
p_desc2 = data_utils.rand_name(
|
||||
name='desc2', prefix=CONF.resource_name_prefix)
|
||||
body = self.projects_client.update_project(
|
||||
project['id'], description=p_desc2)['project']
|
||||
resp2_desc = body['description']
|
||||
@ -197,7 +205,8 @@ class ProjectsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
project = self.setup_test_project()
|
||||
|
||||
# Create a User
|
||||
u_name = data_utils.rand_name('user')
|
||||
u_name = data_utils.rand_name(
|
||||
name='user', prefix=CONF.resource_name_prefix)
|
||||
u_desc = u_name + 'description'
|
||||
u_email = u_name + '@testmail.tm'
|
||||
u_password = data_utils.rand_password()
|
||||
|
@ -14,10 +14,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ProjectsNegativeTestJSON(base.BaseIdentityV3AdminTest):
|
||||
"""Negative tests of projects"""
|
||||
@ -54,7 +57,8 @@ class ProjectsNegativeStaticTestJSON(base.BaseIdentityV3AdminTest):
|
||||
@decorators.idempotent_id('874c3e84-d174-4348-a16b-8c01f599561b')
|
||||
def test_project_create_duplicate(self):
|
||||
"""Project names should be unique"""
|
||||
project_name = data_utils.rand_name('project-dup')
|
||||
project_name = data_utils.rand_name(
|
||||
name='project-dup', prefix=CONF.resource_name_prefix)
|
||||
self.setup_test_project(name=project_name)
|
||||
|
||||
self.assertRaises(lib_exc.Conflict,
|
||||
@ -64,7 +68,8 @@ class ProjectsNegativeStaticTestJSON(base.BaseIdentityV3AdminTest):
|
||||
@decorators.idempotent_id('8fba9de2-3e1f-4e77-812a-60cb68f8df13')
|
||||
def test_create_project_by_unauthorized_user(self):
|
||||
"""Non-admin user should not be authorized to create a project"""
|
||||
project_name = data_utils.rand_name('project')
|
||||
project_name = data_utils.rand_name(
|
||||
name='project', prefix=CONF.resource_name_prefix)
|
||||
self.assertRaises(
|
||||
lib_exc.Forbidden, self.non_admin_projects_client.create_project,
|
||||
project_name)
|
||||
|
@ -14,10 +14,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class RegionsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
"""Test regions"""
|
||||
@ -37,7 +40,8 @@ class RegionsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
super(RegionsTestJSON, cls).resource_setup()
|
||||
cls.setup_regions = list()
|
||||
for _ in range(2):
|
||||
r_description = data_utils.rand_name('description')
|
||||
r_description = data_utils.rand_name(
|
||||
name='description', prefix=CONF.resource_name_prefix)
|
||||
region = cls.client.create_region(
|
||||
description=r_description)['region']
|
||||
cls.addClassResourceCleanup(
|
||||
@ -48,7 +52,8 @@ class RegionsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
def test_create_update_get_delete_region(self):
|
||||
"""Test creating, updating, getting and updating region"""
|
||||
# Create region
|
||||
r_description = data_utils.rand_name('description')
|
||||
r_description = data_utils.rand_name(
|
||||
name='description', prefix=CONF.resource_name_prefix)
|
||||
region = self.client.create_region(
|
||||
description=r_description,
|
||||
parent_region_id=self.setup_regions[0]['id'])['region']
|
||||
@ -62,7 +67,8 @@ class RegionsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
self.assertEqual(self.setup_regions[0]['id'],
|
||||
region['parent_region_id'])
|
||||
# Update region with new description and parent ID
|
||||
r_alt_description = data_utils.rand_name('description')
|
||||
r_alt_description = data_utils.rand_name(
|
||||
name='description', prefix=CONF.resource_name_prefix)
|
||||
region = self.client.update_region(
|
||||
region['id'],
|
||||
description=r_alt_description,
|
||||
@ -86,7 +92,8 @@ class RegionsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
def test_create_region_with_specific_id(self):
|
||||
"""Test creating region with specific id"""
|
||||
r_region_id = data_utils.rand_uuid()
|
||||
r_description = data_utils.rand_name('description')
|
||||
r_description = data_utils.rand_name(
|
||||
name='description', prefix=CONF.resource_name_prefix)
|
||||
region = self.client.create_region(
|
||||
region_id=r_region_id, description=r_description)['region']
|
||||
self.addCleanup(self.client.delete_region, region['id'])
|
||||
@ -109,7 +116,8 @@ class RegionsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
def test_list_regions_filter_by_parent_region_id(self):
|
||||
"""Test listing regions filtered by parent region id"""
|
||||
# Add a sub-region to one of the existing test regions
|
||||
r_description = data_utils.rand_name('description')
|
||||
r_description = data_utils.rand_name(
|
||||
name='description', prefix=CONF.resource_name_prefix)
|
||||
region = self.client.create_region(
|
||||
description=r_description,
|
||||
parent_region_id=self.setup_regions[0]['id'])['region']
|
||||
|
@ -35,31 +35,34 @@ class RolesV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(RolesV3TestJSON, cls).resource_setup()
|
||||
prefix = CONF.resource_name_prefix
|
||||
cls.roles = list()
|
||||
for _ in range(3):
|
||||
role_name = data_utils.rand_name(name='role')
|
||||
role_name = data_utils.rand_name(name='role', prefix=prefix)
|
||||
role = cls.roles_client.create_role(name=role_name)['role']
|
||||
cls.addClassResourceCleanup(cls.roles_client.delete_role,
|
||||
role['id'])
|
||||
cls.roles.append(role)
|
||||
u_name = data_utils.rand_name('user')
|
||||
u_name = data_utils.rand_name(name='user', prefix=prefix)
|
||||
u_desc = '%s description' % u_name
|
||||
u_email = '%s@testmail.tm' % u_name
|
||||
cls.u_password = data_utils.rand_password()
|
||||
cls.domain = cls.create_domain()
|
||||
cls.project = cls.projects_client.create_project(
|
||||
data_utils.rand_name('project'),
|
||||
description=data_utils.rand_name('project-desc'),
|
||||
data_utils.rand_name(name='project', prefix=prefix),
|
||||
description=data_utils.rand_name(
|
||||
name='project-desc', prefix=prefix),
|
||||
domain_id=cls.domain['id'])['project']
|
||||
cls.addClassResourceCleanup(cls.projects_client.delete_project,
|
||||
cls.project['id'])
|
||||
cls.group_body = cls.groups_client.create_group(
|
||||
name=data_utils.rand_name('Group'), project_id=cls.project['id'],
|
||||
name=data_utils.rand_name(name='Group', prefix=prefix),
|
||||
project_id=cls.project['id'],
|
||||
domain_id=cls.domain['id'])['group']
|
||||
cls.addClassResourceCleanup(cls.groups_client.delete_group,
|
||||
cls.group_body['id'])
|
||||
cls.role = cls.roles_client.create_role(
|
||||
name=data_utils.rand_name('Role'))['role']
|
||||
name=data_utils.rand_name(name='Role', prefix=prefix))['role']
|
||||
cls.addClassResourceCleanup(cls.roles_client.delete_role,
|
||||
cls.role['id'])
|
||||
if not CONF.identity_feature_enabled.immutable_user_source:
|
||||
@ -78,13 +81,15 @@ class RolesV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
@decorators.idempotent_id('18afc6c0-46cf-4911-824e-9989cc056c3a')
|
||||
def test_role_create_update_show_list(self):
|
||||
"""Test creating, updating, showing and listing a role"""
|
||||
r_name = data_utils.rand_name('Role')
|
||||
r_name = data_utils.rand_name(
|
||||
name='Role', prefix=CONF.resource_name_prefix)
|
||||
role = self.roles_client.create_role(name=r_name)['role']
|
||||
self.addCleanup(self.roles_client.delete_role, role['id'])
|
||||
self.assertIn('name', role)
|
||||
self.assertEqual(role['name'], r_name)
|
||||
|
||||
new_name = data_utils.rand_name('NewRole')
|
||||
new_name = data_utils.rand_name(
|
||||
name='NewRole', prefix=CONF.resource_name_prefix)
|
||||
updated_role = self.roles_client.update_role(role['id'],
|
||||
name=new_name)['role']
|
||||
self.assertIn('name', updated_role)
|
||||
@ -371,7 +376,8 @@ class RolesV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
def test_domain_roles_create_delete(self):
|
||||
"""Test creating, listing and deleting domain roles"""
|
||||
domain_role = self.roles_client.create_role(
|
||||
name=data_utils.rand_name('domain_role'),
|
||||
name=data_utils.rand_name(
|
||||
name='domain_role', prefix=CONF.resource_name_prefix),
|
||||
domain_id=self.domain['id'])['role']
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
|
@ -14,10 +14,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ServicesTestJSON(base.BaseIdentityV3AdminTest):
|
||||
"""Test keystone services"""
|
||||
@ -33,10 +36,11 @@ class ServicesTestJSON(base.BaseIdentityV3AdminTest):
|
||||
@decorators.idempotent_id('5193aad5-bcb7-411d-85b0-b3b61b96ef06')
|
||||
def test_create_update_get_service(self):
|
||||
"""Test creating, updating and getting of keystone service"""
|
||||
prefix = CONF.resource_name_prefix
|
||||
# Creating a Service
|
||||
name = data_utils.rand_name('service')
|
||||
serv_type = data_utils.rand_name('type')
|
||||
desc = data_utils.rand_name('description')
|
||||
name = data_utils.rand_name(name='service', prefix=prefix)
|
||||
serv_type = data_utils.rand_name(name='type', prefix=prefix)
|
||||
desc = data_utils.rand_name(name='description', prefix=prefix)
|
||||
create_service = self.services_client.create_service(
|
||||
type=serv_type, name=name, description=desc)['service']
|
||||
self.addCleanup(self._del_service, create_service['id'])
|
||||
@ -49,7 +53,7 @@ class ServicesTestJSON(base.BaseIdentityV3AdminTest):
|
||||
# Update description
|
||||
s_id = create_service['id']
|
||||
resp1_desc = create_service['description']
|
||||
s_desc2 = data_utils.rand_name('desc2')
|
||||
s_desc2 = data_utils.rand_name(name='desc2', prefix=prefix)
|
||||
update_service = self.services_client.update_service(
|
||||
s_id, description=s_desc2)['service']
|
||||
resp2_desc = update_service['description']
|
||||
@ -66,8 +70,10 @@ class ServicesTestJSON(base.BaseIdentityV3AdminTest):
|
||||
@decorators.idempotent_id('d1dcb1a1-2b6b-4da8-bbb8-5532ef6e8269')
|
||||
def test_create_service_without_description(self):
|
||||
"""Create a keystone service only with name and type"""
|
||||
name = data_utils.rand_name('service')
|
||||
serv_type = data_utils.rand_name('type')
|
||||
name = data_utils.rand_name(
|
||||
name='service', prefix=CONF.resource_name_prefix)
|
||||
serv_type = data_utils.rand_name(
|
||||
name='type', prefix=CONF.resource_name_prefix)
|
||||
service = self.services_client.create_service(
|
||||
type=serv_type, name=name)['service']
|
||||
self.addCleanup(self.services_client.delete_service, service['id'])
|
||||
@ -80,8 +86,12 @@ class ServicesTestJSON(base.BaseIdentityV3AdminTest):
|
||||
service_ids = list()
|
||||
service_types = list()
|
||||
for _ in range(3):
|
||||
name = data_utils.rand_name(self.__class__.__name__ + '-Service')
|
||||
serv_type = data_utils.rand_name(self.__class__.__name__ + '-Type')
|
||||
name = data_utils.rand_name(
|
||||
self.__class__.__name__ + '-Service',
|
||||
prefix=CONF.resource_name_prefix)
|
||||
serv_type = data_utils.rand_name(
|
||||
self.__class__.__name__ + '-Type',
|
||||
prefix=CONF.resource_name_prefix)
|
||||
create_service = self.services_client.create_service(
|
||||
type=serv_type, name=name)['service']
|
||||
self.addCleanup(self.services_client.delete_service,
|
||||
|
@ -42,11 +42,13 @@ class TokensV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
domain_id=CONF.identity.default_domain_id)
|
||||
|
||||
# Create a couple projects
|
||||
project1_name = data_utils.rand_name(name=self.__class__.__name__)
|
||||
project1_name = data_utils.rand_name(
|
||||
name=self.__class__.__name__, prefix=CONF.resource_name_prefix)
|
||||
project1 = self.setup_test_project(
|
||||
name=project1_name, domain_id=CONF.identity.default_domain_id)
|
||||
|
||||
project2_name = data_utils.rand_name(name=self.__class__.__name__)
|
||||
project2_name = data_utils.rand_name(
|
||||
name=self.__class__.__name__, prefix=CONF.resource_name_prefix)
|
||||
project2 = self.setup_test_project(
|
||||
name=project2_name, domain_id=CONF.identity.default_domain_id)
|
||||
self.addCleanup(self.projects_client.delete_project, project2['id'])
|
||||
|
@ -53,9 +53,10 @@ class TrustsV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
super(TrustsV3TestJSON, self).tearDown()
|
||||
|
||||
def create_trustor_and_roles(self):
|
||||
prefix = CONF.resource_name_prefix
|
||||
# create a project that trusts will be granted on
|
||||
trustor_project_name = data_utils.rand_name(
|
||||
name=self.__class__.__name__)
|
||||
name=self.__class__.__name__, prefix=prefix)
|
||||
project = self.projects_client.create_project(
|
||||
trustor_project_name,
|
||||
domain_id=CONF.identity.default_domain_id)['project']
|
||||
@ -64,7 +65,7 @@ class TrustsV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
self.assertIsNotNone(self.trustor_project_id)
|
||||
|
||||
# Create a trustor User
|
||||
trustor_username = data_utils.rand_name('user')
|
||||
trustor_username = data_utils.rand_name(name='user', prefix=prefix)
|
||||
u_desc = trustor_username + 'description'
|
||||
u_email = trustor_username + '@testmail.xx'
|
||||
trustor_password = data_utils.rand_password()
|
||||
@ -79,8 +80,10 @@ class TrustsV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
self.trustor_user_id = user['id']
|
||||
|
||||
# And two roles, one we'll delegate and one we won't
|
||||
self.delegated_role = data_utils.rand_name('DelegatedRole')
|
||||
self.not_delegated_role = data_utils.rand_name('NotDelegatedRole')
|
||||
self.delegated_role = data_utils.rand_name(
|
||||
name='DelegatedRole', prefix=prefix)
|
||||
self.not_delegated_role = data_utils.rand_name(
|
||||
name='NotDelegatedRole', prefix=prefix)
|
||||
|
||||
role = self.roles_client.create_role(name=self.delegated_role)['role']
|
||||
self.addCleanup(self.roles_client.delete_role, role['id'])
|
||||
|
@ -40,8 +40,9 @@ class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
@decorators.idempotent_id('b537d090-afb9-4519-b95d-270b0708e87e')
|
||||
def test_user_update(self):
|
||||
"""Test case to check if updating of user attributes is successful"""
|
||||
prefix = CONF.resource_name_prefix
|
||||
# Creating first user
|
||||
u_name = data_utils.rand_name('user')
|
||||
u_name = data_utils.rand_name(name='user', prefix=prefix)
|
||||
u_desc = u_name + 'description'
|
||||
u_email = u_name + '@testmail.tm'
|
||||
u_password = data_utils.rand_password()
|
||||
@ -55,7 +56,7 @@ class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
project = self.setup_test_project()
|
||||
|
||||
# Updating user details with new values
|
||||
update_kwargs = {'name': data_utils.rand_name('user2'),
|
||||
update_kwargs = {'name': data_utils.rand_name('user2', prefix=prefix),
|
||||
'description': data_utils.rand_name('desc2'),
|
||||
'project_id': project['id'],
|
||||
'email': 'user2@testmail.tm',
|
||||
@ -75,7 +76,8 @@ class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
def test_update_user_password(self):
|
||||
"""Test updating user password"""
|
||||
# Creating User to check password updation
|
||||
u_name = data_utils.rand_name('user')
|
||||
u_name = data_utils.rand_name(
|
||||
name='user', prefix=CONF.resource_name_prefix)
|
||||
original_password = data_utils.rand_password()
|
||||
user = self.users_client.create_user(
|
||||
name=u_name, password=original_password)['user']
|
||||
@ -105,7 +107,8 @@ class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
|
||||
fetched_project_ids = list()
|
||||
u_project = self.setup_test_project()
|
||||
# Create a user.
|
||||
u_name = data_utils.rand_name('user')
|
||||
u_name = data_utils.rand_name(
|
||||
name='user', prefix=CONF.resource_name_prefix)
|
||||
u_desc = u_name + 'description'
|
||||
u_email = u_name + '@testmail.tm'
|
||||
u_password = data_utils.rand_password()
|
||||
|
@ -29,7 +29,8 @@ class UsersNegativeTest(base.BaseIdentityV3AdminTest):
|
||||
@decorators.idempotent_id('e75f006c-89cc-477b-874d-588e4eab4b17')
|
||||
def test_create_user_for_non_existent_domain(self):
|
||||
"""Attempt to create a user in a non-existent domain should fail"""
|
||||
u_name = data_utils.rand_name('user')
|
||||
u_name = data_utils.rand_name(
|
||||
name='user', prefix=CONF.resource_name_prefix)
|
||||
u_email = u_name + '@testmail.tm'
|
||||
u_password = data_utils.rand_password()
|
||||
self.assertRaises(lib_exc.NotFound, self.users_client.create_user,
|
||||
|
@ -71,7 +71,8 @@ class BaseIdentityTest(tempest.test.BaseTestCase):
|
||||
if kwargs.get('password', None) is None:
|
||||
kwargs['password'] = data_utils.rand_password()
|
||||
if 'name' not in kwargs:
|
||||
kwargs['name'] = data_utils.rand_name('test_user')
|
||||
kwargs['name'] = data_utils.rand_name(
|
||||
name='test_user', prefix=CONF.resource_name_prefix)
|
||||
if 'email' not in kwargs:
|
||||
kwargs['email'] = kwargs['name'] + '@testmail.tm'
|
||||
|
||||
@ -84,7 +85,8 @@ class BaseIdentityTest(tempest.test.BaseTestCase):
|
||||
|
||||
def setup_test_role(self, name=None, domain_id=None):
|
||||
"""Set up a test role."""
|
||||
params = {'name': name or data_utils.rand_name('test_role')}
|
||||
params = {'name': name or data_utils.rand_name(
|
||||
name='test_role', prefix=CONF.resource_name_prefix)}
|
||||
if domain_id:
|
||||
params['domain_id'] = domain_id
|
||||
|
||||
@ -161,9 +163,12 @@ class BaseIdentityV2AdminTest(BaseIdentityV2Test):
|
||||
def setup_test_tenant(self, **kwargs):
|
||||
"""Set up a test tenant."""
|
||||
if 'name' not in kwargs:
|
||||
kwargs['name'] = data_utils.rand_name('test_tenant')
|
||||
kwargs['name'] = data_utils.rand_name(
|
||||
name='test_tenant',
|
||||
prefix=CONF.resource_name_prefix)
|
||||
if 'description' not in kwargs:
|
||||
kwargs['description'] = data_utils.rand_name('desc')
|
||||
kwargs['description'] = data_utils.rand_name(
|
||||
name='desc', prefix=CONF.resource_name_prefix)
|
||||
tenant = self.projects_client.create_tenant(**kwargs)['tenant']
|
||||
# Delete the tenant at the end of the test
|
||||
self.addCleanup(
|
||||
@ -249,9 +254,11 @@ class BaseIdentityV3AdminTest(BaseIdentityV3Test):
|
||||
def create_domain(cls, **kwargs):
|
||||
"""Create a domain."""
|
||||
if 'name' not in kwargs:
|
||||
kwargs['name'] = data_utils.rand_name('test_domain')
|
||||
kwargs['name'] = data_utils.rand_name(
|
||||
name='test_domain', prefix=CONF.resource_name_prefix)
|
||||
if 'description' not in kwargs:
|
||||
kwargs['description'] = data_utils.rand_name('desc')
|
||||
kwargs['description'] = data_utils.rand_name(
|
||||
name='desc', prefix=CONF.resource_name_prefix)
|
||||
domain = cls.domains_client.create_domain(**kwargs)['domain']
|
||||
cls.addClassResourceCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
cls.delete_domain, domain['id'])
|
||||
@ -274,9 +281,11 @@ class BaseIdentityV3AdminTest(BaseIdentityV3Test):
|
||||
def setup_test_project(self, **kwargs):
|
||||
"""Set up a test project."""
|
||||
if 'name' not in kwargs:
|
||||
kwargs['name'] = data_utils.rand_name('test_project')
|
||||
kwargs['name'] = data_utils.rand_name(
|
||||
name='test_project', prefix=CONF.resource_name_prefix)
|
||||
if 'description' not in kwargs:
|
||||
kwargs['description'] = data_utils.rand_name('test_description')
|
||||
kwargs['description'] = data_utils.rand_name(
|
||||
name='test_description', prefix=CONF.resource_name_prefix)
|
||||
project = self.projects_client.create_project(**kwargs)['project']
|
||||
# Delete the project at the end of the test
|
||||
self.addCleanup(
|
||||
@ -297,10 +306,12 @@ class BaseIdentityV3AdminTest(BaseIdentityV3Test):
|
||||
"""Set up a test group."""
|
||||
if 'name' not in kwargs:
|
||||
kwargs['name'] = data_utils.rand_name(
|
||||
self.__class__.__name__ + '_test_project')
|
||||
self.__class__.__name__ + '_test_project',
|
||||
prefix=CONF.resource_name_prefix)
|
||||
if 'description' not in kwargs:
|
||||
kwargs['description'] = data_utils.rand_name(
|
||||
self.__class__.__name__ + '_test_description')
|
||||
self.__class__.__name__ + '_test_description',
|
||||
prefix=CONF.resource_name_prefix)
|
||||
group = self.groups_client.create_group(**kwargs)['group']
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
@ -324,7 +335,8 @@ class BaseApplicationCredentialsV3Test(BaseIdentityV3Test):
|
||||
cls.project_id = cls.os_primary.credentials.project_id
|
||||
|
||||
def create_application_credential(self, name=None, **kwargs):
|
||||
name = name or data_utils.rand_name('application_credential')
|
||||
name = name or data_utils.rand_name(
|
||||
name='application_credential', prefix=CONF.resource_name_prefix)
|
||||
application_credential = (
|
||||
self.non_admin_app_creds_client.create_application_credential(
|
||||
self.user_id, name=name, **kwargs))['application_credential']
|
||||
|
@ -48,7 +48,9 @@ class AccessRulesV3Test(base.BaseIdentityV3Test):
|
||||
cls.ac = cls.non_admin_app_creds_client
|
||||
cls.app_cred = cls.ac.create_application_credential(
|
||||
cls.user_id,
|
||||
name=data_utils.rand_name('application_credential'),
|
||||
name=data_utils.rand_name(
|
||||
name='application_credential',
|
||||
prefix=CONF.resource_name_prefix),
|
||||
access_rules=access_rules
|
||||
)['application_credential']
|
||||
cls.addClassResourceCleanup(
|
||||
@ -77,7 +79,9 @@ class AccessRulesV3Test(base.BaseIdentityV3Test):
|
||||
]
|
||||
app_cred = self.ac.create_application_credential(
|
||||
self.user_id,
|
||||
name=data_utils.rand_name('application_credential'),
|
||||
name=data_utils.rand_name(
|
||||
name='application_credential',
|
||||
prefix=CONF.resource_name_prefix),
|
||||
access_rules=access_rules
|
||||
)['application_credential']
|
||||
self.addCleanup(
|
||||
|
@ -51,7 +51,9 @@ class BaseImageTest(tempest.test.BaseTestCase):
|
||||
"""Wrapper that returns a test image."""
|
||||
|
||||
if 'name' not in kwargs:
|
||||
name = data_utils.rand_name(cls.__name__ + "-image")
|
||||
name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=cls.__name__ + "-image")
|
||||
kwargs['name'] = name
|
||||
|
||||
image = cls.client.create_image(**kwargs)
|
||||
@ -83,7 +85,8 @@ class BaseV2ImageTest(BaseImageTest):
|
||||
description='Tempest', protected=False,
|
||||
**kwargs):
|
||||
if not namespace_name:
|
||||
namespace_name = data_utils.rand_name('test-ns')
|
||||
namespace_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='test-ns')
|
||||
kwargs.setdefault('display_name', namespace_name)
|
||||
namespace = self.namespaces_client.create_namespace(
|
||||
namespace=namespace_name, visibility=visibility,
|
||||
@ -200,7 +203,9 @@ class BaseV2MemberImageTest(BaseV2ImageTest):
|
||||
return image_ids
|
||||
|
||||
def _create_image(self):
|
||||
name = data_utils.rand_name(self.__class__.__name__ + '-image')
|
||||
name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__ + '-image')
|
||||
image = self.client.create_image(name=name,
|
||||
container_format='bare',
|
||||
disk_format='raw')
|
||||
|
@ -57,7 +57,9 @@ class ImageCachingTest(base.BaseV2ImageTest):
|
||||
def image_create_and_upload(self, upload=True, **kwargs):
|
||||
"""Wrapper that returns a test image."""
|
||||
if 'name' not in kwargs:
|
||||
name = data_utils.rand_name(self.__name__ + "-image")
|
||||
name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__name__ + "-image")
|
||||
kwargs['name'] = name
|
||||
|
||||
params = dict(kwargs)
|
||||
|
@ -61,7 +61,8 @@ class ImageTaskCreate(base.BaseV2ImageAdminTest):
|
||||
i = 0
|
||||
tasks = list()
|
||||
while i < len(disk_format):
|
||||
image_name = data_utils.rand_name("task_image")
|
||||
image_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name="task_image")
|
||||
image_property = {"container_format": "bare",
|
||||
"disk_format": disk_format[0],
|
||||
"visibility": "public",
|
||||
@ -126,8 +127,12 @@ class ImageTaskCreate(base.BaseV2ImageAdminTest):
|
||||
@decorators.idempotent_id("ad6450c6-7060-4ee7-a2d1-41c2604b446c")
|
||||
@decorators.attr(type=['negative'])
|
||||
def test_task_create_fake_image_location(self):
|
||||
kwargs = {
|
||||
'prefix': CONF.resource_name_prefix,
|
||||
'name': 'dummy-img-file'
|
||||
}
|
||||
http_fake_url = ''.join(
|
||||
["http://", data_utils.rand_name('dummy-img-file'), ".qcow2"])
|
||||
["http://", data_utils.rand_name(**kwargs), ".qcow2"])
|
||||
task = self._prepare_image_tasks_param(
|
||||
image_from_format=['qcow2'],
|
||||
disk_format=['qcow2'],
|
||||
|
@ -63,7 +63,9 @@ class BasicOperationsImagesAdminTest(base.BaseV2ImageAdminTest):
|
||||
@decorators.idempotent_id('f6ab4aa0-035e-4664-9f2d-c57c6df50605')
|
||||
def test_list_public_image(self):
|
||||
"""Test create image as admin and list public image as none admin"""
|
||||
name = data_utils.rand_name(self.__class__.__name__ + '-Image')
|
||||
name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__ + '-Image')
|
||||
image = self.admin_client.create_image(
|
||||
name=name,
|
||||
container_format='bare',
|
||||
@ -107,7 +109,8 @@ class ImportCopyImagesTest(base.BaseV2ImageAdminTest):
|
||||
raise self.skipException('Either copy-image import method or '
|
||||
'multistore is not available')
|
||||
uuid = data_utils.rand_uuid()
|
||||
image_name = data_utils.rand_name('copy-image')
|
||||
image_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='copy-image')
|
||||
container_format = CONF.image.container_formats[0]
|
||||
disk_format = CONF.image.disk_formats[0]
|
||||
image = self.create_image(name=image_name,
|
||||
|
@ -11,16 +11,21 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.image import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class MetadataNamespaceObjectsTest(base.BaseV2ImageAdminTest):
|
||||
"""Test the Metadata definition namespace objects basic functionality"""
|
||||
|
||||
def _create_namespace_object(self, namespace):
|
||||
object_name = data_utils.rand_name(self.__class__.__name__ + '-object')
|
||||
object_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name=self.__class__.__name__ + '-object')
|
||||
namespace_object = self.namespace_objects_client.\
|
||||
create_namespace_object(namespace['namespace'], name=object_name)
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
@ -36,7 +41,8 @@ class MetadataNamespaceObjectsTest(base.BaseV2ImageAdminTest):
|
||||
# Create a namespace object
|
||||
body = self._create_namespace_object(namespace)
|
||||
# Update a namespace object
|
||||
up_object_name = data_utils.rand_name('update-object')
|
||||
up_object_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='update-object')
|
||||
body = self.namespace_objects_client.update_namespace_object(
|
||||
namespace['namespace'], body['name'],
|
||||
name=up_object_name)
|
||||
|
@ -11,9 +11,12 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.image import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class MetadataNamespacePropertiesTest(base.BaseV2ImageAdminTest):
|
||||
"""Test the Metadata definition namespace property basic functionality"""
|
||||
@ -31,7 +34,8 @@ class MetadataNamespacePropertiesTest(base.BaseV2ImageAdminTest):
|
||||
body = self.resource_types_client.create_resource_type_association(
|
||||
namespace['namespace'], name=resource_name)
|
||||
# Create a property
|
||||
property_title = data_utils.rand_name('property')
|
||||
property_title = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='property')
|
||||
body = self.namespace_properties_client.create_namespace_property(
|
||||
namespace=namespace['namespace'], title=property_title,
|
||||
name=resource_name, type="string", enum=enum)
|
||||
@ -41,7 +45,9 @@ class MetadataNamespacePropertiesTest(base.BaseV2ImageAdminTest):
|
||||
namespace['namespace'], resource_name)
|
||||
self.assertEqual(resource_name, body['name'])
|
||||
# Update namespace property
|
||||
update_property_title = data_utils.rand_name('update-property')
|
||||
update_property_title = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix,
|
||||
name='update-property')
|
||||
body = self.namespace_properties_client.update_namespace_properties(
|
||||
namespace['namespace'], resource_name,
|
||||
title=update_property_title, type="string",
|
||||
|
@ -11,10 +11,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.image import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class MetadataNamespaceTagsTest(base.BaseV2ImageAdminTest):
|
||||
"""Test the Metadata definition namespace tags basic functionality"""
|
||||
@ -68,7 +71,8 @@ class MetadataNamespaceTagsTest(base.BaseV2ImageAdminTest):
|
||||
namespace = self.create_namespace()
|
||||
self._create_namespace_tags(namespace)
|
||||
# Create a tag
|
||||
tag_name = data_utils.rand_name('tag_name')
|
||||
tag_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='tag_name')
|
||||
self.namespace_tags_client.create_namespace_tag(
|
||||
namespace=namespace['namespace'], tag_name=tag_name)
|
||||
|
||||
@ -76,7 +80,8 @@ class MetadataNamespaceTagsTest(base.BaseV2ImageAdminTest):
|
||||
namespace['namespace'], tag_name)
|
||||
self.assertEqual(tag_name, body['name'])
|
||||
# Update tag definition
|
||||
update_tag_definition = data_utils.rand_name('update-tag')
|
||||
update_tag_definition = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='update-tag')
|
||||
body = self.namespace_tags_client.update_namespace_tag(
|
||||
namespace['namespace'], tag_name=tag_name,
|
||||
name=update_tag_definition)
|
||||
|
@ -14,11 +14,14 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.image import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class MetadataNamespacesTest(base.BaseV2ImageAdminTest):
|
||||
"""Test the Metadata definition Namespaces basic functionality"""
|
||||
@ -30,7 +33,8 @@ class MetadataNamespacesTest(base.BaseV2ImageAdminTest):
|
||||
body = self.resource_types_client.list_resource_types()
|
||||
resource_name = body['resource_types'][0]['name']
|
||||
name = [{'name': resource_name}]
|
||||
namespace_name = data_utils.rand_name('namespace')
|
||||
namespace_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='namespace')
|
||||
# create the metadef namespace
|
||||
body = self.namespaces_client.create_namespace(
|
||||
namespace=namespace_name,
|
||||
|
@ -53,7 +53,8 @@ class ImportImagesTest(base.BaseV2ImageTest):
|
||||
def _create_image(self, disk_format=None, container_format=None):
|
||||
# Create image
|
||||
uuid = '00000000-1111-2222-3333-444455556666'
|
||||
image_name = data_utils.rand_name('image')
|
||||
image_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='image')
|
||||
container_format = container_format or CONF.image.container_formats[0]
|
||||
disk_format = disk_format or CONF.image.disk_formats[0]
|
||||
image = self.create_image(name=image_name,
|
||||
@ -345,7 +346,8 @@ class MultiStoresImportImagesTest(base.BaseV2ImageTest):
|
||||
|
||||
def _create_and_stage_image(self, all_stores=False):
|
||||
"""Create Image & stage image file for glance-direct import method."""
|
||||
image_name = data_utils.rand_name('test-image')
|
||||
image_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='test-image')
|
||||
container_format = CONF.image.container_formats[0]
|
||||
disk_format = CONF.image.disk_formats[0]
|
||||
image = self.create_image(name=image_name,
|
||||
@ -416,7 +418,8 @@ class BasicOperationsImagesTest(base.BaseV2ImageTest):
|
||||
"""
|
||||
|
||||
uuid = '00000000-1111-2222-3333-444455556666'
|
||||
image_name = data_utils.rand_name('image')
|
||||
image_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='image')
|
||||
container_format = CONF.image.container_formats[0]
|
||||
disk_format = CONF.image.disk_formats[0]
|
||||
image = self.create_image(name=image_name,
|
||||
@ -464,7 +467,8 @@ class BasicOperationsImagesTest(base.BaseV2ImageTest):
|
||||
def test_delete_image(self):
|
||||
"""Test deleting an image by image_id"""
|
||||
# Create image
|
||||
image_name = data_utils.rand_name('image')
|
||||
image_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='image')
|
||||
container_format = CONF.image.container_formats[0]
|
||||
disk_format = CONF.image.disk_formats[0]
|
||||
image = self.create_image(name=image_name,
|
||||
@ -485,7 +489,8 @@ class BasicOperationsImagesTest(base.BaseV2ImageTest):
|
||||
def test_update_image(self):
|
||||
"""Test updating an image by image_id"""
|
||||
# Create image
|
||||
image_name = data_utils.rand_name('image')
|
||||
image_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='image')
|
||||
container_format = CONF.image.container_formats[0]
|
||||
disk_format = CONF.image.disk_formats[0]
|
||||
image = self.create_image(name=image_name,
|
||||
@ -495,7 +500,8 @@ class BasicOperationsImagesTest(base.BaseV2ImageTest):
|
||||
self.assertEqual('queued', image['status'])
|
||||
|
||||
# Update Image
|
||||
new_image_name = data_utils.rand_name('new-image')
|
||||
new_image_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='new-image')
|
||||
self.client.update_image(image['id'], [
|
||||
dict(replace='/name', value=new_image_name)])
|
||||
|
||||
@ -509,7 +515,8 @@ class BasicOperationsImagesTest(base.BaseV2ImageTest):
|
||||
def test_deactivate_reactivate_image(self):
|
||||
"""Test deactivating and reactivating an image"""
|
||||
# Create image
|
||||
image_name = data_utils.rand_name('image')
|
||||
image_name = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='image')
|
||||
image = self.create_image(name=image_name,
|
||||
container_format='bare',
|
||||
disk_format='raw',
|
||||
@ -568,7 +575,9 @@ class ListUserImagesTest(base.BaseV2ImageTest):
|
||||
"""
|
||||
size = random.randint(1024, 4096)
|
||||
image_file = io.BytesIO(data_utils.random_bytes(size))
|
||||
tags = [data_utils.rand_name('tag'), data_utils.rand_name('tag')]
|
||||
prefix = CONF.resource_name_prefix
|
||||
tags = [data_utils.rand_name(prefix=prefix, name='tag'),
|
||||
data_utils.rand_name(prefix=prefix, name='tag')]
|
||||
image = cls.create_image(container_format=container_format,
|
||||
disk_format=disk_format,
|
||||
visibility='private',
|
||||
|
@ -13,9 +13,12 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.image import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ImagesTagsTest(base.BaseV2ImageTest):
|
||||
"""Test image tags"""
|
||||
@ -26,7 +29,8 @@ class ImagesTagsTest(base.BaseV2ImageTest):
|
||||
image = self.create_image(container_format='bare',
|
||||
disk_format='raw',
|
||||
visibility='private')
|
||||
tag = data_utils.rand_name('tag')
|
||||
tag = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='tag')
|
||||
self.addCleanup(self.client.delete_image, image['id'])
|
||||
|
||||
# Creating image tag and verify it.
|
||||
|
@ -13,10 +13,13 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.image import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ImagesTagsNegativeTest(base.BaseV2ImageTest):
|
||||
"""Negative tests of image tags"""
|
||||
@ -25,7 +28,8 @@ class ImagesTagsNegativeTest(base.BaseV2ImageTest):
|
||||
@decorators.idempotent_id('8cd30f82-6f9a-4c6e-8034-c1b51fba43d9')
|
||||
def test_update_tags_for_non_existing_image(self):
|
||||
"""Update image tag with non existing image"""
|
||||
tag = data_utils.rand_name('tag')
|
||||
tag = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='tag')
|
||||
non_exist_image = data_utils.rand_uuid()
|
||||
self.assertRaises(lib_exc.NotFound, self.client.add_image_tag,
|
||||
non_exist_image, tag)
|
||||
@ -38,7 +42,8 @@ class ImagesTagsNegativeTest(base.BaseV2ImageTest):
|
||||
disk_format='raw',
|
||||
visibility='private'
|
||||
)
|
||||
tag = data_utils.rand_name('non-exist-tag')
|
||||
tag = data_utils.rand_name(
|
||||
prefix=CONF.resource_name_prefix, name='non-exist-tag')
|
||||
self.addCleanup(self.client.delete_image, image['id'])
|
||||
self.assertRaises(lib_exc.NotFound, self.client.delete_image_tag,
|
||||
image['id'], tag)
|
||||
|
@ -31,7 +31,8 @@ class ExternalNetworksTestJSON(base.BaseAdminNetworkTest):
|
||||
cls.network = cls.create_network()
|
||||
|
||||
def _create_network(self, external=True):
|
||||
post_body = {'name': data_utils.rand_name('network-')}
|
||||
post_body = {'name': data_utils.rand_name(
|
||||
name='network-', prefix=CONF.resource_name_prefix)}
|
||||
if external:
|
||||
post_body['router:external'] = external
|
||||
body = self.admin_networks_client.create_network(**post_body)
|
||||
|
@ -54,6 +54,8 @@ class ExternalNetworksAdminNegativeTestJSON(base.BaseAdminNetworkTest):
|
||||
# create a port which will internally create an instance-ip
|
||||
self.assertRaises(lib_exc.Conflict,
|
||||
self.admin_ports_client.create_port,
|
||||
name=data_utils.rand_name(self.__class__.__name__),
|
||||
name=data_utils.rand_name(
|
||||
self.__class__.__name__,
|
||||
prefix=CONF.resource_name_prefix),
|
||||
network_id=CONF.network.public_network_id,
|
||||
fixed_ips=fixed_ips)
|
||||
|
@ -14,10 +14,13 @@
|
||||
|
||||
from tempest.api.network import base
|
||||
from tempest.common import utils
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class MeteringTestJSON(base.BaseAdminNetworkTest):
|
||||
"""Tests the following operations in the Neutron API:
|
||||
@ -37,7 +40,8 @@ class MeteringTestJSON(base.BaseAdminNetworkTest):
|
||||
def resource_setup(cls):
|
||||
super(MeteringTestJSON, cls).resource_setup()
|
||||
description = "metering label created by tempest"
|
||||
name = data_utils.rand_name("metering-label")
|
||||
name = data_utils.rand_name(
|
||||
name="metering-label", prefix=CONF.resource_name_prefix)
|
||||
cls.metering_label = cls.create_metering_label(name, description)
|
||||
remote_ip_prefix = ("10.0.0.0/24" if cls._ip_version == 4
|
||||
else "fd02::/64")
|
||||
@ -101,7 +105,8 @@ class MeteringTestJSON(base.BaseAdminNetworkTest):
|
||||
def test_create_delete_metering_label_with_filters(self):
|
||||
"""Verifies creating and deleting metering label with filters"""
|
||||
# Creates a label
|
||||
name = data_utils.rand_name('metering-label-')
|
||||
name = data_utils.rand_name(
|
||||
name='metering-label-', prefix=CONF.resource_name_prefix)
|
||||
description = "label created by tempest"
|
||||
body = self.admin_metering_labels_client.create_metering_label(
|
||||
name=name, description=description)
|
||||
|
@ -45,7 +45,9 @@ class PortsAdminExtendedAttrsTestJSON(base.BaseAdminNetworkTest):
|
||||
"""Test creating port with extended attribute"""
|
||||
post_body = {"network_id": self.network['id'],
|
||||
"binding:host_id": self.host_id,
|
||||
"name": data_utils.rand_name(self.__class__.__name__)}
|
||||
"name": data_utils.rand_name(
|
||||
self.__class__.__name__,
|
||||
prefix=CONF.resource_name_prefix)}
|
||||
body = self.admin_ports_client.create_port(**post_body)
|
||||
port = body['port']
|
||||
self.addCleanup(self.admin_ports_client.wait_for_resource_deletion,
|
||||
@ -62,7 +64,9 @@ class PortsAdminExtendedAttrsTestJSON(base.BaseAdminNetworkTest):
|
||||
def test_update_port_binding_ext_attr(self):
|
||||
"""Test updating port's extended attribute"""
|
||||
post_body = {"network_id": self.network['id'],
|
||||
"name": data_utils.rand_name(self.__class__.__name__)}
|
||||
"name": data_utils.rand_name(
|
||||
self.__class__.__name__,
|
||||
prefix=CONF.resource_name_prefix)}
|
||||
body = self.admin_ports_client.create_port(**post_body)
|
||||
port = body['port']
|
||||
self.addCleanup(self.admin_ports_client.wait_for_resource_deletion,
|
||||
@ -83,7 +87,9 @@ class PortsAdminExtendedAttrsTestJSON(base.BaseAdminNetworkTest):
|
||||
"""Test updating and listing port's extended attribute"""
|
||||
# Create a new port
|
||||
post_body = {"network_id": self.network['id'],
|
||||
"name": data_utils.rand_name(self.__class__.__name__)}
|
||||
"name": data_utils.rand_name(
|
||||
self.__class__.__name__,
|
||||
prefix=CONF.resource_name_prefix)}
|
||||
body = self.admin_ports_client.create_port(**post_body)
|
||||
port = body['port']
|
||||
self.addCleanup(self.admin_ports_client.wait_for_resource_deletion,
|
||||
@ -113,7 +119,8 @@ class PortsAdminExtendedAttrsTestJSON(base.BaseAdminNetworkTest):
|
||||
def test_show_port_binding_ext_attr(self):
|
||||
"""Test showing port's extended attribute"""
|
||||
body = self.admin_ports_client.create_port(
|
||||
name=data_utils.rand_name(self.__class__.__name__),
|
||||
name=data_utils.rand_name(
|
||||
self.__class__.__name__, prefix=CONF.resource_name_prefix),
|
||||
network_id=self.network['id'])
|
||||
port = body['port']
|
||||
self.addCleanup(self.admin_ports_client.wait_for_resource_deletion,
|
||||
|
@ -54,16 +54,17 @@ class RoutersAdminTest(base.BaseAdminNetworkTest):
|
||||
|
||||
@decorators.idempotent_id('e54dd3a3-4352-4921-b09d-44369ae17397')
|
||||
def test_create_router_setting_project_id(self):
|
||||
prefix = CONF.resource_name_prefix
|
||||
"""Test creating router from admin user setting project_id."""
|
||||
project = data_utils.rand_name('test_tenant_')
|
||||
description = data_utils.rand_name('desc_')
|
||||
project = data_utils.rand_name(name='test_tenant_', prefix=prefix)
|
||||
description = data_utils.rand_name(name='desc_', prefix=prefix)
|
||||
project = identity.identity_utils(self.os_admin).create_project(
|
||||
name=project, description=description)
|
||||
project_id = project['id']
|
||||
self.addCleanup(identity.identity_utils(self.os_admin).delete_project,
|
||||
project_id)
|
||||
|
||||
name = data_utils.rand_name('router-')
|
||||
name = data_utils.rand_name(name='router-', prefix=prefix)
|
||||
create_body = self.admin_routers_client.create_router(
|
||||
name=name, project_id=project_id)
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
@ -89,7 +90,8 @@ class RoutersAdminTest(base.BaseAdminNetworkTest):
|
||||
'The public_network_id option must be specified.')
|
||||
def test_create_router_with_snat_explicit(self):
|
||||
"""Test creating router with specified enable_snat value"""
|
||||
name = data_utils.rand_name('snat-router')
|
||||
name = data_utils.rand_name(
|
||||
'snat-router', prefix=CONF.resource_name_prefix)
|
||||
# Create a router enabling snat attributes
|
||||
enable_snat_states = [False, True]
|
||||
for enable_snat in enable_snat_states:
|
||||
@ -226,7 +228,8 @@ class RoutersAdminTest(base.BaseAdminNetworkTest):
|
||||
"""Test creating router setting gateway with fixed ip"""
|
||||
# At first create an external network and then use that
|
||||
# to create address and delete
|
||||
network_name = data_utils.rand_name(self.__class__.__name__)
|
||||
network_name = data_utils.rand_name(
|
||||
self.__class__.__name__, prefix=CONF.resource_name_prefix)
|
||||
network_1 = self.admin_networks_client.create_network(
|
||||
name=network_name, **{'router:external': True})['network']
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
@ -237,7 +240,8 @@ class RoutersAdminTest(base.BaseAdminNetworkTest):
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_subnets_client.delete_subnet, subnet['id'])
|
||||
port = self.admin_ports_client.create_port(
|
||||
name=data_utils.rand_name(self.__class__.__name__),
|
||||
name=data_utils.rand_name(
|
||||
self.__class__.__name__, prefix=CONF.resource_name_prefix),
|
||||
network_id=network_1['id'])['port']
|
||||
self.admin_ports_client.delete_port(port_id=port['id'])
|
||||
fixed_ip = {
|
||||
|
@ -17,10 +17,13 @@ import testtools
|
||||
|
||||
from tempest.api.network import base
|
||||
from tempest.common import utils
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class RoutersTestDVR(base.BaseAdminNetworkTest):
|
||||
|
||||
@ -41,7 +44,8 @@ class RoutersTestDVR(base.BaseAdminNetworkTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(RoutersTestDVR, cls).resource_setup()
|
||||
name = data_utils.rand_name('pretest-check')
|
||||
name = data_utils.rand_name(
|
||||
name='pretest-check', prefix=CONF.resource_name_prefix)
|
||||
router = cls.admin_routers_client.create_router(name=name)
|
||||
cls.admin_routers_client.delete_router(router['router']['id'])
|
||||
if 'distributed' not in router['router']:
|
||||
@ -60,7 +64,8 @@ class RoutersTestDVR(base.BaseAdminNetworkTest):
|
||||
The router is created and the "distributed" attribute is
|
||||
set to True
|
||||
"""
|
||||
name = data_utils.rand_name('router')
|
||||
name = data_utils.rand_name(
|
||||
name='router', prefix=CONF.resource_name_prefix)
|
||||
router = self.admin_routers_client.create_router(name=name,
|
||||
distributed=True)
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
@ -81,7 +86,8 @@ class RoutersTestDVR(base.BaseAdminNetworkTest):
|
||||
set to False, thus making it a "Centralized Virtual Router"
|
||||
as opposed to a "Distributed Virtual Router"
|
||||
"""
|
||||
name = data_utils.rand_name('router')
|
||||
name = data_utils.rand_name(
|
||||
name='router', prefix=CONF.resource_name_prefix)
|
||||
router = self.admin_routers_client.create_router(name=name,
|
||||
distributed=False)
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
@ -105,7 +111,8 @@ class RoutersTestDVR(base.BaseAdminNetworkTest):
|
||||
set to False. Once the router is updated, the distributed
|
||||
attribute will be set to True
|
||||
"""
|
||||
name = data_utils.rand_name('router')
|
||||
name = data_utils.rand_name(
|
||||
name='router', prefix=CONF.resource_name_prefix)
|
||||
project_id = self.routers_client.project_id
|
||||
# router needs to be in admin state down in order to be upgraded to DVR
|
||||
# l3ha routers are not upgradable to dvr, make it explicitly non ha
|
||||
|
@ -45,7 +45,8 @@ class RoutersAdminNegativeTest(base.BaseAdminNetworkTest):
|
||||
"""Test creating router with gateway set to used ip should fail"""
|
||||
# At first create a address from public_network_id
|
||||
port = self.admin_ports_client.create_port(
|
||||
name=data_utils.rand_name(self.__class__.__name__),
|
||||
name=data_utils.rand_name(
|
||||
self.__class__.__name__, prefix=CONF.resource_name_prefix),
|
||||
network_id=CONF.network.public_network_id)['port']
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_ports_client.delete_port,
|
||||
|
@ -104,7 +104,7 @@ class BaseNetworkTest(tempest.test.BaseTestCase):
|
||||
def create_network(cls, network_name=None, **kwargs):
|
||||
"""Wrapper utility that returns a test network."""
|
||||
network_name = network_name or data_utils.rand_name(
|
||||
cls.__name__ + '-test-network')
|
||||
cls.__name__ + '-test-network', prefix=CONF.resource_name_prefix)
|
||||
|
||||
body = cls.networks_client.create_network(name=network_name, **kwargs)
|
||||
network = body['network']
|
||||
@ -161,7 +161,8 @@ class BaseNetworkTest(tempest.test.BaseTestCase):
|
||||
@classmethod
|
||||
def create_port(cls, network, **kwargs):
|
||||
if 'name' not in kwargs:
|
||||
kwargs['name'] = data_utils.rand_name(cls.__name__)
|
||||
kwargs['name'] = data_utils.rand_name(
|
||||
cls.__name__, prefix=CONF.resource_name_prefix)
|
||||
"""Wrapper utility that returns a test port."""
|
||||
body = cls.ports_client.create_port(network_id=network['id'],
|
||||
**kwargs)
|
||||
@ -182,7 +183,7 @@ class BaseNetworkTest(tempest.test.BaseTestCase):
|
||||
external_network_id=None, enable_snat=None,
|
||||
**kwargs):
|
||||
router_name = router_name or data_utils.rand_name(
|
||||
cls.__name__ + "-router")
|
||||
cls.__name__ + "-router", prefix=CONF.resource_name_prefix)
|
||||
|
||||
ext_gw_info = {}
|
||||
if external_network_id:
|
||||
|
@ -14,15 +14,19 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.network import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class BaseSecGroupTest(base.BaseNetworkTest):
|
||||
|
||||
def _create_security_group(self):
|
||||
# Create a security group
|
||||
name = data_utils.rand_name('secgroup-')
|
||||
name = data_utils.rand_name(
|
||||
name='secgroup-', prefix=CONF.resource_name_prefix)
|
||||
group_create_body = (
|
||||
self.security_groups_client.create_security_group(name=name))
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
|
@ -15,10 +15,13 @@
|
||||
|
||||
from tempest.api.network import base
|
||||
from tempest.common import utils
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class AllowedAddressPairTestJSON(base.BaseNetworkTest):
|
||||
"""Tests the Neutron Allowed Address Pair API extension
|
||||
@ -60,7 +63,8 @@ class AllowedAddressPairTestJSON(base.BaseNetworkTest):
|
||||
'mac_address': self.mac_address}]
|
||||
body = self.ports_client.create_port(
|
||||
network_id=self.network['id'],
|
||||
name=data_utils.rand_name(self.__class__.__name__),
|
||||
name=data_utils.rand_name(
|
||||
self.__class__.__name__, prefix=CONF.resource_name_prefix),
|
||||
allowed_address_pairs=allowed_address_pairs)
|
||||
port_id = body['port']['id']
|
||||
self.addCleanup(self.ports_client.wait_for_resource_deletion,
|
||||
@ -80,7 +84,8 @@ class AllowedAddressPairTestJSON(base.BaseNetworkTest):
|
||||
# Create a port without allowed address pair
|
||||
body = self.ports_client.create_port(
|
||||
network_id=self.network['id'],
|
||||
name=data_utils.rand_name(self.__class__.__name__))
|
||||
name=data_utils.rand_name(
|
||||
self.__class__.__name__, prefix=CONF.resource_name_prefix))
|
||||
port_id = body['port']['id']
|
||||
self.addCleanup(self.ports_client.wait_for_resource_deletion,
|
||||
port_id)
|
||||
@ -126,7 +131,8 @@ class AllowedAddressPairTestJSON(base.BaseNetworkTest):
|
||||
"""Update allowed address pair port with multiple ip and mac"""
|
||||
resp = self.ports_client.create_port(
|
||||
network_id=self.network['id'],
|
||||
name=data_utils.rand_name(self.__class__.__name__))
|
||||
name=data_utils.rand_name(
|
||||
self.__class__.__name__, prefix=CONF.resource_name_prefix))
|
||||
newportid = resp['port']['id']
|
||||
self.addCleanup(self.ports_client.wait_for_resource_deletion,
|
||||
newportid)
|
||||
|
@ -15,10 +15,13 @@
|
||||
|
||||
from tempest.api.network import base
|
||||
from tempest.common import utils
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ExtraDHCPOptionsTestJSON(base.BaseNetworkTest):
|
||||
"""Tests the following operations with the Extra DHCP Options:
|
||||
@ -61,7 +64,8 @@ class ExtraDHCPOptionsTestJSON(base.BaseNetworkTest):
|
||||
"""Test creating a port with Extra DHCP Options and list those"""
|
||||
body = self.ports_client.create_port(
|
||||
network_id=self.network['id'],
|
||||
name=data_utils.rand_name(self.__class__.__name__),
|
||||
name=data_utils.rand_name(
|
||||
self.__class__.__name__, prefix=CONF.resource_name_prefix),
|
||||
extra_dhcp_opts=self.extra_dhcp_opts)
|
||||
port_id = body['port']['id']
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
@ -77,7 +81,8 @@ class ExtraDHCPOptionsTestJSON(base.BaseNetworkTest):
|
||||
@decorators.idempotent_id('9a6aebf4-86ee-4f47-b07a-7f7232c55607')
|
||||
def test_update_show_port_with_extra_dhcp_options(self):
|
||||
"""Test updating port with extra DHCP options and show that port"""
|
||||
name = data_utils.rand_name('new-port-name')
|
||||
name = data_utils.rand_name(
|
||||
name='new-port-name', prefix=CONF.resource_name_prefix)
|
||||
self.ports_client.update_port(
|
||||
self.port['id'],
|
||||
name=name,
|
||||
|
@ -153,7 +153,8 @@ class FloatingIPTestJSON(base.BaseNetworkTest):
|
||||
# Create a port
|
||||
port = self.ports_client.create_port(
|
||||
network_id=self.network['id'],
|
||||
name=data_utils.rand_name(self.__class__.__name__))
|
||||
name=data_utils.rand_name(
|
||||
self.__class__.__name__, prefix=CONF.resource_name_prefix))
|
||||
created_port = port['port']
|
||||
floating_ip = self.floating_ips_client.update_floatingip(
|
||||
created_floating_ip['id'],
|
||||
@ -183,7 +184,8 @@ class FloatingIPTestJSON(base.BaseNetworkTest):
|
||||
self.floating_ips_client.delete_floatingip,
|
||||
created_floating_ip['id'])
|
||||
self.assertEqual(created_floating_ip['router_id'], self.router['id'])
|
||||
network_name = data_utils.rand_name(self.__class__.__name__)
|
||||
network_name = data_utils.rand_name(
|
||||
self.__class__.__name__, prefix=CONF.resource_name_prefix)
|
||||
network2 = self.networks_client.create_network(
|
||||
name=network_name)['network']
|
||||
self.addCleanup(
|
||||
@ -258,7 +260,8 @@ class FloatingIPTestJSON(base.BaseNetworkTest):
|
||||
# Create port
|
||||
body = self.ports_client.create_port(
|
||||
network_id=self.network['id'],
|
||||
name=data_utils.rand_name(self.__class__.__name__),
|
||||
name=data_utils.rand_name(
|
||||
self.__class__.__name__, prefix=CONF.resource_name_prefix),
|
||||
fixed_ips=fixed_ips)
|
||||
port = body['port']
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user