import os
import re
import testinfra.utils.ansible_runner
@@ -64,6 +65,22 @@ def test_postfix_main_cf_file(host):
assert config.mode == 0o644
def test_postfix_main_configuration_is_valid(host):
"""
Tests if Postfix main configuration is valid and not producing any
warnings.
postconf = host.run('/usr/sbin/postconf')
# Clean-up the SSH warning from the beginning of stderr if
# present.
stderr = re.sub("^Warning: Permanently added.*?\r\n", "", postconf.stderr)
assert postconf.rc == 0
assert stderr == ""
def test_services(host):
Tests if all the necessary services are enabled and running.