Repository navigation
Run CommandTestBase teardown via IAsyncLifetime on xUnit v2 - #9872
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Nitro CLI command test base class teardown to run under xUnit v2 by switching from IAsyncDisposable (not invoked by xUnit v2 on test classes) to IAsyncLifetime, ensuring Moq strict-mock verification (VerifyAll) actually executes after each test.
Changes:
- Replace
IAsyncDisposablewithIAsyncLifetimeonCommandTestBaseso xUnit v2 invokes async teardown. - Add
InitializeAsync()(no-op) and updateDisposeAsync()to theTask-returning xUnit shape.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
VerifyAll() in CommandTestBase teardown now runs via IAsyncLifetime, surfacing Fusion publish/validate tests that configured mock setups their scenario never invokes (legacy archive download when a local --legacy-v1-archive is supplied, and release-slot mutation on paths that never throw). Removed the unused setups so VerifyAll passes.
This was referenced Jun 16, 2026
This was referenced Jun 24, 2026
This was referenced Aug 31, 2026
This was referenced Sep 8, 2026
This was referenced Sep 17, 2026
This was referenced Sep 28, 2026
This was referenced Oct 5, 2026
This was referenced Oct 19, 2026
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.
Summary
CommandTestBase(the base for all Nitro CLI command tests) implementedIAsyncDisposable, which xUnit v2 does not invoke on test classes — so theMoqVerifyAll()in itsDisposeAsyncteardown never ran, silently skipping mock verification for the whole suite.IAsyncLifetimeso xUnit v2 runs the teardown.This surfaces pre-existing failures in
FusionPublishCommandTests(16) andFusionValidateCommandTests(5): their Strict-mock setups (DownloadLatestFusionArchiveAsync/ReleaseDeploymentSlotAsync) are never matched by the command, whichVerifyAllwas supposed to catch but never did. Those expectations need correcting (the command doesn't make those calls in those scenarios, or the setups are over-specified).Test plan
ChilliCream.Nitro.CommandLine.Tests; the teardown now executes under xUnit v2.Fusioncommand tests now runVerifyAll, surfacing the 21 mock-expectation mismatches that were previously skipped.