telegraf/plugins/outputs/nsq/nsq_test.go

32 lines
700 B
Go
Raw Permalink Normal View History

package nsq
import (
"testing"
"github.com/influxdata/telegraf/plugins/serializers"
2016-01-20 18:57:35 +00:00
"github.com/influxdata/telegraf/testutil"
"github.com/stretchr/testify/require"
)
func TestConnectAndWrite(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
server := []string{testutil.GetLocalHost() + ":4150"}
s, _ := serializers.NewInfluxSerializer()
n := &NSQ{
Server: server[0],
Topic: "telegraf",
serializer: s,
}
// Verify that we can connect to the NSQ daemon
err := n.Connect()
require.NoError(t, err)
// Verify that we can successfully write data to the NSQ daemon
err = n.Write(testutil.MockMetrics())
require.NoError(t, err)
}