Skip to content

Commit

Permalink
Adjust test now that we're not closing the channel.
Browse files Browse the repository at this point in the history
  • Loading branch information
seizethedave committed Jun 20, 2024
1 parent a71b4cb commit 7b7d375
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/scheduler/queue/queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,8 @@ func TestRequestQueue_GetNextRequestForQuerier_ShouldReturnImmediatelyIfQuerierI
require.EqualError(t, err, "querier has informed the scheduler it is shutting down")
}

func TestRequestQueue_GetNextRequestForQuerier_ShouldReturnErrorIfChanClosed(t *testing.T) {
// This tests a rare (~5 in 100K test runs) race where a closed querier
func TestRequestQueue_GetNextRequestForQuerier_ShouldReturnErrorIfCtxCanceled(t *testing.T) {
// This tests a rare (~5 in 100K test runs) race where a canceled querier
// context results in WaitForRequestForQuerier returning no error yet a nil
// request.

Expand Down Expand Up @@ -660,9 +660,8 @@ func TestRequestQueue_GetNextRequestForQuerier_ShouldReturnErrorIfChanClosed(t *
cctx, cancel := context.WithCancel(ctx)
cancel() // Cancel it right away.
r, _, qerr := queue.WaitForRequestForQuerier(cctx, FirstTenant(), "querier-1")
if qerr == nil && r == nil {
t.Error("queue returned nil request with no error")
}
require.Error(t, qerr)
require.Nil(t, r)
}

func TestRequestQueue_tryDispatchRequestToQuerier_ShouldReEnqueueAfterFailedSendToQuerier(t *testing.T) {
Expand Down

0 comments on commit 7b7d375

Please sign in to comment.