-
Notifications
You must be signed in to change notification settings - Fork 0
/
features.bats
50 lines (40 loc) · 1.52 KB
/
features.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
#!/usr/bin/env bats
# Given a healthy kubernetes network
# When viewing a monitor instance
# Then the monitor should report that the network is healthy
@test "with a healthy network, the monitor can talk to indicators" {
podman build --tag indicator --file indicator/Containerfile.serve indicator
podman build --tag monitor --file monitor/Containerfile.serve monitor
indicator=`podman create --network host indicator`
monitor=`podman create --network host --env INDICATORS=http://localhost:4567 monitor`
podman start $indicator
podman start $monitor
for i in http://localhost:{4567,4568}/-/liveness; do
while ! curl "$i"; do
sleep 1
done
done
body=`curl http://localhost:4568/metrics`
podman stop $indicator
podman stop $monitor
podman rm $indicator
podman rm $monitor
echo "$body" >&2
echo "$body" | grep '^kube.*{indicator="http://localhost:4567"} 1$'
}
# Given an indicator is unreachable
# When viewing a monitor instance
# Then the monitor should report that it cannot reach the indicator
@test "when an indicator is unreachable, the monitor reports it unreachable" {
podman build --tag monitor --file monitor/Containerfile.serve monitor
monitor=`podman create --network host --env INDICATORS=http://localhost:4567 monitor`
podman start $monitor
while ! curl http://localhost:4568/-/liveness; do
sleep 1
done
body=`curl http://localhost:4568/metrics`
podman stop $monitor
podman rm $monitor
echo "$body" >&2
echo "$body" | grep '^kube.*{indicator="http://localhost:4567"} 0$'
}