Beispiel #1
0
def test_missing_docker_library():
    with mock.patch(
            "saltfactories.factories.daemons.container.HAS_DOCKER",
            new_callable=mock.PropertyMock(return_value=False),
    ):
        with pytest.raises(RuntimeError) as exc:
            ContainerFactory(name="foo", image="bar")

        assert str(
            exc.value) == "The docker python library was not found installed"
Beispiel #2
0
def docker_client():
    try:
        client = docker.from_env()
    except DockerException:
        pytest.skip(
            "Failed to get a connection to docker running on the system")
    connectable = ContainerFactory.client_connectable(client)
    if connectable is not True:  # pragma: nocover
        pytest.skip(connectable)
    return client
Beispiel #3
0
def docker_client():
    if salt.utils.path.which("docker") is None:
        pytest.skip("The docker binary is not available")
    try:
        client = docker.from_env()
        connectable = ContainerFactory.client_connectable(client)
        if connectable is not True:  # pragma: no cover
            pytest.skip(connectable)
        return client
    except DockerException:
        pytest.skip(
            "Failed to get a connection to docker running on the system")
Beispiel #4
0
def docker_client():
    client = docker.from_env()
    connectable = ContainerFactory.client_connectable(client)
    if connectable is not True:  # pragma: no cover
        pytest.skip(connectable)
    return client