Fix race condition in TestDockerServiceHealthcheckOverflow

What does this MR do?

The test was failing consistently in CI when run with the -race flag because the service container was exiting too quickly, before the healthcheck could read its logs.

The original test used a bare printf command that would complete immediately and cause the container to exit. With the race detector enabled, the additional overhead meant the logs weren't being captured before the container terminated, resulting in empty "Service container logs" output.

The fix wraps the printf command in a shell (sh -c) and adds a sleep 10 to keep the container alive long enough for the healthcheck to read the logs. This ensures the test passes consistently regardless of race detector overhead or timing variations.

Why was this MR needed?

This is blocking a release.

What's the best way to test this MR?

go test -race -run TestDockerServiceHealthcheckOverflow -tags=integration -v executors/docker/docker_command_integration_test.go

What are the relevant issue numbers?

Relates to https://gitlab.com/gitlab-com/runner-group/team-tasks/-/work_items/431

Edited by Stan Hu

Merge request reports

Loading