added docker image unit test with OpenTSDB
This commit is contained in:
parent
7e3beaf822
commit
08b220a1fb
|
@ -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)
|
||||||
|
}
|
||||||
|
|
|
@ -25,3 +25,9 @@ kafka:
|
||||||
environment:
|
environment:
|
||||||
ADVERTISED_HOST:
|
ADVERTISED_HOST:
|
||||||
ADVERTISED_PORT: 9092
|
ADVERTISED_PORT: 9092
|
||||||
|
|
||||||
|
opentsdb:
|
||||||
|
image: lancope/opentsdb
|
||||||
|
ports:
|
||||||
|
- "24242:4242"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue