forked from PowerDNS/pdns-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_repo_master.py
44 lines (32 loc) · 1.41 KB
/
test_repo_master.py
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
debian_os = ['debian', 'ubuntu']
rhel_os = ['redhat', 'centos', 'ol', 'rocky', 'almalinux']
def test_repo_file(host):
f = None
if host.system_info.distribution.lower() in debian_os:
f = host.file('/etc/apt/sources.list.d/powerdns-auth-master.list')
if host.system_info.distribution.lower() in rhel_os:
f = host.file('/etc/yum.repos.d/powerdns-auth-master.repo')
assert f.exists
assert f.user == 'root'
assert f.group == 'root'
def test_pdns_repo(host):
f = None
if host.system_info.distribution.lower() in debian_os:
f = host.file('/etc/apt/sources.list.d/powerdns-auth-master.list')
if host.system_info.distribution.lower() in rhel_os:
f = host.file('/etc/yum.repos.d/powerdns-auth-master.repo')
assert f.exists
assert f.contains('auth-master')
def test_repo_pinning_file(host):
if host.system_info.distribution.lower() in debian_os:
f = host.file('/etc/apt/preferences.d/pdns')
assert f.exists
assert f.user == 'root'
assert f.group == 'root'
f.contains('Package: pdns-*')
f.contains('Pin: origin repo.powerdns.com')
f.contains('Pin-Priority: 600')
def test_pdns_version(host):
cmd = host.run('/usr/sbin/pdns_server --version')
assert 'PowerDNS Authoritative Server' in cmd.stderr or 'PowerDNS Authoritative Server' in cmd.stdout
assert 'master' in cmd.stderr or 'master' in cmd.stdout