-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_test.go
More file actions
55 lines (48 loc) · 858 Bytes
/
Copy pathcheck_test.go
File metadata and controls
55 lines (48 loc) · 858 Bytes
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
package main
import (
"log"
"net/http"
"os"
"testing"
)
func TestExecCheck(t *testing.T) {
res, err := http.Get("https://google.com")
if err != nil {
t.Fatal(err)
return
}
e := ExecCheck{
command: "/usr/bin/sh -c 'echo $AVAIL_HTTP'",
log: log.New(os.Stderr, "exec-output", 0),
}
isUp, err := e.IsUp(res)
if err != nil {
t.Fatal(err)
return
}
if !isUp {
t.Fatal("Host is expected to be considered online!")
return
}
}
func TestShellCheck(t *testing.T) {
res, err := http.Get("https://google.com")
if err != nil {
t.Fatal(err)
return
}
e := ShellCheck{
shell: "/usr/bin/sh",
script: "echo $AVAIL_HTTP",
log: log.New(os.Stderr, "shell-output", 0),
}
isUp, err := e.IsUp(res)
if err != nil {
t.Fatal(err)
return
}
if !isUp {
t.Fatal("Host is expected to be considered online!")
return
}
}