telegraf/outputs/amqp/amqp_test.go

29 lines
590 B
Go
Raw Normal View History

2015-09-15 18:16:53 +00:00
package amqp
import (
"testing"
"github.com/influxdb/telegraf/testutil"
"github.com/stretchr/testify/require"
)
func TestConnectAndWrite(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
var url = "amqp://" + testutil.GetLocalHost() + ":5672/"
q := &AMQP{
URL: url,
Exchange: "telegraf_test",
}
// Verify that we can connect to the AMQP broker
2015-09-15 18:16:53 +00:00
err := q.Connect()
require.NoError(t, err)
// Verify that we can successfully write data to the amqp broker
2015-09-15 18:16:53 +00:00
err = q.Write(testutil.MockBatchPoints())
require.NoError(t, err)
}