2015-06-22 02:27:46 +00:00
|
|
|
package memcached
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/influxdb/telegraf/testutil"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMemcachedGeneratesMetrics(t *testing.T) {
|
2015-08-04 20:52:44 +00:00
|
|
|
if testing.Short() {
|
|
|
|
t.Skip("Skipping integration test in short mode")
|
|
|
|
}
|
|
|
|
|
2015-06-22 02:27:46 +00:00
|
|
|
m := &Memcached{
|
2015-07-07 01:18:31 +00:00
|
|
|
Servers: []string{testutil.GetLocalHost()},
|
2015-06-22 02:27:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var acc testutil.Accumulator
|
|
|
|
|
|
|
|
err := m.Gather(&acc)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2015-06-23 07:44:39 +00:00
|
|
|
intMetrics := []string{"get_hits", "get_misses", "evictions", "limit_maxbytes", "bytes"}
|
2015-06-22 02:27:46 +00:00
|
|
|
|
|
|
|
for _, metric := range intMetrics {
|
|
|
|
assert.True(t, acc.HasIntValue(metric), metric)
|
|
|
|
}
|
|
|
|
}
|