telegraf/plugins/inputs/zookeeper/zookeeper_test.go

43 lines
848 B
Go
Raw Permalink Normal View History

package zookeeper
import (
"testing"
2016-01-20 18:57:35 +00:00
"github.com/influxdata/telegraf/testutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
2015-10-14 02:01:07 +00:00
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
2017-04-24 18:13:26 +00:00
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)
}
}