forked from osism/ansible-collection-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbird.py
40 lines (26 loc) · 1.01 KB
/
bird.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
from .util.util import get_ansible, get_variable
testinfra_runner, testinfra_hosts = get_ansible()
def test_pkg(host):
package_name = get_variable(host, "bird_package_name")
assert package_name != ""
package = host.package(package_name)
assert package.is_installed
def test_conffile(host):
with host.sudo("bird"):
f = host.file("/etc/bird/bird.conf")
assert f.exists
assert not f.is_directory
assert f.user == "bird"
assert f.group == "bird"
assert f.mode == 0o640
bird_cidr = get_variable(host, "bird_cidr")
assert f"if net ~ [ {bird_cidr}+ ] then " in f.content_string
def test_sysctl(host):
bird_sysctl = get_variable(host, "bird_sysctl")
assert type(bird_sysctl) is list
for element in bird_sysctl:
assert host.sysctl(f"{element['name']}") == element["value"]
def test_srv(host):
service = host.service(get_variable(host, "bird_service_name"))
assert service.is_running
assert service.is_enabled