Merge pull request #8344 from hashicorp/dnephin/fix-flakes-in-stream

stream: handle empty event in TestEventSnapshot
This commit is contained in:
Daniel Nephin 2020-07-21 13:14:35 -04:00 committed by GitHub
commit a33a7a6fe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -154,9 +154,10 @@ jobs:
- run:
name: go test -race
command: |
mkdir -p $TEST_RESULTS_DIR
mkdir -p $TEST_RESULTS_DIR /tmp/jsonfile
gotestsum \
--format=short-verbose \
--jsonfile /tmp/jsonfile/go-test-race.log \
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
-tags="$GOTAGS" -p 2 \
-race -gcflags=all=-d=checkptr=0 \
@ -168,6 +169,8 @@ jobs:
path: *TEST_RESULTS_DIR
- store_artifacts:
path: *TEST_RESULTS_DIR
- store_artifacts:
path: /tmp/jsonfile
# split off a job for the API package since it is separate
go-test-api:

View File

@ -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: