Skip to content

Commit dc01c0f

Browse files
author
Steven.Osborne
committed
Wait for items to make it to batchChan in test
1 parent ff2a0ec commit dc01c0f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

batcher/batcher_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,15 @@ func TestDispose(t *testing.T) {
149149
[]interface{}{"a", "b"},
150150
[]interface{}{"c"},
151151
}
152+
153+
// Wait for items to get to the channel
154+
for len(b.(*basicBatcher).batchChan) == 0 {
155+
time.Sleep(1 * time.Millisecond)
156+
}
152157
batch1, err := b.Get()
153158
assert.Contains(possibleBatches, batch1)
154159
assert.Nil(err)
160+
155161
batch2, err := b.Get()
156162
assert.Contains(possibleBatches, batch2)
157163
assert.Nil(err)

0 commit comments

Comments
 (0)