Repository navigation
Replace fragile telemetry count assertions with property enumeration - #7317
Merged
Merged
Conversation
nkolev92
enabled auto-merge (squash)
April 24, 2026 00:56
Two RestoreCommandTests used exact Count.Should().Be(N) assertions on telemetry events, which broke whenever concurrent PRs each added new telemetry properties. Replace these with the same dictionary + bidirectional set comparison pattern used by ExecuteAsync_WithSinglePackage_PopulatesCorrectTelemetry, which enumerates all expected properties and validates no extras/missing exist. This makes the tests merge-friendly: adding a new property only requires updating the test that fully enumerates properties, not guessing a magic count number. Co-authored-by: Copilot <[email protected]>
nkolev92
force-pushed
the
dev-nkolev92-fix-telemetry-count-test
branch
from
April 24, 2026 01:48
59c4001 to
3c666fe
Compare
1 of 3 tasks
Nigusu-Allehu
approved these changes
Apr 24, 2026
Copilot AI
pushed a commit
that referenced
this pull request
Apr 24, 2026
) PR #7213 added AnyPackageIdContainsNonAlphanumericDotDashOrUnderscoreCharacters telemetry and updated the count from 49 to 50, but PR #7307 had already added TargetFrameworks and TargetFrameworksCount, making the correct count 51. Co-authored-by: Copilot <[email protected]> Co-authored-by: nkolev92 <[email protected]>
This was referenced May 14, 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.
Bug
Fixes: Engineering
Description
Two
RestoreCommandTestsused exactCount.Should().Be(N)assertions on telemetry events:ExecuteAsync_WithSinglePackage_WhenNoOping_PopulatesCorrectTelemetry(count 42)ExecuteAsync_WithPartiallyPopulatedGlobalPackagesFolder_PopulatesNewlyInstalledPackagesTelemetry(count 50, should have been 51)These break whenever concurrent PRs each add new telemetry properties (PR #7213 + PR #7307 race caused the current CI failure on dev).
Replaced both with the same dictionary + bidirectional set comparison pattern used by
ExecuteAsync_WithSinglePackage_PopulatesCorrectTelemetry, which enumerates all expected properties and validates no extras or missing properties exist. This makes the tests merge-friendly — adding a new telemetry property only requires updating the expected property dictionary, not guessing a magic count number.PR Checklist