forked from couchbase/gocb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bucket_diag_test.go
47 lines (39 loc) · 953 Bytes
/
bucket_diag_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
package gocb
import (
"testing"
)
func TestDiagnostics(t *testing.T) {
report, err := globalBucket.Diagnostics()
if err != nil {
t.Fatalf("Failed to fetch diagnostics: %s", err)
}
if len(report.Services) == 0 {
t.Fatalf("Diagnostics report contained no services")
}
for _, service := range report.Services {
if service.RemoteAddr == "" {
t.Fatalf("Diagnostic report contained invalid entry")
}
}
}
func TestPing(t *testing.T) {
// We only test the main services, which are the ones support
// by our mock at the moment.
report, err := globalBucket.Ping([]ServiceType{
MemdService,
CapiService,
N1qlService,
})
if err != nil {
t.Fatalf("Failed to perform ping: %s", err)
}
if len(report.Services) == 0 {
t.Fatalf("Ping report contained no services")
}
logDebugf("%+v", report)
for _, service := range report.Services {
if service.Latency == 0 {
t.Fatalf("Ping report contained invalid entry")
}
}
}