示例#1
0
def test_push_image(temp_image_name, should_fail):
    if MOCK:
        mock_docker(push_should_fail=should_fail)

    t = DockerTasker()
    temp_image_name.registry = LOCALHOST_REGISTRY
    temp_image_name.tag = "1"
    t.tag_image(INPUT_IMAGE, temp_image_name)
    if should_fail:
        with pytest.raises(RuntimeError) as exc:
            output = t.push_image(temp_image_name, insecure=True)
        assert "Failed to push image" in str(exc)
    else:
        output = t.push_image(temp_image_name, insecure=True)
        assert output is not None
    t.remove_image(temp_image_name)
示例#2
0
def test_push_image(temp_image_name, should_fail):
    if MOCK:
        mock_docker(push_should_fail=should_fail)

    t = DockerTasker(retry_times=0)
    temp_image_name.registry = LOCALHOST_REGISTRY
    temp_image_name.tag = "1"
    t.tag_image(INPUT_IMAGE, temp_image_name)
    if should_fail:
        with pytest.raises(RetryGeneratorException) as exc:
            output = t.push_image(temp_image_name, insecure=True)
        assert "Failed to mock_method image" in str(exc)
        assert "connection refused" in str(exc)
    else:
        output = t.push_image(temp_image_name, insecure=True)
        assert output is not None
    t.remove_image(temp_image_name)
示例#3
0
def test_push_image(temp_image_name, should_fail):
    if MOCK:
        mock_docker(push_should_fail=should_fail)

    t = DockerTasker(retry_times=0)
    temp_image_name.registry = LOCALHOST_REGISTRY
    temp_image_name.tag = "1"
    t.tag_image(INPUT_IMAGE, temp_image_name)
    if should_fail:
        with pytest.raises(RetryGeneratorException) as exc:
            output = t.push_image(temp_image_name, insecure=True)
        assert "Failed to mock_method image" in str(exc)
        assert "connection refused" in str(exc)
    else:
        output = t.push_image(temp_image_name, insecure=True)
        assert output is not None
    t.remove_image(temp_image_name)
def test_push_image(temp_image_name):
    if MOCK:
        mock_docker()

    t = DockerTasker()
    temp_image_name.registry = LOCALHOST_REGISTRY
    temp_image_name.tag = "1"
    t.tag_image(INPUT_IMAGE, temp_image_name)
    output = t.push_image(temp_image_name, insecure=True)
    assert output is not None
    t.remove_image(temp_image_name)
示例#5
0
def test_push_image(temp_image_name):
    if MOCK:
        mock_docker()

    t = DockerTasker()
    temp_image_name.registry = LOCALHOST_REGISTRY
    temp_image_name.tag = "1"
    t.tag_image(INPUT_IMAGE, temp_image_name)
    output = t.push_image(temp_image_name, insecure=True)
    assert output is not None
    t.remove_image(temp_image_name)