MCPcopy
hub / github.com/docker/compose / TestWaitPreStart_RaceRealErrorAndResult

Function TestWaitPreStart_RaceRealErrorAndResult

pkg/compose/pre_start_test.go:359–369  ·  view source on GitHub ↗

TestWaitPreStart_RaceRealErrorAndResult stress-tests the opposite scenario: a real transport error on Error races with a stale Result. The Error must always win — the function must never silently drop the failure and return success based on Result.

(t *testing.T)

Source from the content-addressed store, hash-verified

357// always win — the function must never silently drop the failure and return
358// success based on Result.
359func TestWaitPreStart_RaceRealErrorAndResult(t *testing.T) {
360 for i := 0; i < 100; i++ {
361 resultC := make(chan container.WaitResponse, 1)
362 errC := make(chan error, 1)
363 resultC <- container.WaitResponse{StatusCode: 0}
364 errC <- fmt.Errorf("daemon: connection lost")
365 waitRes := client.ContainerWaitResult{Result: resultC, Error: errC}
366 err := waitPreStart(t.Context(), "web", 0, waitRes)
367 assert.ErrorContains(t, err, "connection lost")
368 }
369}

Callers

nothing calls this directly

Calls 1

waitPreStartFunction · 0.85

Tested by

no test coverage detected