diff --git a/outputs/opentsdb/opentsdb_test.go b/outputs/opentsdb/opentsdb_test.go index bd1bd8f7e..774c06953 100644 --- a/outputs/opentsdb/opentsdb_test.go +++ b/outputs/opentsdb/opentsdb_test.go @@ -3,20 +3,11 @@ package opentsdb import ( "reflect" "testing" -) -var ( - fakeHost = "metrics.example.com" - fakePort = 4242 + "github.com/influxdb/telegraf/testutil" + "github.com/stretchr/testify/require" ) -func fakeOpenTSDB() *OpenTSDB { - var o OpenTSDB - o.Host = fakeHost - o.Port = fakePort - return &o -} - func TestBuildTagsTelnet(t *testing.T) { var tagtests = []struct { bpIn map[string]string @@ -51,3 +42,21 @@ func TestBuildTagsTelnet(t *testing.T) { } } } +func TestWrite(t *testing.T) { + if testing.Short() { + t.Skip("Skipping integration test in short mode") + } + + o := &OpenTSDB{ + Host: testutil.GetLocalHost() , + Port: 24242, + } + + // Verify that we can connect to the OpenTSDB instance + err := o.Connect() + require.NoError(t, err) + + // Verify that we can successfully write data to OpenTSDB + err = o.Write(testutil.MockBatchPoints()) + require.NoError(t, err) +} diff --git a/scripts/docker-compose.yml b/scripts/docker-compose.yml index c51a0235b..a41cb67f4 100644 --- a/scripts/docker-compose.yml +++ b/scripts/docker-compose.yml @@ -25,3 +25,9 @@ kafka: environment: ADVERTISED_HOST: ADVERTISED_PORT: 9092 + +opentsdb: + image: lancope/opentsdb + ports: + - "24242:4242" +