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 (
"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)
}

View File

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