Esempio n. 1
0
def test_mode():
    mode = random_mode()
    json = dict(ownerBits=mode.owner_bits.json(),
                groupBits=mode.group_bits.json(),
                otherBits=mode.other_bits.json())
    assert_json_encode(mode, json)
    assert_json_decode(mode, json)
Esempio n. 2
0
def test_open_file():
    opt = random_open_file()
    json = dict(cacheLocationPolicyClass=opt.cache_location_policy_class,
                maxUfsReadConcurrency=opt.max_ufs_read_concurrency,
                readType=opt.read_type.json(),
                ufsReadLocationPolicyClass=opt.ufs_read_location_policy_class)
    assert_json_encode(opt, json)
Esempio n. 3
0
def test_file_info():
    info = random_file_info()
    json = dict(
        blockIds=info.block_ids,
        blockSizeBytes=info.block_size_bytes,
        cacheable=info.cacheable,
        completed=info.completed,
        creationTimeMs=info.creation_time_ms,
        lastModificationTimeMs=info.last_modification_time_ms,
        fileBlockInfos=[block.json() for block in info.file_block_infos],
        fileId=info.file_id,
        folder=info.folder,
        owner=info.owner,
        group=info.group,
        inMemoryPercentage=info.in_memory_percentage,
        length=info.length,
        name=info.name,
        path=info.path,
        ufsPath=info.ufs_path,
        pinned=info.pinned,
        persisted=info.persisted,
        persistenceState=info.persistence_state.json(),
        mode=info.mode,
        mountPoint=info.mount_point,
        ttl=info.ttl,
        ttlAction=info.ttl_action.json())
    assert_json_encode(info, json)
    assert_json_decode(info, json)
Esempio n. 4
0
def test_file_block_info():
    file_block_info = random_file_block_info()
    json = dict(blockInfo=file_block_info.block_info.json(),
                offset=file_block_info.offset,
                ufsLocations=file_block_info.ufs_locations)
    assert_json_encode(file_block_info, json)
    assert_json_decode(file_block_info, json)
Esempio n. 5
0
def test_block_info():
    block = random_block_info()
    json = dict(blockId=block.block_id,
                length=block.length,
                locations=[location.json() for location in block.locations])
    assert_json_encode(block, json)
    assert_json_decode(block, json)
Esempio n. 6
0
def test_block_location():
    location = random_block_location()
    json = dict(workerId=location.worker_id,
                workerAddress=location.worker_address.json(),
                tierAlias=location.tier_alias)
    assert_json_encode(location, json)
    assert_json_decode(location, json)
Esempio n. 7
0
def test_create_directory():
    opt = random_create_directory()
    print(opt.json())
    json = dict(allowExists=opt.allow_exists,
                mode=opt.mode.json(),
                recursive=opt.recursive,
                writeType=opt.write_type.json())
    assert_json_encode(opt, json)
Esempio n. 8
0
def test_worker_net_address():
    addr = random_worker_net_address()
    json = dict(host=addr.host,
                rpcPort=addr.rpc_port,
                dataPort=addr.data_port,
                webPort=addr.web_port)
    assert_json_encode(addr, json)
    assert_json_decode(addr, json)
Esempio n. 9
0
def test_set_attribute():
    opt = random_set_attribute()
    json = dict(owner=opt.owner,
                group=opt.group,
                mode=opt.mode.json(),
                pinned=opt.pinned,
                recursive=opt.recursive,
                ttl=opt.ttl,
                ttlAction=opt.ttl_action.json())
    assert_json_encode(opt, json)
Esempio n. 10
0
def test_create_file():
    opt = random_create_file()
    json = dict(blockSizeBytes=opt.block_size_bytes,
                locationPolicyClass=opt.location_policy_class,
                mode=opt.mode.json(),
                recursive=opt.recursive,
                ttl=opt.ttl,
                ttlAction=opt.ttl_action.json(),
                writeType=opt.write_type.json(),
                replicationDurable=opt.replication_durable,
                replicationMax=opt.replication_max,
                replicationMin=opt.replication_min)
    assert_json_encode(opt, json)
Esempio n. 11
0
def test_mount():
    opt = random_mount()
    json = dict(properties=opt.properties,
                readOnly=opt.read_only, shared=opt.shared)
    assert_json_encode(opt, json)
Esempio n. 12
0
def test_list_status():
    opt = random_list_status()
    json = dict(loadMetadataType=opt.load_metadata_type.json())
    assert_json_encode(opt, json)
Esempio n. 13
0
def test_free():
    opt = random_free()
    json = dict(recursive=opt.recursive)
    assert_json_encode(opt, json)