-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathp2p_daemon.py
More file actions
36 lines (29 loc) · 1.03 KB
/
p2p_daemon.py
File metadata and controls
36 lines (29 loc) · 1.03 KB
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
# Example test that checks p2p daemon status
import common.test as t
import common.result as r
# Executor is the main entry point for a test
# This function
def Executor(t):
return t.ExecuteCommand("systemctl status subutai-p2p.service")
# ResultHandler will handle result returned by executor
# In case of p2p daemon we expect it to have 'active' word in
# systemctl status command output
def ResultHandler(t, result):
status = -1
if 'running' in result[1]:
t.MarkAsSucceed()
status = 0
else:
t.MarkAsFailed()
status = 1
result = r.Result(t.GetComponent(), t.GetName(), status)
# If you have additional data for results, you can use r.append(key, value) method
# All extra fields will be added to payload field of resulting YAML
return result
# Test creates an instance of `Test` class, sets callbacks and returns it
# for later registration
def Test():
test = t.Test(0, "p2p", "daemon")
test.SetExecutor(Executor)
test.SetHandler(ResultHandler)
return test