Summary
CodeGenerationTaskTests.Endpoints_OpenApi fails when the test suite runs inside a container that talks to the Docker daemon via Docker-outside-of-Docker (DooD) — e.g. the .devcontainer added in the agent-workspace setup, or any CI runner that mounts the host Docker socket.
Repro
dotnet test tests/Dibix.Sdk.Tests/Dibix.Sdk.Tests.csproj --filter "FullyQualifiedName~Endpoints_OpenApi"
from inside the devcontainer.
Observed
Docker.DotNet.DockerApiException: Docker API responded with status code='BadRequest',
response='{"message":"invalid mount config for type \"bind\": bind source path does not exist:
/workspace/tests/Dibix.Sdk.Tests/bin/Debug/net10.0/Output/Endpoints_OpenApi"}'
Stack originates at TestContainerExtensions.StartAsync →
CodeGenerationTaskTests.AssertOpenApiFileCodeGeneration (tests/Dibix.Sdk.Tests/CodeGeneration/CodeGenerationTaskTests.Base.cs:344).
Root cause
AssertOpenApiFileCodeGeneration validates the generated OpenAPI document by starting a sibling node:25-alpine container and bind-mounting the test output directory into it (CodeGenerationTaskTests.Base.cs:331):
new ContainerBuilder("node:25-alpine")
.WithBindMount(directory, "/app") // directory = TestRunResultsDirectory/Output/<TestName>
...
Under DooD the Docker daemon is the host daemon, so a bind-mount source path is resolved on the host filesystem, not inside the devcontainer. The path /workspace/tests/.../Output/Endpoints_OpenApi only exists inside the devcontainer (it lives under the bind-mounted workspace at a container-only sub-path), so the daemon rejects the mount.
This is a structural DooD limitation, not a flaky test: bind-mounting a container-local path into a sibling container cannot work unless the path is also present at the same absolute location on the host.
Notes / workarounds
- There is already an escape hatch:
Configuration.HasNoTestContainerSupport (CodeGenerationTaskTests.Base.cs:322) short-circuits the validation. Setting it via the test appsettings.json / run settings makes the suite pass (105 passed, this one skipped) but skips OpenAPI validation entirely.
- Every other Testcontainers-backed suite passes in the same devcontainer (
Dibix.Dapper.Tests, Dibix.Http.Host.Tests), because they don't bind-mount container-local paths — they only start SQL Server and connect over TCP.
Possible fixes
- Replace the bind-mount with copying the file(s) into the container (
WithResourceMapping / tar copy) and reading results back via the API, so no host-path assumption is made.
- Or detect DooD (e.g.
TESTCONTAINERS_HOST_OVERRIDE set / socket is host) and auto-skip with a clear message instead of a hard failure.
Environment
.devcontainer (Ubuntu 24.04, .NET 10 SDK) with docker-outside-of-docker feature, host Docker socket mounted, TESTCONTAINERS_HOST_OVERRIDE=host.docker.internal.
Summary
CodeGenerationTaskTests.Endpoints_OpenApifails when the test suite runs inside a container that talks to the Docker daemon via Docker-outside-of-Docker (DooD) — e.g. the.devcontaineradded in the agent-workspace setup, or any CI runner that mounts the host Docker socket.Repro
from inside the devcontainer.
Observed
Stack originates at
TestContainerExtensions.StartAsync→CodeGenerationTaskTests.AssertOpenApiFileCodeGeneration(tests/Dibix.Sdk.Tests/CodeGeneration/CodeGenerationTaskTests.Base.cs:344).Root cause
AssertOpenApiFileCodeGenerationvalidates the generated OpenAPI document by starting a siblingnode:25-alpinecontainer and bind-mounting the test output directory into it (CodeGenerationTaskTests.Base.cs:331):Under DooD the Docker daemon is the host daemon, so a bind-mount
sourcepath is resolved on the host filesystem, not inside the devcontainer. The path/workspace/tests/.../Output/Endpoints_OpenApionly exists inside the devcontainer (it lives under the bind-mounted workspace at a container-only sub-path), so the daemon rejects the mount.This is a structural DooD limitation, not a flaky test: bind-mounting a container-local path into a sibling container cannot work unless the path is also present at the same absolute location on the host.
Notes / workarounds
Configuration.HasNoTestContainerSupport(CodeGenerationTaskTests.Base.cs:322) short-circuits the validation. Setting it via the testappsettings.json/ run settings makes the suite pass (105 passed, this one skipped) but skips OpenAPI validation entirely.Dibix.Dapper.Tests,Dibix.Http.Host.Tests), because they don't bind-mount container-local paths — they only start SQL Server and connect over TCP.Possible fixes
WithResourceMapping/ tar copy) and reading results back via the API, so no host-path assumption is made.TESTCONTAINERS_HOST_OVERRIDEset / socket is host) and auto-skip with a clear message instead of a hard failure.Environment
.devcontainer(Ubuntu 24.04, .NET 10 SDK) withdocker-outside-of-dockerfeature, host Docker socket mounted,TESTCONTAINERS_HOST_OVERRIDE=host.docker.internal.