homeserver/roles/gantsign.ctop/molecule/default/tests/test_role.py

31 lines
730 B
Python
Raw Normal View History

2020-08-18 11:57:53 +02:00
import os
import testinfra.utils.ansible_runner
import re
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_dir(host):
dir = host.file('/usr/local/bin')
assert dir.exists
assert dir.is_directory
assert dir.user == 'root'
assert dir.group == 'root'
def test_file(host):
installed_file = host.file('/usr/local/bin/ctop')
assert installed_file.exists
assert installed_file.is_file
assert installed_file.user == 'root'
assert installed_file.group == 'root'
def test_version(host):
version = host.check_output('ctop -v')
pattern = 'ctop version [0-9\\.]+'
assert re.search(pattern, version)