mirror of
https://github.com/borgbase/ansible-role-borgbackup.git
synced 2024-11-19 19:07:42 +01:00
34 lines
827 B
Python
34 lines
827 B
Python
|
"""
|
||
|
Validate host properties using Pytest after Ansible is finished. Uses Testinfra
|
||
|
|
||
|
Possible tests:
|
||
|
- https://testinfra.readthedocs.io/en/latest/modules.html#host
|
||
|
"""
|
||
|
|
||
|
import os
|
||
|
# import pytest
|
||
|
import testinfra.utils.ansible_runner
|
||
|
|
||
|
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||
|
os.environ['MOLECULE_INVENTORY_FILE']
|
||
|
).get_hosts('all')
|
||
|
|
||
|
|
||
|
def test_borgmatic_config(host):
|
||
|
f = host.file('/etc/borgmatic/config.yaml')
|
||
|
|
||
|
assert f.exists
|
||
|
assert f.user == 'root'
|
||
|
assert f.group == 'root'
|
||
|
|
||
|
|
||
|
# @pytest.mark.parametrize('file, content', [
|
||
|
# ("/etc/firewalld/zones/public.xml", "<service name=\"http\"/>"),
|
||
|
# ("/var/www/html/index.html", "Managed by Ansible")
|
||
|
# ])
|
||
|
# def test_files(host, file, content):
|
||
|
# file = host.file(file)
|
||
|
|
||
|
# assert file.exists
|
||
|
# assert file.contains(content)
|