0.3.0 unit tests: statsd, trig, zookeeper

This commit is contained in:
Cameron Sparr 2016-01-06 18:19:18 -07:00
parent c01594c2a4
commit 10f19fade1
3 changed files with 6 additions and 11 deletions

View File

@ -647,7 +647,7 @@ func TestParse_Counters(t *testing.T) {
func TestParse_Timings(t *testing.T) {
s := NewStatsd()
s.Percentiles = []int{90}
testacc := &testutil.Accumulator{}
acc := &testutil.Accumulator{}
// Test that counters work
valid_lines := []string{
@ -665,7 +665,7 @@ func TestParse_Timings(t *testing.T) {
}
}
s.Gather(testacc)
s.Gather(acc)
tests := []struct {
name string
@ -698,10 +698,8 @@ func TestParse_Timings(t *testing.T) {
}
for _, test := range tests {
if !testacc.CheckValue(test.name, test.value) {
t.Errorf("Did not find measurement %s with value %v",
test.name, test.value)
}
acc.AssertContainsFields(t, test.name,
map[string]interface{}{"value": test.value})
}
}

View File

@ -5,8 +5,6 @@ import (
"testing"
"github.com/influxdb/telegraf/testutil"
"github.com/stretchr/testify/assert"
// "github.com/stretchr/testify/require"
)
func TestTrig(t *testing.T) {
@ -27,7 +25,6 @@ func TestTrig(t *testing.T) {
fields["sine"] = sine
fields["cosine"] = cosine
assert.True(t, acc.CheckFieldsValue("trig", fields))
acc.AssertContainsFields(t, "trig", fields)
}
}

View File

@ -38,6 +38,6 @@ func TestZookeeperGeneratesMetrics(t *testing.T) {
}
for _, metric := range intMetrics {
assert.True(t, acc.HasIntValue(metric), metric)
assert.True(t, acc.HasIntField("zookeeper", metric), metric)
}
}