forked from cloudalchemy/ansible-fluentd
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_default.py
62 lines (51 loc) · 1.34 KB
/
test_default.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_directories(host):
present = [
"/etc/td-agent"
]
if present:
for directory in present:
d = host.file(directory)
assert d.is_directory
assert d.exists
def test_files(host):
present = [
"/etc/td-agent/td-agent.conf",
"/etc/td-agent/conf.d/filter.conf",
"/etc/td-agent/conf.d/match.conf",
"/etc/td-agent/conf.d/plugin.conf",
"/etc/td-agent/conf.d/source.conf"
]
if present:
for file in present:
f = host.file(file)
assert f.exists
assert f.is_file
def test_service(host):
present = [
"td-agent"
]
if present:
for service in present:
s = host.service(service)
assert s.is_enabled
assert s.is_running
def test_packages(host):
present = [
"td-agent"
]
if present:
for package in present:
p = host.package(package)
assert p.is_installed
# Prometheus
def test_socket(host):
present = [
"tcp://127.0.0.1:24231"
]
for socket in present:
s = host.socket(socket)
assert s.is_listening