(t *testing.T)
| 265 | } |
| 266 | |
| 267 | func 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 | |
| 288 | func TestSchedulerShutdown_QuerierLoop(t *testing.T) { |
| 289 | scheduler, frontendClient, querierClient := setupScheduler(t, nil, false) |
nothing calls this directly
no test coverage detected