remove sleep from tests (#2555)
This commit is contained in:
committed by
Daniel Nelson
parent
616b66f5cb
commit
1402c158b7
@@ -2,7 +2,6 @@ package kafka_consumer
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/telegraf/plugins/parsers"
|
||||
"github.com/influxdata/telegraf/testutil"
|
||||
@@ -43,7 +42,7 @@ func TestRunParser(t *testing.T) {
|
||||
k.parser, _ = parsers.NewInfluxParser()
|
||||
go k.receiver()
|
||||
in <- saramaMsg(testMsg)
|
||||
time.Sleep(time.Millisecond * 5)
|
||||
acc.Wait(1)
|
||||
|
||||
assert.Equal(t, acc.NFields(), 1)
|
||||
}
|
||||
@@ -58,7 +57,7 @@ func TestRunParserInvalidMsg(t *testing.T) {
|
||||
k.parser, _ = parsers.NewInfluxParser()
|
||||
go k.receiver()
|
||||
in <- saramaMsg(invalidMsg)
|
||||
time.Sleep(time.Millisecond * 5)
|
||||
acc.WaitError(1)
|
||||
|
||||
assert.Equal(t, acc.NFields(), 0)
|
||||
}
|
||||
@@ -73,7 +72,7 @@ func TestRunParserAndGather(t *testing.T) {
|
||||
k.parser, _ = parsers.NewInfluxParser()
|
||||
go k.receiver()
|
||||
in <- saramaMsg(testMsg)
|
||||
time.Sleep(time.Millisecond * 5)
|
||||
acc.Wait(1)
|
||||
|
||||
k.Gather(&acc)
|
||||
|
||||
@@ -92,7 +91,7 @@ func TestRunParserAndGatherGraphite(t *testing.T) {
|
||||
k.parser, _ = parsers.NewGraphiteParser("_", []string{}, nil)
|
||||
go k.receiver()
|
||||
in <- saramaMsg(testMsgGraphite)
|
||||
time.Sleep(time.Millisecond * 5)
|
||||
acc.Wait(1)
|
||||
|
||||
k.Gather(&acc)
|
||||
|
||||
@@ -111,7 +110,7 @@ func TestRunParserAndGatherJSON(t *testing.T) {
|
||||
k.parser, _ = parsers.NewJSONParser("kafka_json_test", []string{}, nil)
|
||||
go k.receiver()
|
||||
in <- saramaMsg(testMsgJSON)
|
||||
time.Sleep(time.Millisecond * 5)
|
||||
acc.Wait(1)
|
||||
|
||||
k.Gather(&acc)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user