dns_resolver_conf/molecule/with_custom_config/tests/test_default.py

22 lines
787 B
Python
Raw Normal View History

2023-03-20 21:48:29 +00:00
"""Role testing files using testinfra."""
def test_hosts_file(host):
"""Validate /etc/hosts file."""
etc_hosts = host.file("/etc/hosts")
assert etc_hosts.exists
assert etc_hosts.user == "root"
assert etc_hosts.group == "root"
def test_resolv_conf_file(host):
"""Validate resolv.conf file."""
tmp_resolv_conf = host.file("/tmp/resolv.conf")
assert tmp_resolv_conf.exists
assert tmp_resolv_conf.user == "root"
assert tmp_resolv_conf.group == "root"
assert tmp_resolv_conf.mode == 0o644
assert tmp_resolv_conf.contains("search example.org az1.example.org")
assert tmp_resolv_conf.contains("nameserver 10.1.20.53")
assert tmp_resolv_conf.contains("nameserver 10.1.20.54")
assert tmp_resolv_conf.contains("options edns0 rotate")