You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
746 B
39 lines
746 B
3 years ago
|
import os
|
||
|
|
||
|
from testinfra.utils.ansible_runner import AnsibleRunner
|
||
|
|
||
|
inventory = os.environ['MOLECULE_INVENTORY_FILE']
|
||
|
testinfra_hosts = AnsibleRunner(inventory).get_hosts('all')
|
||
|
|
||
|
|
||
|
def test_files(host):
|
||
|
dirs = [
|
||
|
"/etc/caddy",
|
||
|
"/var/log/caddy"
|
||
|
]
|
||
|
for dir in dirs:
|
||
|
d = host.file(dir)
|
||
|
assert d.exists
|
||
|
assert d.is_directory
|
||
|
|
||
|
|
||
|
def test_packages(host):
|
||
|
pkgs = []
|
||
|
for p in pkgs:
|
||
|
assert host.package(p).is_installed
|
||
|
|
||
|
|
||
|
def test_service(host):
|
||
|
s = host.service("caddy")
|
||
|
assert s.is_enabled
|
||
|
assert s.is_running
|
||
|
|
||
|
|
||
|
def test_socket(host):
|
||
|
sockets = [
|
||
|
"tcp://127.0.0.1:2020"
|
||
|
]
|
||
|
for socket in sockets:
|
||
|
s = host.socket(socket)
|
||
|
assert s.is_listening
|