ansible-role-chrony/molecule/default/tests/test_default.py

32 lines
964 B
Python
Raw Normal View History

2024-08-07 08:58:44 +00:00
import testinfra.utils.ansible_runner
def test_package(host):
package = host.package('chrony')
assert package.is_installed
def test_config_file(host):
path = host.file('/etc/chrony/chrony.conf')
assert path.exists
assert path.is_file
assert path.user == 'root'
assert path.group == 'root'
assert path.mode == 0o644
assert path.contains('keyfile /etc/chrony/chrony.keys')
assert path.contains('server 0.fr.pool.ntp.org iburst')
assert path.contains('server 1.fr.pool.ntp.org iburst')
assert not path.contains('2.debian.pool.ntp.org')
def test_keys_file(host):
path = host.file('/etc/chrony/chrony.keys')
assert path.exists
assert path.is_file
assert path.user == 'root'
assert path.group == 'root'
assert path.mode == 0o600
assert path.contains('42 SHA-256 HEX:11881F168AF08DB67736A9530F952BB7D8CCA3F3')
def test_service(host):
service = host.service('chrony')
assert service.is_running
assert service.is_enabled