0.3.0 unit tests: agent and prometheus

This commit is contained in:
Cameron Sparr
2016-01-07 10:52:46 -07:00
parent 4fdcb136bc
commit 64b98a9b61
3 changed files with 53 additions and 59 deletions

View File

@@ -3,11 +3,11 @@ package prometheus_client
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/influxdb/influxdb/client/v2"
"github.com/influxdb/telegraf/plugins/prometheus"
"github.com/influxdb/telegraf/testutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
var pTesting *PrometheusClient
@@ -48,7 +48,8 @@ func TestPrometheusWritePointEmptyTag(t *testing.T) {
require.NoError(t, p.Gather(&acc))
for _, e := range expected {
assert.NoError(t, acc.ValidateValue(e.name, e.value))
acc.AssertContainsFields(t, "prometheus_"+e.name,
map[string]interface{}{"value": e.value})
}
}
@@ -88,7 +89,8 @@ func TestPrometheusWritePointTag(t *testing.T) {
require.NoError(t, p.Gather(&acc))
for _, e := range expected {
assert.True(t, acc.CheckTaggedValue(e.name, e.value, tags))
acc.AssertContainsFields(t, "prometheus_"+e.name,
map[string]interface{}{"value": e.value})
}
}