Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
testinfra docker jenkins example
import docker
import pytest
import testinfra
@pytest.fixture(scope="module", name="host")
def docker_host():
client = docker.from_env()
container = client.containers.run("jenkins", detach=True)
yield testinfra.get_host("docker://{}".format(container.id))
container.remove(force=True)
def test_current_user_is_jenkins(host):
assert host.user().name == "jenkins"
assert host.user().group == "jenkins"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.