2015-10-21 19:05:14 +00:00
|
|
|
package aerospike
|
|
|
|
|
|
|
|
import (
|
2016-01-06 23:11:16 +00:00
|
|
|
"testing"
|
|
|
|
|
2016-01-20 18:57:35 +00:00
|
|
|
"github.com/influxdata/telegraf/testutil"
|
2015-10-21 19:05:14 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestAerospikeStatistics(t *testing.T) {
|
|
|
|
if testing.Short() {
|
|
|
|
t.Skip("Skipping integration test in short mode")
|
|
|
|
}
|
|
|
|
|
|
|
|
a := &Aerospike{
|
|
|
|
Servers: []string{testutil.GetLocalHost() + ":3000"},
|
|
|
|
}
|
|
|
|
|
|
|
|
var acc testutil.Accumulator
|
|
|
|
|
|
|
|
err := a.Gather(&acc)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2016-07-15 05:12:32 +00:00
|
|
|
assert.True(t, acc.HasMeasurement("aerospike_node"))
|
|
|
|
assert.True(t, acc.HasMeasurement("aerospike_namespace"))
|
|
|
|
assert.True(t, acc.HasIntField("aerospike_node", "batch_error"))
|
2015-10-21 19:05:14 +00:00
|
|
|
}
|
|
|
|
|
2016-07-15 05:12:32 +00:00
|
|
|
func TestAerospikeStatisticsPartialErr(t *testing.T) {
|
|
|
|
if testing.Short() {
|
|
|
|
t.Skip("Skipping integration test in short mode")
|
2015-10-21 19:05:14 +00:00
|
|
|
}
|
|
|
|
|
2016-07-15 05:12:32 +00:00
|
|
|
a := &Aerospike{
|
|
|
|
Servers: []string{
|
|
|
|
testutil.GetLocalHost() + ":3000",
|
|
|
|
testutil.GetLocalHost() + ":9999",
|
|
|
|
},
|
2015-10-21 19:05:14 +00:00
|
|
|
}
|
|
|
|
|
2016-01-06 23:11:16 +00:00
|
|
|
var acc testutil.Accumulator
|
|
|
|
|
2016-07-15 05:12:32 +00:00
|
|
|
err := a.Gather(&acc)
|
|
|
|
require.Error(t, err)
|
2016-01-06 23:11:16 +00:00
|
|
|
|
2016-07-15 05:12:32 +00:00
|
|
|
assert.True(t, acc.HasMeasurement("aerospike_node"))
|
|
|
|
assert.True(t, acc.HasMeasurement("aerospike_namespace"))
|
|
|
|
assert.True(t, acc.HasIntField("aerospike_node", "batch_error"))
|
2016-01-06 23:11:16 +00:00
|
|
|
}
|