本文整理汇总了Python中tempest_lib.common.utils.data_utils.rand_uuid函数的典型用法代码示例。如果您正苦于以下问题:Python rand_uuid函数的具体用法?Python rand_uuid怎么用?Python rand_uuid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rand_uuid函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_rand_uuid
def test_rand_uuid(self):
actual = data_utils.rand_uuid()
self.assertIsInstance(actual, str)
self.assertRegexpMatches(actual, "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]"
"{4}-[0-9a-f]{4}-[0-9a-f]{12}$")
actual2 = data_utils.rand_uuid()
self.assertNotEqual(actual, actual2)
开发者ID:overcastcloud,项目名称:tempest-lib,代码行数:7,代码来源:test_data_utils.py
示例2: test_delete_metadata_non_existent_server
def test_delete_metadata_non_existent_server(self):
# Should not be able to delete metadata item from a non-existent server
non_existent_server_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.client.delete_server_metadata_item,
non_existent_server_id,
'd')
开发者ID:calba,项目名称:tempest,代码行数:7,代码来源:test_server_metadata_negative.py
示例3: test_server_metadata_non_existent_server
def test_server_metadata_non_existent_server(self):
# GET on a non-existent server should not succeed
non_existent_server_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.client.get_server_metadata_item,
non_existent_server_id,
'test2')
开发者ID:calba,项目名称:tempest,代码行数:7,代码来源:test_server_metadata_negative.py
示例4: baymodel_data
def baymodel_data(**kwargs):
"""Generates random baymodel data
Keypair and image id cannot be random for the baymodel to be valid due to
validations for the presence of keypair and image id prior to baymodel
creation.
:param keypair_id: keypair name
:param image_id: image id or name
:returns: BayModelEntity with generated data
"""
data = {
"name": data_utils.rand_name('bay'),
"coe": "swarm",
"tls_disabled": False,
"network_driver": None,
"volume_driver": None,
"docker_volume_size": 3,
"labels": {},
"fixed_network": "192.168.0.0/24",
"dns_nameserver": "8.8.8.8",
"flavor_id": data_utils.rand_name('bay'),
"master_flavor_id": data_utils.rand_name('bay'),
"external_network_id": str(data_utils.rand_uuid()),
"keypair_id": data_utils.rand_name('bay'),
"image_id": data_utils.rand_name('bay')
}
data.update(kwargs)
model = baymodel_model.BayModelEntity.from_dict(data)
return model
开发者ID:baikai,项目名称:magnum,代码行数:33,代码来源:datagen.py
示例5: bay_data
def bay_data(name=data_utils.rand_name('bay'),
baymodel_id=data_utils.rand_uuid(),
node_count=random_int(1, 5), discovery_url=gen_random_ip(),
bay_create_timeout=random_int(1, 30),
master_count=random_int(1, 5)):
"""Generates random bay data
BayModel_id cannot be random for the bay to be valid due to
validations for the presence of baymodel prior to baymodel
creation.
:param name: bay name (must be unique)
:param baymodel_id: baymodel unique id (must already exist)
:param node_count: number of agents for bay
:param discovery_url: url provided for node discovery
:param bay_create_timeout: timeout in minutes for bay create
:param master_count: number of master nodes for the bay
:returns: BayEntity with generated data
"""
data = {
"name": name,
"baymodel_id": baymodel_id,
"node_count": node_count,
"discovery_url": None,
"bay_create_timeout": bay_create_timeout,
"master_count": master_count
}
model = bay_model.BayEntity.from_dict(data)
return model
开发者ID:baikai,项目名称:magnum,代码行数:31,代码来源:datagen.py
示例6: test_metadata
def test_metadata(self):
key_name = data_utils.rand_name('testkey')
self.client.import_key_pair(KeyName=key_name,
PublicKeyMaterial=PUBLIC_KEY_MATERIAL)
self.addResourceCleanUp(self.client.delete_key_pair, KeyName=key_name)
sec_group_name = self.create_standard_security_group()
user_data = six.text_type(data_utils.rand_uuid()) + six.unichr(1071)
instance_id = self.run_instance(KeyName=key_name, UserData=user_data,
SecurityGroups=[sec_group_name])
data = self.client.describe_instance_attribute(
InstanceId=instance_id, Attribute='userData')
self.assertEqual(
data['UserData']['Value'],
base64.b64encode(user_data.encode("utf-8")).decode("utf-8"))
ip_address = self.get_instance_ip(instance_id)
ssh_client = ssh.Client(ip_address, CONF.aws.image_user,
pkey=PRIVATE_KEY_MATERIAL)
url = 'http://169.254.169.254'
data = ssh_client.exec_command('curl %s/latest/user-data' % url)
if isinstance(data, six.binary_type):
data = data.decode("utf-8")
self.assertEqual(user_data, data)
data = ssh_client.exec_command('curl %s/latest/meta-data/ami-id' % url)
self.assertEqual(CONF.aws.image_id, data)
data = ssh_client.exec_command(
'curl %s/latest/meta-data/public-keys/0/openssh-key' % url)
# compare only keys. without 'sha-rsa' and owner
self.assertEqual(PUBLIC_KEY_MATERIAL.split()[1], data.split()[1])
开发者ID:JioCloudCompute,项目名称:ec2-api,代码行数:35,代码来源:test_instances.py
示例7: test_compare_console_output
def test_compare_console_output(self):
key_name = data_utils.rand_name('testkey')
pkey = self.create_key_pair(key_name)
sec_group_name = self.create_standard_security_group()
instance_id = self.run_instance(KeyName=key_name,
SecurityGroups=[sec_group_name])
data_to_check = data_utils.rand_uuid()
ip_address = self.get_instance_ip(instance_id)
ssh_client = ssh.Client(ip_address, CONF.aws.image_user, pkey=pkey)
cmd = 'sudo sh -c "echo \\"%s\\" >/dev/console"' % data_to_check
ssh_client.exec_command(cmd)
waiter = base.EC2Waiter(self.client.get_console_output)
waiter.wait_no_exception(InstanceId=instance_id)
def _compare_console_output():
data = self.client.get_console_output(InstanceId=instance_id)
self.assertEqual(instance_id, data['InstanceId'])
self.assertIsNotNone(data['Timestamp'])
self.assertIn('Output', data)
self.assertIn(data_to_check, data['Output'])
waiter = base.EC2Waiter(_compare_console_output)
waiter.wait_no_exception()
开发者ID:JioCloudCompute,项目名称:ec2-api,代码行数:25,代码来源:test_instances.py
示例8: test_update_baymodel_404
def test_update_baymodel_404(self):
patch_model = datagen.baymodel_name_patch_data()
self.assertRaises(
exceptions.NotFound,
self.baymodel_client.patch_baymodel,
data_utils.rand_uuid(), patch_model)
开发者ID:MatMaul,项目名称:magnum,代码行数:7,代码来源:test_baymodel.py
示例9: test_rebuild_non_existent_server
def test_rebuild_non_existent_server(self):
# Rebuild a non existent server
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.client.rebuild,
nonexistent_server,
self.image_ref_alt)
开发者ID:Dynavisor,项目名称:tempest,代码行数:7,代码来源:test_servers_negative.py
示例10: test_update_metadata_non_existent_server
def test_update_metadata_non_existent_server(self):
# An update should not happen for a non-existent server
non_existent_server_id = data_utils.rand_uuid()
meta = {'key1': 'value1', 'key2': 'value2'}
self.assertRaises(lib_exc.NotFound,
self.client.update_server_metadata,
non_existent_server_id,
meta)
开发者ID:calba,项目名称:tempest,代码行数:8,代码来源:test_server_metadata_negative.py
示例11: test_set_metadata_non_existent_server
def test_set_metadata_non_existent_server(self):
# Set metadata on a non-existent server should not succeed
non_existent_server_id = data_utils.rand_uuid()
meta = {'meta1': 'data1'}
self.assertRaises(lib_exc.NotFound,
self.client.set_server_metadata,
non_existent_server_id,
meta)
开发者ID:calba,项目名称:tempest,代码行数:8,代码来源:test_server_metadata_negative.py
示例12: test_create_port_duplicated_port_uuid
def test_create_port_duplicated_port_uuid(self):
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
uuid = data_utils.rand_uuid()
self.create_port(node_id=node_id, address=address, uuid=uuid)
self.assertRaises(lib_exc.Conflict, self.create_port, node_id=node_id,
address=address, uuid=uuid)
开发者ID:Dynavisor,项目名称:tempest,代码行数:8,代码来源:test_ports_negative.py
示例13: test_set_nonexistent_image_metadata_item
def test_set_nonexistent_image_metadata_item(self):
# Negative test: Metadata item should not be set to a
# nonexistent image
meta = {'os_distro': 'alt'}
self.assertRaises(lib_exc.NotFound,
self.client.set_image_metadata_item,
data_utils.rand_uuid(), 'os_distro',
meta)
开发者ID:pandeyop,项目名称:tempest,代码行数:8,代码来源:test_image_metadata_negative.py
示例14: test_update_baymodel_invalid_patch
def test_update_baymodel_invalid_patch(self):
# get json object
gen_model = datagen.baymodel_data_with_valid_keypair_image_flavor()
resp, old_model = self._create_baymodel(gen_model)
self.assertRaises(
exceptions.BadRequest,
self.baymodel_client.patch_baymodel, data_utils.rand_uuid(),
gen_model)
开发者ID:MatMaul,项目名称:magnum,代码行数:9,代码来源:test_baymodel.py
示例15: test_create_port_specifying_uuid
def test_create_port_specifying_uuid(self):
node_id = self.node["uuid"]
address = data_utils.rand_mac_address()
uuid = data_utils.rand_uuid()
_, port = self.create_port(node_id=node_id, address=address, uuid=uuid)
_, body = self.client.show_port(uuid)
self._assertExpected(port, body)
开发者ID:ionutbalutoiu,项目名称:ironic,代码行数:9,代码来源:test_ports.py
示例16: test_create_region_with_specific_id
def test_create_region_with_specific_id(self):
# Create a region with a specific id
r_region_id = data_utils.rand_uuid()
r_description = data_utils.rand_name('description')
region = self.client.create_region(
r_description, unique_region_id=r_region_id)
self.addCleanup(self._delete_region, region['id'])
# Asserting Create Region with specific id response body
self.assertEqual(r_region_id, region['id'])
self.assertEqual(r_description, region['description'])
开发者ID:Dynavisor,项目名称:tempest,代码行数:10,代码来源:test_regions.py
示例17: _associate_node_with_instance
def _associate_node_with_instance(self):
self.client.set_node_power_state(self.node['uuid'], 'power off')
waiters.wait_for_bm_node_status(self.client, self.node['uuid'],
'power_state', 'power off')
instance_uuid = data_utils.rand_uuid()
self.client.update_node(self.node['uuid'],
instance_uuid=instance_uuid)
self.addCleanup(self.client.update_node,
uuid=self.node['uuid'], instance_uuid=None)
return instance_uuid
开发者ID:Dynavisor,项目名称:tempest,代码行数:10,代码来源:test_nodes.py
示例18: test_update_port_replace_node_id_with_nonexistent
def test_update_port_replace_node_id_with_nonexistent(self):
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
_, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
patch = [{'path': '/node_uuid',
'op': 'replace',
'value': data_utils.rand_uuid()}]
self.assertRaises(lib_exc.BadRequest,
self.client.update_port, port_id, patch)
开发者ID:Dynavisor,项目名称:tempest,代码行数:12,代码来源:test_ports_negative.py
示例19: _generate_a_non_existent_security_group_id
def _generate_a_non_existent_security_group_id(self):
security_group_id = []
body = self.client.list_security_groups()
for i in range(len(body)):
security_group_id.append(body[i]['id'])
# Generate a non-existent security group id
while True:
non_exist_id = data_utils.rand_int_id(start=999)
if self.neutron_available:
non_exist_id = data_utils.rand_uuid()
if non_exist_id not in security_group_id:
break
return non_exist_id
开发者ID:pandeyop,项目名称:tempest,代码行数:13,代码来源:test_security_groups_negative.py
示例20: populate_smoke_table
def populate_smoke_table(self, table_name, keycount, count_per_key):
"""
Put [keycont*count_per_key] autogenerated items to the table.
In result, [keycount] unique hash key values
and [count_per_key] items for each has key value are generated.
For example, to generate some number of items for the only hash key,
set keycount=1 and count_per_key=needed_number_of_items.
"""
new_items = []
for _ in range(keycount):
forum = 'forum%s' % data_utils.rand_int_id()
for i in range(count_per_key):
item = self.put_smoke_item(
table_name, forum=forum, subject='subject%s' % i,
message=data_utils.rand_name(self.table_prefix),
last_posted_by=data_utils.rand_uuid(),
replies=str(data_utils.rand_int_id())
)
new_items.append(item)
return new_items
开发者ID:zaletniy,项目名称:magnetodb,代码行数:22,代码来源:base.py
注:本文中的tempest_lib.common.utils.data_utils.rand_uuid函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论