pytest-docker
pytest-docker copied to clipboard
Swarm support
Currently, the code is fixed on using docker compose for managing services. Is there any interest in developing Swarm support as an addition? I'd probably chip in on that, since this might be in the best interesting of the project I'm currently handling.
You can add following fixtures and it will be almost all required "support":
@pytest.fixture(scope="session")
def docker_compose_command():
return "docker stack"
@pytest.fixture(scope="session")
def docker_cleanup():
return ["up"]
@pytest.fixture(scope="session")
def docker_cleanup():
return ["down"]
@pytest.fixture(scope="session")
def docker_ip() -> str:
info = json.loads(pytest_docker.plugin.execute("docker info -f json"))
if info["Name"] == os.environ.get("HOSTNAME"):
return "127.0.0.1"
return info.get("Swarm",{}).get("NodeAddr")