Created
November 10, 2019 12:35
-
-
Save till/8db35d9f522af20ddbfa752471861230 to your computer and use it in GitHub Desktop.
Debuggable TestInfra
This file contains 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 os | |
import testinfra.utils.ansible_runner | |
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( | |
os.environ['MOLECULE_INVENTORY_FILE'] | |
).get_hosts('all') | |
def get_docker_services(host): | |
return host.check_output("docker service ls") | |
def test_service_is_installed_and_global(host, capsys): | |
services = get_docker_services(host) | |
with capsys.disabled(): | |
print(services) | |
assert services.find("service-name") | |
assert services.find("global") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment