test_sdk_sanity.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:lago 作者: lago-project 项目源码 文件源码
def test_extract_paths(tmpdir, randomized_dir, vms, vm_name, mode):
    if mode == 'dead':
        pytest.skip('extract_paths_dead is not stable in CI')
    vm = vms[vm_name]
    dst = '/root/extract-{vm}-{mode}'.format(vm=vm_name, mode=mode)
    vm.copy_to(randomized_dir.path, dst, recursive=True)
    res = vm.ssh(['sync'])
    assert res.code == 0
    if mode == 'normal':
        extract = getattr(vm, 'extract_paths')
    elif mode == 'dead':
        extract = getattr(vm, 'extract_paths_dead')
    extracted_path = str(tmpdir)
    extract([(dst, extracted_path)], ignore_nopath=False)

    cmp_res = filecmp.dircmp(
        os.path.join(extracted_path, os.path.basename(dst)),
        randomized_dir.path
    )
    assert sorted(cmp_res.left_list) == sorted(cmp_res.right_list)


# todo: Test extract_paths_dead once we figure why it's unstable in CI
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号