TestWaitPreStart_RaceNilErrorAndResult stress-tests the scheduler outcome when ContainerWait closes a successful stream cleanly: Result has the exit code and Error sends nil at the same instant. Either branch of the outer select must end on the Result-based success, with no spurious failure.
(t *testing.T)
| 342 | // code and Error sends nil at the same instant. Either branch of the outer |
| 343 | // select must end on the Result-based success, with no spurious failure. |
| 344 | func TestWaitPreStart_RaceNilErrorAndResult(t *testing.T) { |
| 345 | for i := 0; i < 100; i++ { |
| 346 | resultC := make(chan container.WaitResponse, 1) |
| 347 | errC := make(chan error, 1) |
| 348 | resultC <- container.WaitResponse{StatusCode: 0} |
| 349 | errC <- nil |
| 350 | waitRes := client.ContainerWaitResult{Result: resultC, Error: errC} |
| 351 | assert.NilError(t, waitPreStart(t.Context(), "web", 0, waitRes)) |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | // TestWaitPreStart_RaceRealErrorAndResult stress-tests the opposite scenario: |
| 356 | // a real transport error on Error races with a stale Result. The Error must |
nothing calls this directly
no test coverage detected