mirror of https://github.com/status-im/consul.git
stream: handle empty event in TestEventSnapshot
When the race detector is enabled we see this test fail occasionally. The reordering of execution seems to make it possible for the snapshot splice to happen before any events are published to the topicBuffers. We can handle this case in the test the same way it is handled by a subscription, by proceeding to the next event.
This commit is contained in:
parent
49edce1076
commit
9482961b1c
|
@ -121,6 +121,12 @@ func TestEventSnapshot(t *testing.T) {
|
|||
require.NoError(t, err,
|
||||
"current state: snapDone=%v snapIDs=%s updateIDs=%s", snapDone,
|
||||
snapIDs, updateIDs)
|
||||
if len(curItem.Events) == 0 {
|
||||
// An item without an error or events is a bufferItem.NextLink event.
|
||||
// A subscription handles this by proceeding to the next item,
|
||||
// so we do the same here.
|
||||
continue
|
||||
}
|
||||
e := curItem.Events[0]
|
||||
switch {
|
||||
case snapDone:
|
||||
|
|
Loading…
Reference in New Issue