Skip to content

Commit

Permalink
Merge branch 'master' into regen_gocloud
Browse files Browse the repository at this point in the history
  • Loading branch information
codyoss committed Jan 14, 2021
2 parents 90dcead + 965f9c9 commit c81700a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions pubsublite/internal/test/msg_tracker.go
Expand Up @@ -75,6 +75,10 @@ func (mt *MsgTracker) Wait(timeout time.Duration) error {
totalCount := len(mt.msgMap)
mt.mu.Unlock()

if totalCount == 0 {
return nil
}

select {
case <-time.After(timeout):
mt.mu.Lock()
Expand Down
4 changes: 2 additions & 2 deletions pubsublite/internal/test/msg_tracker_test.go
Expand Up @@ -50,7 +50,7 @@ func TestMsgTrackerWaitTimeout(t *testing.T) {
t.Errorf("MsgTracker.Remove(%q) got %v, want %v", msg, got, want)
}
}
if gotErr, wantMsg := msgTracker.Wait(time.Millisecond), "received 2 of 3 messages"; ErrorHasMsg(gotErr, wantMsg) {
t.Errorf("MsgTracker.Wait() got err: %v, want msg: %q", gotErr, wantMsg)
if gotErr := msgTracker.Wait(time.Millisecond); gotErr == nil {
t.Errorf("MsgTracker.Wait() should return error")
}
}

0 comments on commit c81700a

Please sign in to comment.