2019-07-02 14:10:46 +03:00
|
|
|
import os
|
2019-07-09 18:00:12 +03:00
|
|
|
import pytest
|
2019-07-02 14:10:46 +03: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 18:00:12 +03: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 15:51:06 +03:00
|
|
|
|
|
|
|
|
|
|
|
def test_docker_config(host):
|
|
|
|
assert host.file('/etc/docker/daemon.json').exists
|