-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathlinux-metrics.bats
72 lines (61 loc) · 1.82 KB
/
linux-metrics.bats
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
64
65
66
67
68
69
70
71
72
## linux:metrics tests
@test "run pmm-admin under regular(non-root) user privileges" {
if [[ $(id -u) -eq 0 ]] ; then
skip "Skipping this test, because you are running under root"
fi
run pmm-admin
echo "$output"
[ "$status" -eq 1 ]
[ "${lines[0]}" = "pmm-admin requires superuser privileges to manage system services." ]
}
@test "run pmm-admin under root privileges" {
if [[ $(id -u) -ne 0 ]] ; then
skip "Skipping this test, because you are NOT running under root"
fi
run pmm-admin
echo "$output"
[ "$status" -eq 1 ]
[ "${lines[0]}" = "Usage:" ]
}
# @test "run pmm-admin list" {
# run sudo pmm-admin list
# echo "$output"
# [ "$status" -eq 0 ]
# echo "${output}" | grep "pmm-admin 1.1.1"
# }
@test "run pmm-admin add linux:metrics" {
run sudo pmm-admin add linux:metrics
echo "$output"
[ "$status" -eq 1 ]
echo "${output}" | grep "there is already one instance"
}
@test "run pmm-admin purge linux:metrics" {
run sudo pmm-admin purge linux:metrics
echo "$output"
[ "$status" -eq 0 ]
echo "${output}" | grep "OK, data purged"
}
@test "run pmm-admin remove linux:metrics" {
run sudo pmm-admin remove linux:metrics
echo "$output"
[ "$status" -eq 1 ]
echo "${output}" | grep "no service found"
}
@test "run pmm-admin add linux:metrics with given name" {
run sudo pmm-admin add linux:metrics mytest1.os1
echo "$output"
[ "$status" -eq 1 ]
echo "${output}" | grep "there is already one instance"
}
@test "run pmm-admin remove linux:metrics with given name" {
run sudo pmm-admin remove linux:metrics mytest1.os1
echo "$output"
[ "$status" -eq 1 ]
echo "${output}" | grep "no service found"
}
@test "run pmm-admin purge linux:metrics with given name" {
run sudo pmm-admin purge linux:metrics mytest1.os1
echo "$output"
[ "$status" -eq 0 ]
echo "${output}" | grep "OK, data purged"
}