Skip to content

Commit

Permalink
Fix Test TestEventChannel_OutputFormat (#1468)
Browse files Browse the repository at this point in the history
  • Loading branch information
guscarreon authored Sep 2, 2020
1 parent 754de04 commit f350cda
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions analytics/pubstack/eventchannel/eventchannel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

}

0 comments on commit f350cda

Please sign in to comment.