示例#1
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)
示例#2
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)
示例#3
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)
示例#4
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)
示例#5
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)
示例#6
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)