def test_missing_files(project_dir, temp_dir, resolve_symlinks, caplog):
    args = ['backup', '-t', temp_dir]
    if resolve_symlinks:
        args.append('--resolve-symlinks')

    result = run(args)
    assert result.exit_code == 1
    assert log_message(logging.ERROR, r'\.FileNotFoundError:', caplog)

    extends_content = {'version': '2', 'services': {'none': {'image': 'busybox'}}}
    with project_dir.add_file('void.yml').open('tw') as f:
        yaml.dump(extends_content, f)
    caplog.clear()
    result = run(args)

    assert result.exit_code == 1
    assert log_message(logging.ERROR, r'build path .*/lost either does not exist', caplog)

    project_dir.add_folder('lost')
    caplog.clear()
    result = run(args)
    assert result.exit_code == 1
    assert log_message(logging.ERROR, r"Couldn't find env file: .*/dangling_link$", caplog)

    project_dir.add_file('gone')
    caplog.clear()
    assert result_okay(run(args))
def test_missing_files(project_dir, temp_dir, resolve_symlinks, caplog):
    args = ["backup", "-t", str(temp_dir)]
    if resolve_symlinks:
        args.append("--resolve-symlinks")

    result = run(args)
    assert result.exit_code == 1
    assert log_message(logging.ERROR, r"\.FileNotFoundError:", caplog)

    extends_content = {"version": "2", "services": {"none": {"image": "busybox"}}}
    with project_dir.add_file("void.yml").open("tw") as f:
        yaml.dump(extends_content, f)
    caplog.clear()
    result = run(args)

    assert result.exit_code == 1
    assert log_message(
        logging.ERROR, r"build path .*/lost either does not exist", caplog
    )

    project_dir.add_folder("lost")
    caplog.clear()
    result = run(args)
    assert result.exit_code == 1
    assert log_message(
        logging.ERROR, r"Couldn't find env file: .*/dangling_link$", caplog
    )

    project_dir.add_file("gone")
    caplog.clear()
    assert result_okay(args)
示例#3
0
def test_missing_files(project_dir, temp_dir, resolve_symlinks, caplog):
    args = ['backup', '-t', str(temp_dir)]
    if resolve_symlinks:
        args.append('--resolve-symlinks')

    result = run(args)
    assert result.exit_code == 1
    assert log_message(logging.ERROR, r'\.FileNotFoundError:', caplog)

    extends_content = {
        'version': '2',
        'services': {
            'none': {
                'image': 'busybox'
            }
        }
    }
    with project_dir.add_file('void.yml').open('tw') as f:
        yaml.dump(extends_content, f)
    caplog.clear()
    result = run(args)

    assert result.exit_code == 1
    assert log_message(logging.ERROR,
                       r'build path .*/lost either does not exist', caplog)

    project_dir.add_folder('lost')
    caplog.clear()
    result = run(args)
    assert result.exit_code == 1
    assert log_message(logging.ERROR,
                       r"Couldn't find env file: .*/dangling_link$", caplog)

    project_dir.add_file('gone')
    caplog.clear()
    assert result_okay(args)
示例#4
0
def test_nested_extends(caplog):
    result = run(['backup', 'spam'])
    assert result.exit_code == 1
    assert log_message(logging.ERROR, 'Unknown services: spam', caplog)
    caplog.clear()
示例#5
0
def test_nested_extends(caplog):
    result = run(["backup", "spam"])
    assert result.exit_code == 1
    assert log_message(logging.ERROR, "Unknown services: spam", caplog)
    caplog.clear()
示例#6
0
def test_nested_extends(caplog):
    result = run(['backup', 'spam'])
    assert result.exit_code == 1
    assert log_message(logging.ERROR, 'Unknown services: spam', caplog)
    caplog.clear()