2015-10-27 16:59:05 +00:00
|
|
|
package nsq
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2016-01-20 20:19:03 +00:00
|
|
|
"github.com/influxdata/telegraf/testutil"
|
2015-10-27 16:59:05 +00:00
|
|
|
"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"}
|
|
|
|
n := &NSQ{
|
2015-10-27 17:46:16 +00:00
|
|
|
Server: server[0],
|
2015-10-27 16:59:05 +00:00
|
|
|
Topic: "telegraf",
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|
2015-10-27 17:50:16 +00:00
|
|
|
err = n.Write(testutil.MockBatchPoints().Points())
|
2015-10-27 16:59:05 +00:00
|
|
|
require.NoError(t, err)
|
|
|
|
}
|