예제 #1
0
def random_mount():
    properties = {}
    for _ in range(random.randint(1, 10)):
        properties[random_str()] = random_str()
    return option.Mount(properties=properties,
                        read_only=random_bool(),
                        shared=random_bool())
예제 #2
0
def random_set_attribute():
    return option.SetAttribute(group=random_str(),
                               mode=random_mode(),
                               owner=random_str(),
                               persisted=random_bool(),
                               pinned=random_bool(),
                               recursive=random_bool(),
                               ttl=random_int(),
                               ttl_action=random_ttl_action())
예제 #3
0
def random_create_file():
    return option.CreateFile(block_size_bytes=random_int(),
                             location_policy_class=random_str(),
                             mode=random_mode(),
                             recursive=random_bool(),
                             ttl=random_int(),
                             ttl_action=random_ttl_action(),
                             write_type=random_write_type(),
                             replication_durable=random_int(),
                             replication_max=random_int(),
                             replication_min=random_int())
예제 #4
0
def random_file_info():
    block_ids = []
    for _ in range(random.randint(1, 10)):
        block_ids.append(random_int())
    file_block_infos = []
    for _ in range(random.randint(1, 10)):
        file_block_infos.append(random_file_block_info())
    return wire.FileInfo(block_ids=block_ids,
                         block_size_bytes=random_int(),
                         cacheable=random_bool(),
                         completed=random_bool(),
                         creation_time_ms=random_int(),
                         file_block_infos=file_block_infos,
                         file_id=random_int(),
                         folder=random_bool(),
                         group=random_str(),
                         in_memory_percentage=random_int(),
                         last_modification_time_ms=random_int(),
                         length=random_int(),
                         mode=random_int(),
                         mount_point=random_bool(),
                         name=random_str(),
                         owner=random_str(),
                         path=random_str(),
                         persisted=random_bool(),
                         persistence_state=random_persistence_state(),
                         pinned=random_bool(),
                         ttl=random_int(),
                         ttl_action=random_ttl_action(),
                         ufs_path=random_str())
예제 #5
0
def test_random():
    s = '\n'
    s += 'random_int(1) = ' + str(util.random_int(1)) + '\n'
    s += '\n'
    s += 'random_int(10) = ' + str(util.random_int(10)) + '\n'
    s += '\n'
    s += 'random_int(5, 20) = ' + str(util.random_int(5, 20)) + '\n'
    s += '\n'
    s += 'random_int(a, b, step) = ' + str(util.random_int(10, 20, 5)) + '\n'

    s += '\n'
    s += 'random_float(5, 10) = ' + str(util.random_float(5, 10)) + '\n'
    s += 'random_float(-1, 1) = ' + str(util.random_float(-1, 1)) + '\n'
    s += 'random_float(0, 1) = ' + str(util.random_float(0, 1)) + '\n'
    s += 'random_float(1.9, 2) = ' + str(util.random_float(1.9, 2)) + '\n'

    s += 'random_float(0, 1.1) = ' + str(util.random_float(0, 1.1)) + '\n'

    s += '\n'
    s += 'random_bool() = ' + str(util.random_bool()) + '\n'
    s += 'random_bool(0) = ' + str(util.random_bool(0)) + '\n'
    s += 'random_bool(1/10) = ' + str(util.random_bool(1 / 10)) + '\n'
    s += 'random_bool(1/90) = ' + str(util.random_bool(90 / 100)) + '\n'
    s += 'random_bool(100/100) = ' + str(util.random_bool(100 / 100)) + '\n'
    s += 'random_bool(2) = ' + str(util.random_bool(2)) + '\n'

    s += '\n'
    s += 'random_ascii() = ' + util.random_ascii() + '\n'

    s += '\n'
    s += 'random_str(4) = "' + util.random_str(4) + '"\n'
    s += '\n'
    s += 'random_str(1, 3) = "' + util.random_str(1, 3) + '"\n'

    s += '\n'
    s += 'random_str(4, tbl=\'ABC123\') = "' + util.random_str(
        4, tbl='ABC123') + '"\n'
    s += '\n'
    s += 'random_str(1, 3, tbl=\'ABC123\') = "' + util.random_str(
        1, 3, tbl='ABC123') + '"\n'

    s += '\n'
    s += 'random_str(4, tbl=\'ABC123あいうえお\') = "' + util.random_str(
        4, tbl='ABC123あいうえお') + '"\n'
    s += '\n'
    s += 'random_str(1, 3, tbl=\'ABC123あいうえお\') = "' + util.random_str(
        1, 3, tbl='ABC123あいうえお') + '"\n'

    return s
예제 #6
0
def random_create_directory():
    return option.CreateDirectory(allow_exists=random_bool(),
                                  mode=random_mode(),
                                  recursive=random_bool(),
                                  write_type=random_write_type())
예제 #7
0
def random_free():
    return option.Free(recursive=random_bool())
예제 #8
0
def random_delete():
    return option.Delete(recursive=random_bool())
예제 #9
0
 def is_available(self):
     return random_bool(chance_of_getting_true=80)