Skip to content

fix(test): skip the Redis container tests when Docker is unreachable (#526) - #529

Merged
JabbaKadabra merged 1 commit into
masterfrom
claude/open-issue-nqgtdj
Aug 7, 2026
Merged

fix(test): skip the Redis container tests when Docker is unreachable (#526)#529
JabbaKadabra merged 1 commit into
masterfrom
claude/open-issue-nqgtdj

Conversation

@JabbaKadabra

Copy link
Copy Markdown
Collaborator

Summary

RedisIngestionStreamIntegrationTests is meant to report as skipped when no container runtime is reachable, but both tests failed on a Docker-less machine, making a plain dotnet test Proxytrace.sln red for reasons unrelated to the change under test. The container was built one line above the try, and Testcontainers validates a builder by resolving and pinging the Docker endpoint — so new RedisBuilder(RedisImage).Build() is where the throw actually happens and the catch (Exception ex) when (!DockerRequired) guard never saw it. This moves Build() inside the guarded block so endpoint-resolution failures take the same skip path as start failures.

Closes #526

Changes

  • Proxytrace.Messaging.Tests/RedisIngestionStreamIntegrationTests.cs — construct the RedisContainer inside the guarded try, hold it in a nullable local, and null-check before disposing on the skip path. No ! suppression needed: Assert.Inconclusive is [DoesNotReturn], so the non-null return flows cleanly.
  • docs/testing.md — the container-backed section now states that the guard must wrap Build(), not just StartAsync, and why.
  • .claude/skills/test/SKILL.md — same one-line rule in the container-backed-tests section, so the next such suite does not re-derive it.

Verification

  • build: dotnet build Proxytrace.Messaging.Tests -warnaserror — 0 warnings, 0 errors.
  • tests (no Docker socket present in this environment, which is the exact repro):
    • dotnet test Proxytrace.Messaging.TestsFailed: 0, Passed: 11, Skipped: 2 (was Failed: 2 before the change).
    • PROXYTRACE_REQUIRE_DOCKER_TESTS=1 dotnet test Proxytrace.Messaging.Tests --filter "FullyQualifiedName~RedisIngestionStreamIntegrationTests"Failed: 2, confirming the enforce path still turns a missing runtime into a hard failure, so CI cannot lose the coverage silently.
    • Scope: the affected test project only. The change touches one test file plus docs; the rest of the suite is unaffected and CI runs the full solution on push.
  • docs/changelog: docs/testing.md and the test skill updated. No CHANGELOG.md entry — the changelog is for user-facing changes and this is test-harness-only, with no product behaviour affected.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RVMGTQ2k3CwrkcannhZ9sA


Generated by Claude Code

`RedisIngestionStreamIntegrationTests.StartRedisAsync` built the Redis
container outside the `try`, so the guard that turns a missing container
runtime into `Assert.Inconclusive` only covered `StartAsync`. Testcontainers
validates a builder by resolving and pinging the Docker endpoint, which means
`new RedisBuilder(RedisImage).Build()` is where a Docker-less machine actually
throws — the catch never saw it, and a plain `dotnet test Proxytrace.sln`
reported two failures unrelated to the change under test.

Move `Build()` inside the guarded block and null-check the container before
disposing it on the skip path, so endpoint-resolution failures take the same
skip route as start failures. `PROXYTRACE_REQUIRE_DOCKER_TESTS=1` still turns
both into hard failures, so CI cannot lose the coverage silently.

Verified with no Docker socket: 2 skipped / 11 passed unset, 2 failed with the
variable set. Documented the builder rule in docs/testing.md and the test skill
so the next container-backed suite does not re-derive it.

Refs #526

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RVMGTQ2k3CwrkcannhZ9sA
@JabbaKadabra
JabbaKadabra merged commit 404e11b into master Aug 7, 2026
13 checks passed
@JabbaKadabra
JabbaKadabra deleted the claude/open-issue-nqgtdj branch August 7, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redis container-backed tests hard-fail instead of skipping when Docker is absent

2 participants