-
Notifications
You must be signed in to change notification settings - Fork 1
/
health_test.go
104 lines (80 loc) · 4.07 KB
/
health_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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package gocd_test
import (
_ "embed"
"net/http"
"testing"
"github.com/nikhilsbhat/gocd-sdk-go"
"github.com/stretchr/testify/assert"
)
//go:embed internal/fixtures/server_healsth_messages.json
var healthMessages string
func TestConfig_GetHealthInfo(t *testing.T) {
correctConfigHeader := map[string]string{"Accept": gocd.HeaderVersionOne}
t.Run("should error out while fetching health status information from server", func(t *testing.T) {
client := gocd.NewClient("http://localhost:8156/go", auth, "info", nil)
client.SetRetryCount(1)
client.SetRetryWaitTime(1)
actual, err := client.GetServerHealthMessages()
assert.EqualError(t, err, "call made to get health info errored with: "+
"Get \"http://localhost:8156/go/api/server_health_messages\": dial tcp [::1]:8156: connect: connection refused")