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

Function TestSchedulerShutdown_FrontendLoop

pkg/scheduler/scheduler_test.go:267–286  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

265}
266
267func TestSchedulerShutdown_FrontendLoop(t *testing.T) {
268 scheduler, frontendClient, _ := setupScheduler(t, nil, false)
269
270 frontendLoop := initFrontendLoop(t, frontendClient, "frontend-12345")
271
272 // Stop the scheduler. This will disable receiving new requests from frontends.
273 require.NoError(t, services.StopAndAwaitTerminated(context.Background(), scheduler))
274
275 // We can still send request to scheduler, but we get shutdown error back.
276 require.NoError(t, frontendLoop.Send(&schedulerpb.FrontendToScheduler{
277 Type: schedulerpb.ENQUEUE,
278 QueryID: 1,
279 UserID: "test",
280 HttpRequest: &httpgrpc.HTTPRequest{Method: "GET", Url: "/hello"},
281 }))
282
283 msg, err := frontendLoop.Recv()
284 require.NoError(t, err)
285 require.True(t, msg.Status == schedulerpb.SHUTTING_DOWN)
286}
287
288func TestSchedulerShutdown_QuerierLoop(t *testing.T) {
289 scheduler, frontendClient, querierClient := setupScheduler(t, nil, false)

Callers

nothing calls this directly

Calls 5

StopAndAwaitTerminatedFunction · 0.92
setupSchedulerFunction · 0.85
initFrontendLoopFunction · 0.85
SendMethod · 0.65
RecvMethod · 0.65

Tested by

no test coverage detected