Beispiel #1
0
def test_yet_another_blog(project_dir, temp_dir, target, compression,
                          resolve_symlinks):
    args = ['backup']

    if target:
        args.extend(['-t', str(temp_dir)])
    if compression:
        args.extend(['--compression', compression])
    if resolve_symlinks:
        args.append('--resolve-symlinks')

    assert result_okay(args)

    if target:
        target_item = get_target_folder(temp_dir)
    else:
        return  # FIXME https://github.com/pytest-dev/pytest/issues/1407
        out, err = capsys.readouterr()  # noqa: F821
        target_item = temp_dir / 'archive'
        with target_item.open('wb') as f:
            f.write(out)

    if compression:
        assert target_item.is_file()
        with TemporaryDirectory() as tmp:
            archive = tarfile.open(str(target_item))
            archive.extractall(tmp)
            assert identical_folder_contents(project_dir,
                                             Path(tmp) / 'config',
                                             resolve_symlinks)
    else:
        assert target_item.is_dir()
        target_folder = target_item
        assert identical_folder_contents(project_dir, target_folder / 'config',
                                         resolve_symlinks)
def test_yet_another_blog(project_dir, temp_dir, target, compression, resolve_symlinks):
    args = ['backup']

    if target:
        args.extend(['-t', temp_dir])
    if compression:
        args.extend(['--compression', compression])
    if resolve_symlinks:
        args.append('--resolve-symlinks')

    assert result_okay(run(args))

    if target:
        target_item = get_target_folder(temp_dir)
    else:
        return  # FIXME https://github.com/pytest-dev/pytest/issues/1407
        out, err = capsys.readouterr()
        target_item = temp_dir / 'archive'
        with target_item.open('wb') as f:
            f.write(out)

    if compression:
        assert target_item.is_file()
        with TemporaryDirectory() as tmp:
            archive = tarfile.open(str(target_item))
            archive.extractall(tmp)
            assert identical_folder_contents(project_dir, Path(tmp) / 'config', resolve_symlinks)
    else:
        assert target_item.is_dir()
        target_folder = target_item
        assert identical_folder_contents(project_dir, target_folder / 'config', resolve_symlinks)
def test_nested_extends(project_dir, temp_dir, resolve_symlinks):
    args = ['backup', '-t', temp_dir]
    if resolve_symlinks:
        args.append('--resolve-symlinks')

    assert result_okay(run(args))
    target_folder = get_target_folder(temp_dir)
    assert identical_folder_contents(project_dir, target_folder / 'config')
Beispiel #4
0
def test_nested_extends(project_dir, temp_dir, resolve_symlinks):
    args = ['backup', '-t', str(temp_dir)]
    if resolve_symlinks:
        args.append('--resolve-symlinks')

    assert result_okay(args)
    target_folder = get_target_folder(temp_dir)
    assert identical_folder_contents(project_dir, target_folder / 'config')
def test_nested_extends(project_dir, temp_dir, resolve_symlinks):
    args = ["backup", "-t", str(temp_dir)]
    if resolve_symlinks:
        args.append("--resolve-symlinks")

    assert result_okay(args)
    target_folder = get_target_folder(temp_dir)
    assert identical_folder_contents(project_dir, target_folder / "config")
Beispiel #6
0
def test_volumes(compression, temp_dir):
    assert call(['docker', 'volume', 'create', '--name=dontcare']) == 0
    assert call(['docker-compose', 'up', '-d']) == 0

    args = ['backup', '-t', str(temp_dir)]
    if compression:
        args.extend(['--compression', compression])

    assert result_okay(args)

    target_item = get_target_folder(temp_dir)

    if compression:
        assert target_item.is_file()
        with TemporaryDirectory() as target_folder:
            archive = tarfile.open(str(target_item))
            archive.extractall(target_folder)
            check_volumes_result(Path(target_folder))
    else:
        assert target_item.is_dir()
        target_folder = target_item
        check_volumes_result(target_folder)
def test_volumes(compression, temp_dir):
    assert call(["docker", "volume", "create", "--name=dontcare"]) == 0
    assert call(["docker-compose", "up", "-d"]) == 0

    args = ["backup", "-t", str(temp_dir)]
    if compression:
        args.extend(["--compression", compression])

    assert result_okay(args)

    target_item = get_target_folder(temp_dir)

    if compression:
        assert target_item.is_file()
        with TemporaryDirectory() as target_folder:
            archive = tarfile.open(str(target_item))
            archive.extractall(target_folder)
            check_volumes_result(Path(target_folder))
    else:
        assert target_item.is_dir()
        target_folder = target_item
        check_volumes_result(target_folder)
def test_volumes(compression, temp_dir):
    assert call(["docker", "volume", "create", "--name=dontcare"]) == 0
    assert call(["docker-compose", "up", "-d"]) == 0

    args = ["backup", "-t", temp_dir]
    if compression:
        args.extend(["--compression", compression])

    assert result_okay(run(args))

    target_item = get_target_folder(temp_dir)

    if compression:
        assert target_item.is_file()
        with TemporaryDirectory() as target_folder:
            archive = tarfile.open(str(target_item))
            archive.extractall(target_folder)
            check_volumes_result(Path(target_folder))
    else:
        assert target_item.is_dir()
        target_folder = target_item
        check_volumes_result(target_folder)
def test_config_with_build_context_v2(project_dir, temp_dir):
    assert result_okay(run(['backup', '-t', temp_dir]))
    target_folder = get_target_folder(temp_dir)
    assert identical_folder_contents(project_dir, target_folder / 'config')
Beispiel #10
0
def test_config_with_duplicated_build_context(project_dir, temp_dir):
    assert result_okay(['backup', '-t', str(temp_dir)])
    target_folder = get_target_folder(temp_dir)
    assert identical_folder_contents(project_dir, target_folder / 'config')
def test_config_with_build_context_v2(project_dir, temp_dir):
    assert result_okay(["backup", "-t", str(temp_dir)])
    target_folder = get_target_folder(temp_dir)
    assert identical_folder_contents(project_dir, target_folder / "config")