Skip to content

Deflake prepared operation cache eviction test - #10159

Merged
glen-84 merged 1 commit into
mainfrom
gai/deflake-executor-eviction-test
Jul 28, 2026
Merged

glen-84 merged 1 commit into
mainfrom
gai/deflake-executor-eviction-test

Conversation

@glen-84

@glen-84 glen-84 commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

  • Operation_Cache_Should_Be_Scoped_To_Executor waited for the Evicted event by blocking the test thread on ManualResetEventSlim.Wait under a 5-second CancellationTokenSource. Eviction is asynchronous (a channel write that triggers a full schema rebuild and warmup), so on a loaded CI runner the wait exceeded its budget and the test failed with OperationCanceledException.
  • The test now awaits a TaskCompletionSource (RunContinuationsAsynchronously), keeps no thread blocked while the rebuild runs, and takes its token from TestContext.Current.CancellationToken, matching the sibling test. A 30-second WaitAsync cap remains so a genuinely lost event surfaces as a timeout instead of a hang.

Test plan

  • dotnet test src/HotChocolate/Core/test/Execution.Tests --filter-class '*PreparedOperationCacheTests*': 8/8 pass across net8.0, net9.0, net10.0, and net11.0.

Copilot AI review requested due to automatic review settings July 28, 2026 13:26

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.

Pull request overview

Deflakes PreparedOperationCacheTests by replacing a blocking wait for async executor eviction with an awaited, cancellation-aware completion signal, improving reliability on slower CI runners.

Changes:

  • Replaced ManualResetEventSlim + short CancellationTokenSource with a TaskCompletionSource using RunContinuationsAsynchronously.
  • Switched cancellation to TestContext.Current.CancellationToken and added an explicit 30s WaitAsync timeout cap.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@glen-84
glen-84 merged commit c5c1c53 into main Jul 28, 2026
286 of 288 checks passed
@glen-84
glen-84 deleted the gai/deflake-executor-eviction-test branch July 28, 2026 13:42
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