Add NATS output plugin.
Added NATS server container needed for tests. Added NATS output plug-in. Fixes #1487 NATS output plug-in use internal.GetTLSConfig to instrument TLS configuration. Added NATS output plug-in to changelog. closes #1487 closes #1697
This commit is contained in:
committed by
Cameron Sparr
parent
1271f9d71a
commit
6b1cc67664
31
plugins/outputs/nats/nats_test.go
Normal file
31
plugins/outputs/nats/nats_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package nats
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/influxdata/telegraf/plugins/serializers"
|
||||
"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{"nats://" + testutil.GetLocalHost() + ":4222"}
|
||||
s, _ := serializers.NewInfluxSerializer()
|
||||
n := &NATS{
|
||||
Servers: server,
|
||||
Subject: "telegraf",
|
||||
serializer: s,
|
||||
}
|
||||
|
||||
// Verify that we can connect to the NATS daemon
|
||||
err := n.Connect()
|
||||
require.NoError(t, err)
|
||||
|
||||
// Verify that we can successfully write data to the NATS daemon
|
||||
err = n.Write(testutil.MockMetrics())
|
||||
require.NoError(t, err)
|
||||
}
|
||||
Reference in New Issue
Block a user