当前位置: 首页>>代码示例>>Python>>正文


Python data_utils.rand_uuid函数代码示例

本文整理汇总了Python中tempest.lib.common.utils.data_utils.rand_uuid函数的典型用法代码示例。如果您正苦于以下问题:Python rand_uuid函数的具体用法?Python rand_uuid怎么用?Python rand_uuid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rand_uuid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_rand_uuid

 def test_rand_uuid(self):
     actual = data_utils.rand_uuid()
     self.assertIsInstance(actual, str)
     self.assertRegex(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:dwalleck,项目名称:tempest,代码行数:7,代码来源:test_data_utils.py

示例2: test_create_with_nonexistent_volume_type

 def test_create_with_nonexistent_volume_type(self):
     # Should not be able to create volume with nonexistent volume_type.
     self.name_field = self.special_fields['name_field']
     params = {self.name_field: data_utils.rand_uuid(),
               'volume_type': data_utils.rand_uuid()}
     self.assertRaises(lib_exc.NotFound,
                       self.volumes_client.create_volume, **params)
开发者ID:bigswitch,项目名称:tempest,代码行数:7,代码来源:test_volume_types_negative.py

示例3: test_create_flavor_with_uuid_id

 def test_create_flavor_with_uuid_id(self):
     flavor_id = data_utils.rand_uuid()
     new_flavor_id = self.create_flavor(ram=self.ram,
                                        vcpus=self.vcpus,
                                        disk=self.disk,
                                        id=flavor_id)['id']
     self.assertEqual(new_flavor_id, flavor_id)
开发者ID:Juniper,项目名称:tempest,代码行数:7,代码来源:test_flavors.py

示例4: 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:jpoley,项目名称:ec2-api,代码行数:35,代码来源:test_instances.py

示例5: 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:jpoley,项目名称:ec2-api,代码行数:25,代码来源:test_instances.py

示例6: test_delete_nonexistent_volume_type_id

 def test_delete_nonexistent_volume_type_id(self):
     # Should not delete volume type extra spec for nonexistent
     # type id.
     self.assertRaises(
         lib_exc.NotFound,
         self.admin_volume_types_client.delete_volume_type_extra_specs,
         data_utils.rand_uuid(), "spec1")
开发者ID:Juniper,项目名称:tempest,代码行数:7,代码来源:test_volume_types_extra_specs_negative.py

示例7: test_run_workspace_rename

 def test_run_workspace_rename(self):
     new_name = data_utils.rand_uuid()
     cmd = ['tempest', 'workspace', '--workspace-path', self.store_file,
            'rename', "--old-name", self.name, '--new-name', new_name]
     self._run_cmd_gets_return_code(cmd, 0)
     self.assertIsNone(self.workspace_manager.get_workspace(self.name))
     self.assertIsNotNone(self.workspace_manager.get_workspace(new_name))
开发者ID:dpaterson,项目名称:tempest,代码行数:7,代码来源:test_workspace.py

示例8: test_get_nonexistent_hypervisor_uptime

    def test_get_nonexistent_hypervisor_uptime(self):
        nonexistent_hypervisor_id = data_utils.rand_uuid()

        self.assertRaises(
            lib_exc.NotFound,
            self.client.show_hypervisor_uptime,
            nonexistent_hypervisor_id)
开发者ID:Juniper,项目名称:tempest,代码行数:7,代码来源:test_hypervisor_negative.py

示例9: test_update_cluster_template_404

    def test_update_cluster_template_404(self):
        patch_model = datagen.cluster_template_name_patch_data()

        self.assertRaises(
            exceptions.NotFound,
            self.cluster_template_client.patch_cluster_template,
            data_utils.rand_uuid(), patch_model)
开发者ID:larsbutler,项目名称:magnum,代码行数:7,代码来源:test_cluster_template.py

示例10: test_show_servers_with_nonexistent_hypervisor

    def test_show_servers_with_nonexistent_hypervisor(self):
        nonexistent_hypervisor_id = data_utils.rand_uuid()

        self.assertRaises(
            lib_exc.NotFound,
            self.client.list_servers_on_hypervisor,
            nonexistent_hypervisor_id)
开发者ID:Juniper,项目名称:tempest,代码行数:7,代码来源:test_hypervisor_negative.py

示例11: cluster_data

def cluster_data(name=data_utils.rand_name('cluster'),
                 cluster_template_id=data_utils.rand_uuid(),
                 node_count=random_int(1, 5), discovery_url=gen_random_ip(),
                 create_timeout=random_int(1, 30),
                 master_count=random_int(1, 5)):
    """Generates random cluster data

    cluster_template_id cannot be random for the cluster to be valid due to
    validations for the presence of clustertemplate prior to clustertemplate
    creation.

    :param name: cluster name (must be unique)
    :param cluster_template_id: clustertemplate unique id (must already exist)
    :param node_count: number of agents for cluster
    :param discovery_url: url provided for node discovery
    :param create_timeout: timeout in minutes for cluster create
    :param master_count: number of master nodes for the cluster
    :returns: ClusterEntity with generated data
    """

    data = {
        "name": name,
        "cluster_template_id": cluster_template_id,
        "keypair": config.Config.keypair_id,
        "node_count": node_count,
        "discovery_url": None,
        "create_timeout": create_timeout,
        "master_count": master_count
    }
    model = cluster_model.ClusterEntity.from_dict(data)

    return model
开发者ID:openstack,项目名称:magnum,代码行数:32,代码来源:datagen.py

示例12: test_get_nonexistent_extra_spec_id

 def test_get_nonexistent_extra_spec_id(self):
     # Should not get volume type extra spec for nonexistent extra spec
         # id.
     self.assertRaises(
         lib_exc.NotFound,
         self.admin_volume_types_client.show_volume_type_extra_specs,
         self.volume_type['id'], data_utils.rand_uuid())
开发者ID:vedujoshi,项目名称:tempest,代码行数:7,代码来源:test_volume_types_extra_specs_negative.py

示例13: test_create_snapshot_with_nonexistent_volume_id

 def test_create_snapshot_with_nonexistent_volume_id(self):
     # Create a snapshot with nonexistent volume id
     s_name = data_utils.rand_name(self.__class__.__name__ + '-snap')
     self.assertRaises(lib_exc.NotFound,
                       self.snapshots_client.create_snapshot,
                       volume_id=data_utils.rand_uuid(),
                       display_name=s_name)
开发者ID:masayukig,项目名称:tempest,代码行数:7,代码来源:test_volumes_snapshots_negative.py

示例14: 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:Juniper,项目名称:tempest,代码行数:7,代码来源:test_server_metadata_negative.py

示例15: 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_server,
                       nonexistent_server,
                       self.image_ref)
开发者ID:openstack,项目名称:tempest,代码行数:7,代码来源:test_servers_negative.py


注:本文中的tempest.lib.common.utils.data_utils.rand_uuid函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。