MCPcopy Create free account
hub / github.com/cortexproject/cortex / verifyQuerierDoesntReceiveRequest

Function verifyQuerierDoesntReceiveRequest

pkg/scheduler/scheduler_test.go:653–671  ·  view source on GitHub ↗

If this verification succeeds, there will be leaked goroutine left behind. It will be cleaned once grpc server is shut down.

(t *testing.T, querierLoop schedulerpb.SchedulerForQuerier_QuerierLoopClient, timeout time.Duration)

Source from the content-addressed store, hash-verified

651
652// If this verification succeeds, there will be leaked goroutine left behind. It will be cleaned once grpc server is shut down.
653func verifyQuerierDoesntReceiveRequest(t *testing.T, querierLoop schedulerpb.SchedulerForQuerier_QuerierLoopClient, timeout time.Duration) {
654 ch := make(chan any, 1)
655
656 go func() {
657 m, e := querierLoop.Recv()
658 if e != nil {
659 ch <- e
660 } else {
661 ch <- m
662 }
663 }()
664
665 select {
666 case val := <-ch:
667 require.Failf(t, "expected timeout", "got %v", val)
668 case <-time.After(timeout):
669 return
670 }
671}
672
673func verifyNoPendingRequestsLeft(t *testing.T, scheduler *Scheduler) {
674 test.Poll(t, 1*time.Second, 0, func() any {

Calls 2

AfterMethod · 0.80
RecvMethod · 0.65

Tested by

no test coverage detected