forked from MaciejMis/telegraf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zookeeper_test.go
42 lines (34 loc) · 848 Bytes
/
zookeeper_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
package zookeeper
import (
"testing"
"github.com/influxdata/telegraf/testutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestZookeeperGeneratesMetrics(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
z := &Zookeeper{
Servers: []string{testutil.GetLocalHost() + ":2181"},
}
var acc testutil.Accumulator
require.NoError(t, acc.GatherError(z.Gather))
intMetrics := []string{
"avg_latency",
"max_latency",
"min_latency",
"packets_received",
"packets_sent",
"outstanding_requests",
"znode_count",
"watch_count",
"ephemerals_count",
"approximate_data_size",
"open_file_descriptor_count",
"max_file_descriptor_count",
}
for _, metric := range intMetrics {
assert.True(t, acc.HasInt64Field("zookeeper", metric), metric)
}
}