Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ["MOLECULE_INVENTORY_FILE"]
).get_hosts("all")
def test_postfix_is_installed(host):
p = host.package("postfix")
assert p.is_installed
def test_postfix_main(host):
f = host.file("/etc/postfix/main.cf")
assert f.exists
def test_mailname(host):
f = host.file("/etc/mailname")
assert f.exists
def test_aliases(host):
f = host.file("/etc/aliases")
assert f.exists
assert f.contains("devnull:")
assert f.contains("root:")
def test_postfix_virtual(host):
f = host.file("/etc/postfix/virtual")
assert f.exists
assert f.contains("postmaster@")
assert f.contains("bounces@")
assert f.contains("noreply@")
def test_postfix_generic(host):
f = host.file("/etc/postfix/generic")
assert f.exists
assert f.contains("root@")
def test_postfix_service(host):
s = host.service("postfix")
assert s.is_running
assert s.is_enabled
def test_postfix_listen(host):
s = host.socket("tcp://127.0.0.1:25")
assert s.is_listening