added docker image unit test with OpenTSDB

This commit is contained in:
Roman Plessl 2015-09-11 22:24:53 +02:00 committed by Cameron Sparr
parent 7e3beaf822
commit 08b220a1fb
2 changed files with 26 additions and 11 deletions

View File

@ -3,20 +3,11 @@ package opentsdb
import ( import (
"reflect" "reflect"
"testing" "testing"
)
var ( "github.com/influxdb/telegraf/testutil"
fakeHost = "metrics.example.com" "github.com/stretchr/testify/require"
fakePort = 4242
) )
func fakeOpenTSDB() *OpenTSDB {
var o OpenTSDB
o.Host = fakeHost
o.Port = fakePort
return &o
}
func TestBuildTagsTelnet(t *testing.T) { func TestBuildTagsTelnet(t *testing.T) {
var tagtests = []struct { var tagtests = []struct {
bpIn map[string]string 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)
}

View File

@ -25,3 +25,9 @@ kafka:
environment: environment:
ADVERTISED_HOST: ADVERTISED_HOST:
ADVERTISED_PORT: 9092 ADVERTISED_PORT: 9092
opentsdb:
image: lancope/opentsdb
ports:
- "24242:4242"