MCPcopy
hub / github.com/grpc/grpc-go / verifyRLSRequest

Function verifyRLSRequest

balancer/rls/helpers_test.go:283–299  ·  view source on GitHub ↗

verifyRLSRequest is a test helper which listens on a channel to see if an RLS request was received by the fake RLS server. Based on whether the test expects a request to be sent out or not, it uses a different timeout.

(t *testing.T, ch chan struct{}, wantRequest bool)

Source from the content-addressed store, hash-verified

281// request was received by the fake RLS server. Based on whether the test
282// expects a request to be sent out or not, it uses a different timeout.
283func verifyRLSRequest(t *testing.T, ch chan struct{}, wantRequest bool) {
284 t.Helper()
285
286 if wantRequest {
287 select {
288 case <-time.After(defaultTestTimeout):
289 t.Fatalf("Timeout when waiting for an RLS request to be sent out")
290 case <-ch:
291 }
292 } else {
293 select {
294 case <-time.After(defaultTestShortTimeout):
295 case <-ch:
296 t.Fatalf("RLS request sent out when not expecting one")
297 }
298 }
299}

Calls 1

FatalfMethod · 0.65

Tested by

no test coverage detected