forked from Colstuwjx/awx-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ping_test.go
44 lines (40 loc) · 809 Bytes
/
ping_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
package awx
import (
"testing"
"time"
)
func TestPing(t *testing.T) {
var (
expectPingResponse = &Ping{
Instances: []Instance{
{
Node: "awx",
Heartbeat: func() time.Time {
t, _ := time.Parse(time.RFC3339, "2018-06-25T03:14:34.688447Z")
return t
}(),
Version: "1.0.6.5",
Capacity: 138,
},
},
InstanceGroups: []InstanceGroup{
{
Instances: []string{"awx"},
Capacity: 138,
Name: "tower",
},
},
Ha: false,
Version: "1.0.6.5",
ActiveNode: "awx",
}
)
awx := NewAWX(testAwxHost, testAwxUserName, testAwxPasswd, nil)
result, err := awx.PingService.Ping()
if err != nil {
t.Fatalf("Ping err: %s", err)
} else {
checkAPICallResult(t, *expectPingResponse, *result)
t.Log("Ping passed!")
}
}