2019-07-02 13:10:46 +02:00
|
|
|
import os
|
2019-07-09 17:00:12 +02:00
|
|
|
import pytest
|
2019-07-02 13:10:46 +02:00
|
|
|
import testinfra.utils.ansible_runner
|
|
|
|
|
|
|
|
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
|
|
|
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
|
|
|
|
|
|
|
|
|
|
|
def test_repo(host):
|
|
|
|
assert host.file('/home/poadocker/bridge').exists
|
|
|
|
assert host.file('/home/poadocker/bridge').is_directory
|
|
|
|
|
|
|
|
|
|
|
|
def test_docker_group(host):
|
|
|
|
assert host.group('docker').exists
|
|
|
|
|
|
|
|
|
|
|
|
def test_user(host):
|
|
|
|
assert host.user('poadocker').exists
|
|
|
|
assert 'docker' in host.user('poadocker').groups
|
2019-07-09 17:00:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("filename", [
|
|
|
|
("/etc/rsyslog.d/30-docker.conf"),
|
|
|
|
("/etc/rsyslog.d/35-docker-remote-logging.conf")
|
|
|
|
])
|
|
|
|
def test_logging(host, filename):
|
|
|
|
assert host.file(filename).exists
|
|
|
|
assert host.file(filename).mode == 0o0644
|
2019-07-12 14:51:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_docker_config(host):
|
|
|
|
assert host.file('/etc/docker/daemon.json').exists
|