mirror of https://github.com/hashicorp/consul
Merge pull request #8344 from hashicorp/dnephin/fix-flakes-in-stream
stream: handle empty event in TestEventSnapshotpull/8300/head
commit
a33a7a6fe2
|
@ -154,9 +154,10 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: go test -race
|
name: go test -race
|
||||||
command: |
|
command: |
|
||||||
mkdir -p $TEST_RESULTS_DIR
|
mkdir -p $TEST_RESULTS_DIR /tmp/jsonfile
|
||||||
gotestsum \
|
gotestsum \
|
||||||
--format=short-verbose \
|
--format=short-verbose \
|
||||||
|
--jsonfile /tmp/jsonfile/go-test-race.log \
|
||||||
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
|
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
|
||||||
-tags="$GOTAGS" -p 2 \
|
-tags="$GOTAGS" -p 2 \
|
||||||
-race -gcflags=all=-d=checkptr=0 \
|
-race -gcflags=all=-d=checkptr=0 \
|
||||||
|
@ -168,6 +169,8 @@ jobs:
|
||||||
path: *TEST_RESULTS_DIR
|
path: *TEST_RESULTS_DIR
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: *TEST_RESULTS_DIR
|
path: *TEST_RESULTS_DIR
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/jsonfile
|
||||||
|
|
||||||
# split off a job for the API package since it is separate
|
# split off a job for the API package since it is separate
|
||||||
go-test-api:
|
go-test-api:
|
||||||
|
|
|
@ -121,6 +121,12 @@ func TestEventSnapshot(t *testing.T) {
|
||||||
require.NoError(t, err,
|
require.NoError(t, err,
|
||||||
"current state: snapDone=%v snapIDs=%s updateIDs=%s", snapDone,
|
"current state: snapDone=%v snapIDs=%s updateIDs=%s", snapDone,
|
||||||
snapIDs, updateIDs)
|
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]
|
e := curItem.Events[0]
|
||||||
switch {
|
switch {
|
||||||
case snapDone:
|
case snapDone:
|
||||||
|
|
Loading…
Reference in New Issue