# Backend tests

The normal test command remains Docker-free:

```powershell
dotnet test Nexus.Api.Tests.csproj --configuration Release
```

Docker-backed tests are discovered but skipped unless explicitly enabled.
They use `postgres:17-alpine`; the optional network-fault contract additionally
uses Testcontainers Toxiproxy and a pinned lightweight OpenClaw HTTP stub.

```powershell
$env:NEXUS_RUN_DOCKER_INTEGRATION_TESTS = "true"
dotnet test Nexus.Api.Tests.csproj --configuration Release `
  --filter "Category=DockerIntegration"
```

Enable the slower Toxiproxy case as well:

```powershell
$env:NEXUS_RUN_DOCKER_INTEGRATION_TESTS = "true"
$env:NEXUS_RUN_TOXIPROXY_INTEGRATION_TESTS = "true"
dotnet test Nexus.Api.Tests.csproj --configuration Release `
  --filter "Category=DockerIntegration"
```

Once opted in, an unavailable Docker daemon is a test failure rather than a
silent skip. In Gitea Actions, set the repository variable
`NEXUS_RUN_DOCKER_INTEGRATION_TESTS=true`; optionally set
`NEXUS_RUN_TOXIPROXY_INTEGRATION_TESTS=true` for the timeout contract. The
selected runner must expose a working Docker endpoint to Testcontainers.
