From f350cdab662a6feca661226fec0cd10f69363ab8 Mon Sep 17 00:00:00 2001 From: guscarreon Date: Wed, 2 Sep 2020 12:51:09 -0400 Subject: [PATCH] Fix Test TestEventChannel_OutputFormat (#1468) --- analytics/pubstack/eventchannel/eventchannel_test.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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) - }