Skip to content

Skip Fusion Redis tests from the test body when Redis is unreachable - #10343

Merged
glen-84 merged 1 commit into
mainfrom
gai/redis-fixture-skip-from-tests
Sep 3, 2026
Merged

glen-84 merged 1 commit into
mainfrom
gai/redis-fixture-skip-from-tests

Conversation

@glen-84

@glen-84 glen-84 commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

  • RedisFixture no longer calls Assert.Skip from InitializeAsync. xUnit v3 treats a skip thrown during fixture initialization as a failure, so with REDIS_CONNECTION_STRING pointing at an unreachable instance every test in Fusion.Subscriptions.Redis.Tests failed instead of skipping.
  • The fixture records a SkipReason and exposes SkipWhenUnavailable(), which each test calls as its first arrange step so the skip happens from the test body.

Test plan

  • Default path (Testcontainers): 7/7 pass.
  • REDIS_CONNECTION_STRING=localhost:1: 7 skipped, 0 failed. The run exits with Microsoft.Testing.Platform code 8 because no test executed, which is the platform's zero-tests behavior and unchanged by this PR.

Copilot AI lite review requested due to automatic review settings September 3, 2026 12:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is isolated to test infrastructure and consistently updates all affected tests to skip safely under xUnit v3 when Redis is unreachable.

Pull request overview

This PR adjusts the Redis integration test fixture for Fusion.Subscriptions.Redis.Tests so tests are skipped from within each test body (instead of during fixture initialization), avoiding xUnit v3 treating fixture-init skips as failures when REDIS_CONNECTION_STRING points to an unreachable Redis instance.

Changes:

  • Record Redis unavailability in RedisFixture during InitializeAsync instead of calling Assert.Skip there.
  • Add RedisFixture.SkipWhenUnavailable() so each test can skip itself early from the test body.
  • Update Redis subscription/broker tests to call SkipWhenUnavailable() as the first arrange step.
File summaries
File Description
src/HotChocolate/Fusion/test/Fusion.Subscriptions.Redis.Tests/RedisSubscriptionTests.cs Skips the test from the test body when Redis is unreachable.
src/HotChocolate/Fusion/test/Fusion.Subscriptions.Redis.Tests/RedisFixture.cs Moves skip decision to a stored reason and exposes SkipWhenUnavailable() for tests to invoke.
src/HotChocolate/Fusion/test/Fusion.Subscriptions.Redis.Tests/RedisEventStreamBrokerTests.cs Applies the new per-test skip call consistently across broker tests.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants