32 lines
634 B
Go
32 lines
634 B
Go
|
package memcached
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/influxdb/telegraf/testutil"
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
|
func TestMemcachedGeneratesMetrics(t *testing.T) {
|
||
|
m := &Memcached{
|
||
|
Servers: []string{"localhost"},
|
||
|
}
|
||
|
|
||
|
var acc testutil.Accumulator
|
||
|
|
||
|
err := m.Gather(&acc)
|
||
|
require.NoError(t, err)
|
||
|
|
||
|
intMetrics := []string{"get_hits", "get_misses", "evictions"}
|
||
|
floatMetrics := []string{"usage"}
|
||
|
|
||
|
for _, metric := range intMetrics {
|
||
|
assert.True(t, acc.HasIntValue(metric), metric)
|
||
|
}
|
||
|
|
||
|
for _, metric := range floatMetrics {
|
||
|
assert.True(t, acc.HasFloatValue(metric), metric)
|
||
|
}
|
||
|
}
|