Repository navigation
Bound acceptance tests by the test's CancelAfter budget via an explicit CancellationToken - #5871
Closed
ramonsmits wants to merge 1 commit into
Closed
ramonsmits wants to merge 1 commit into
ramonsmits wants to merge 1 commit into
Conversation
…icit CancellationToken NServiceBus.AcceptanceTesting caps Done at a fixed 90 seconds unless Run is handed a cancellable token. The multi-step journey tests regularly exceed that on Windows runners and fail with a timeout while still making progress. NServiceBusAcceptanceTest now carries [CancelAfter(180_000)], which NUnit applies to every derived fixture through the execution context. Every test that runs a scenario takes a trailing CancellationToken, which NUnit fills from that budget, and passes it to Run. NUnit1027 is suppressed in the acceptance projects because the analyzer only looks for [CancelAfter] on the method and its direct containing class, not on base classes.
rbev
approved these changes
Sep 10, 2026
danielmarbach
approved these changes
Sep 10, 2026
Member
Author
|
Decided to move this to core: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Alternative to #5870 without the scenario wrapper. Same motivation: NServiceBus.AcceptanceTesting caps
Doneat 90 seconds unlessRunreceives a cancellable token, and the journey tests from #5810 regularly exceed that on Windows runners.NServiceBusAcceptanceTestcarries[CancelAfter(180_000)], which NUnit applies to every derived fixture. Every test that runs a scenario now takes a trailingCancellationToken cancellationToken = default, which NUnit fills from that budget (also for[TestCase]methods), and passes it toRun. The rewrite is mechanical: 282 methods across 195 files, plus forwarding the token to the fewReadAsStringAsyncandAssertAuthConfigurationResponsecalls CA2016 then flags. A test that already declares[CancelAfter]keeps its own value.NUnit1027 is suppressed in the acceptance projects: the analyzer only looks for
[CancelAfter]on the method and its direct containing class, so it reports the token parameter as unsupplied even though NUnit honours the inherited attribute. Reported upstream as nunit/nunit.analyzers#1019, fix in nunit/nunit.analyzers#1020.Verified locally: a
[CancelAfter(5_000)]test with a never-completingDoneis cancelled after 5 s, and Primary, Audit and Monitoring fixtures pass unchanged.Pairs with #5872: without it a timed-out test reports the
TaskCanceledExceptionfrom the aborted host shutdown instead of the timeout.