Skip to content

Fix flaky error-result timeout test - #9980

Merged
glen-84 merged 1 commit into
mainfrom
gai/fix-flaky-error-timeout-test
Jun 24, 2026
Merged

Fix flaky error-result timeout test#9980
glen-84 merged 1 commit into
mainfrom
gai/fix-flaky-error-timeout-test

Conversation

@glen-84

@glen-84 glen-84 commented Jun 24, 2026

Copy link
Copy Markdown
Member

Summary

  • RequestExecutorTests.Ensure_Errors_Do_Not_Result_In_Timeouts bounded its execution with new CancellationTokenSource(1000), a wall-clock deadline. On a slow or contended CI runner the 1s timer could fire mid-execution and fold a cancellation error into the result, flipping the snapshot from "Unexpected Execution Error" to "The GraphQL request execution was canceled." and failing the test even though nothing hung.
  • Replaced the racy in-test deadline with a framework-level [Fact(Timeout = 30_000)] guard and passed TestContext.Current.CancellationToken, so the test still fails fast on a genuine hang without racing normal-load execution time.

Test plan

  • dotnet test on HotChocolate.Execution.Tests, filtered to Ensure_Errors_Do_Not_Result_In_Timeouts — passes.

Copilot AI review requested due to automatic review settings June 24, 2026 10:31

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

Updates a flaky execution test in HotChocolate.Execution.Tests to avoid racey, wall-clock cancellation that can surface as a spurious “request execution was canceled” error on slow/contended CI.

Changes:

  • Replaces the in-test CancellationTokenSource(1000) deadline with an xUnit [Fact(Timeout = 30_000)] timeout guard.
  • Passes TestContext.Current.CancellationToken into ExecuteRequestAsync so cancellation is owned by the test framework rather than an arbitrary 1s timer.

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

@github-code-quality

Copy link
Copy Markdown

Code Coverage Overview

Languages: C#

C# / code-coverage/dotnet

The overall coverage in the gai/fix-flaky-error-... branch remains at 49%, unchanged from the main branch.

Show a code coverage summary of the most impacted files.
File main ab96092 gai/fix-flaky-error-... d19e2bf +/-
/home/runner/wo...erMiddleware.cs 97% 89% -8%
/home/runner/wo...onMiddleware.cs 94% 88% -6%
/home/runner/wo...DefaultTopic.cs 89% 90% +1%
/home/runner/wo...geDispatcher.cs 75% 77% +2%
/home/runner/wo...PromiseCache.cs 78% 81% +3%
/home/runner/wo...entsListener.cs 62% 66% +4%
/home/runner/wo...gerMessage.g.cs 15% 19% +4%
/home/runner/wo...ewareFactory.cs 95% 100% +5%
/home/runner/wo...sageRecorder.cs 88% 100% +12%
/home/runner/wo...tDiagnostics.cs 73% 88% +15%

Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@glen-84
glen-84 merged commit d80cb67 into main Jun 24, 2026
145 checks passed
@glen-84
glen-84 deleted the gai/fix-flaky-error-timeout-test branch June 24, 2026 10:38
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