-
Notifications
You must be signed in to change notification settings - Fork 2
/
oogway_test.go
50 lines (42 loc) · 1.14 KB
/
oogway_test.go
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
package main
import (
"log"
"testing"
"time"
)
func TestOogwayLoadChannel(t *testing.T) {
oogway := Dojo(
&oogway{
ChecksDir: "t/suiteA",
CheckInterval: 0 * time.Second,
ChecksExtension: "com",
})
if oogway.loadChecks() != nil {
log.Fatalf("There was a problem unmarshling the YAML")
}
// kcmerrill.com check should exist
if check, exists := oogway.checks["kcmerrill.com"]; exists {
// checks should be initalized
if check.Attempts != 0 {
log.Fatalf("kcmerrill.com has not been attempted. Should be zero")
}
// last checked
if !check.LastChecked.IsZero() {
log.Fatalf("kcmerill.com last checked should be never")
}
// the check command
if check.Instructions.Check.Cmd != "touch /tmp/suiteA.check.kcmerrill.com" {
log.Fatalf("kcmerrill.com command should have been set")
}
// when to reset
if check.Instructions.Reset != time.Hour {
log.Fatalf("Reset should have been set to 1h")
}
// when to go critical
if check.Instructions.Tries != 4 {
log.Fatalf("Try should have been set to 4 before going critical")
}
} else {
log.Fatalf("kcmerrill.com check should exist. Not found.")
}
}