Skip to content

Commit

Permalink
test(pubsublite): fix flaky TestAssignerHandlePartitionFailure (#3671)
Browse files Browse the repository at this point in the history
Checks only the final error to ensure the test is deterministic.

Fixes #3667.
  • Loading branch information
tmdiep committed Feb 4, 2021
1 parent 8eede84 commit 38b944a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pubsublite/internal/wire/assigner_test.go
Expand Up @@ -199,13 +199,10 @@ func TestAssignerHandlePartitionFailure(t *testing.T) {
wantErr := errors.New("subscriber shutting down")
asn.SetReceiveError(wantErr)

if gotErr := asn.StartError(); gotErr != nil {
t.Errorf("Start() got err: (%v)", gotErr)
if gotErr := asn.FinalError(); !test.ErrorEqual(gotErr, wantErr) {
t.Errorf("Final err: (%v), want: (%v)", gotErr, wantErr)
}
if got, want := asn.NextPartitions(), []int{1, 2}; !testutil.Equal(got, want) {
t.Errorf("Partition assignments: got %v, want %v", got, want)
}
if gotErr := asn.FinalError(); !test.ErrorEqual(gotErr, wantErr) {
t.Errorf("Final err: (%v), want: (%v)", gotErr, wantErr)
}
}

0 comments on commit 38b944a

Please sign in to comment.