Created
July 29, 2017 22:00
-
-
Save philpep/6a8d8c6d5d77275fde0680ccc3532e90 to your computer and use it in GitHub Desktop.
testinfra docker jenkins example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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