Skip to content

Fix flaky tests in resource-constrained CI environments#130

Closed
Copilot wants to merge 2 commits intobugfix/flakey-testsfrom
copilot/sub-pr-129
Closed

Fix flaky tests in resource-constrained CI environments#130
Copilot wants to merge 2 commits intobugfix/flakey-testsfrom
copilot/sub-pr-129

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 4, 2026

Tests pass locally but fail intermittently in CI due to resource contention during Redis pub/sub operations and rapid test execution.

Changes

  • Unsubscribe processing time: Added 10ms delay after FireAndForget unsubscribe operations in RedisMessageBus and RedisQueue to allow completion before disposal
  • Test isolation: Added 50ms delays in test fixture initialization (post-FlushAll) and teardown to prevent state interference between tests
  • Topic uniqueness: Use GUID-based topic names per test class to eliminate cross-test pollution
  • Error handling: Wrapped unsubscribe calls in try-catch to prevent disposal failures

Context

Resource-bound CI runners execute pub/sub operations slower than local environments. Without processing time, unsubscribe operations initiated with FireAndForget don't complete before the next test starts, causing:

  • Subscribers receiving messages from previous tests
  • Lock contention on shared Redis channels
  • Race conditions during cleanup

Strategic delays (70ms overhead per test) allow async operations to settle without impacting local development velocity.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI mentioned this pull request Jan 4, 2026
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

- Add small delay after unsubscribe operations to allow processing
- Add delays in test initialization and cleanup to prevent interference
- Helps tests pass reliably in resource-bound CI environments

Co-authored-by: niemyjski <1020579+niemyjski@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Jan 4, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 127.0.0.11
    • Triggering command: REDACTED, pid is -1 (packet block)
  • f.feedz.io
    • Triggering command: /usr/share/dotnet/dotnet dotnet build Foundatio.Redis.slnx (dns block)
    • Triggering command: /usr/share/dotnet/dotnet dotnet restore Foundatio.Redis.slnx --disable-parallel (dns block)
    • Triggering command: /usr/share/dotnet/dotnet dotnet build Foundatio.Redis.slnx --configuration Release -t nat bash DOCKER_OUTPUT (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix flakey tests in CI environment Fix flaky tests in resource-constrained CI environments Jan 4, 2026
Copilot AI requested a review from niemyjski January 4, 2026 17:05
@niemyjski niemyjski closed this Jan 5, 2026
@niemyjski niemyjski deleted the copilot/sub-pr-129 branch January 5, 2026 14:22
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.

3 participants