diff --git a/analytics/pubstack/eventchannel/eventchannel_test.go b/analytics/pubstack/eventchannel/eventchannel_test.go index 792e15e151e..f450fb61fe1 100644 --- a/analytics/pubstack/eventchannel/eventchannel_test.go +++ b/analytics/pubstack/eventchannel/eventchannel_test.go @@ -3,11 +3,12 @@ package eventchannel import ( "bytes" "compress/gzip" - "github.com/stretchr/testify/assert" "io/ioutil" "sync" "testing" "time" + + "github.com/stretchr/testify/assert" ) var maxByteSize = int64(15) @@ -160,16 +161,21 @@ func TestEventChannel_OutputFormat(t *testing.T) { eventChannel := NewEventChannel(send, 15000, 10, 2*time.Minute) eventChannel.Push([]byte("one")) + time.Sleep(1 * time.Millisecond) + eventChannel.flush() + eventChannel.Push([]byte("two")) + time.Sleep(1 * time.Millisecond) + eventChannel.Push([]byte("three")) + time.Sleep(1 * time.Millisecond) eventChannel.Close() - time.Sleep(10 * time.Millisecond) + time.Sleep(1 * time.Millisecond) expected := append(toGzip("one"), toGzip("twothree")...) assert.Equal(t, expected, data) - }