Skip to content

Fix CI: JUnit NU1102 + telemetry tests post-{asm}_{tfm}_{arch} default#9010

Open
Evangelink wants to merge 2 commits into
mainfrom
dev/amauryleve/fix-junit-tests
Open

Fix CI: JUnit NU1102 + telemetry tests post-{asm}_{tfm}_{arch} default#9010
Evangelink wants to merge 2 commits into
mainfrom
dev/amauryleve/fix-junit-tests

Conversation

@Evangelink

@Evangelink Evangelink commented Jun 10, 2026

Copy link
Copy Markdown
Member

Fixes failures on internal pipeline build 2996915:

1. JUnit retry acceptance fixtures (original scope)

Restore tests were failing with NU1102 because the generated csproj fixtures pulled in a Microsoft.Testing.Platform version that no longer resolves. Pin the package version to the one shipped from the current build.

2. Telemetry acceptance tests (new)

PR #8971 changed the default diagnostic file prefix from log to {asm}_{tfm}_{arch} but missed updating the telemetry acceptance tests, which still expected files matching log_*.diag.

Mirror the BuildDefaultDiagnosticFilePathPattern helper introduced in DiagnosticTests.cs and use it in both:

  • test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryTests.cs
  • test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryDisabledTests.cs
  • test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TelemetryTests.cs

Tests verified locally on Windows / net11.0:

  • 12 MTP telemetry acceptance tests pass
  • 15 MSTest telemetry acceptance tests pass

…sting.Platform

The MSTestJUnitReportRetry and MSTestJUnitReportMTPRetry generated test-asset csprojs reference the MSTest metapackage which transitively pulls Microsoft.Testing.Extensions.CodeCoverage (>= 18.9.0-preview.X.Y from the public NuGet feed). CodeCoverage in turn requires Microsoft.Testing.Platform with the exact preview build label minted by Versions.props, which is not available on public NuGet feeds. NuGet then fails restore with NU1102 because no feed satisfies that range.

Mirror the pattern used by TrxReportTests and AbortionTests: add an explicit top-level PackageReference to Microsoft.Testing.Platform with the locally packed version so NuGet uses the local Shipping artifact instead of trying to resolve the transitive request.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 10, 2026 14:32

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

This PR fixes NU1102 restore failures in newly added MSTest acceptance tests for the JUnitReport extension by ensuring the generated test-asset projects explicitly reference Microsoft.Testing.Platform at the locally-packed version, preventing NuGet from trying (and failing) to satisfy transitive preview constraints from public feeds.

Changes:

  • Add a top-level PackageReference to Microsoft.Testing.Platform in the generated csproj for the [Retry]-attribute JUnit scenario.
  • Add a top-level PackageReference to Microsoft.Testing.Platform in the generated csproj for the MTP --retry-failed-tests orchestrator scenario.
Show a summary per file
File Description
test/IntegrationTests/MSTest.Acceptance.IntegrationTests/JUnitReportTests.cs Pins Microsoft.Testing.Platform in both generated test-asset projects to avoid NU1102 restore failures caused by transitive preview version constraints.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@Evangelink Evangelink left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Automated review by GitHub Copilot. Posted via a maintainer's GitHub token, so it appears under their account — the account owner did not write or approve this content personally. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.

✅ 22/22 dimensions clean — no findings.

Review summary:

The fix correctly addresses the root cause. By adding an explicit top-level <PackageReference Include="Microsoft.Testing.Platform" Version="$MicrosoftTestingPlatformVersion$" /> to each generated test-asset csproj, NuGet satisfies the transitive Microsoft.Testing.Platform >= 2.3.0-preview.X constraint using the locally-packed Shipping artifact rather than trying (and failing) to resolve a preview build from public feeds.

Key validations:

  • Pattern consistency: mirrors TrxReportTests.cs (lines 72, 182), AbortionTests.cs (line 54), MaxFailedTestsExtensionTests.cs, and several others.
  • Placeholder substitution: $MicrosoftTestingPlatformVersion$ is already patched via .PatchCodeWithReplace("$MicrosoftTestingPlatformVersion$", MicrosoftTestingPlatformVersion) in both GetAssetsToGenerate() implementations (lines 87 and 218 respectively), sourced from the local shipping artifacts via ExtractVersionFromPackage.
  • Placement: both new references appear before the MSTest metapackage reference, which is the correct top-level override position for NuGet.
  • Scope: exactly two lines added, no unrelated changes.

🤖 Automated content by GitHub Copilot. Posted via a maintainer's GitHub token, so it appears under their account — the account owner did not write or approve this content personally. Generated by the Expert Code Review (on PR ready) workflow.{ai_credits_suffix} ·

@Evangelink

Copy link
Copy Markdown
Member Author

🧪 Test quality grade — PR #9010

No new or modified test methods were identified in the changed regions
of this PR. Nothing to grade.

The two changed lines (in JUnitReportRetryAttributeTests.TestAssetFixture and JUnitReportMTPRetryExtensionTests.TestAssetFixture) fall inside private const string SourceCode raw-string-literal declarations — not inside any test method body. The actual test methods in those classes were not modified.

Re-run with /grade-tests.

🤖 Automated content by GitHub Copilot. Posted via a maintainer's GitHub token, so it appears under their account — the account owner did not write or approve this content personally. Generated by the Grade Tests on PR (on open / sync) workflow.{ai_credits_suffix} · [◷]( · )

… diag prefix

PR #8971 changed the default diagnostic file prefix from 'log' to
'{asm}_{tfm}_{arch}' but missed updating the telemetry acceptance
tests, which still expected files matching 'log_*.diag'. Mirror the
BuildDefaultDiagnosticFilePathPattern helper introduced in
DiagnosticTests.cs and use it in both the MTP and MSTest telemetry
acceptance test files.

Fixes pipeline build 2996915 telemetry acceptance test failures:
- Telemetry_ByDefault_TelemetryIsEnabled
- Telemetry_WhenOptingOutTelemetry_WithEnvironmentVariable_TelemetryIsDisabled
- Telemetry_WhenOptingOutTelemetry_With_DOTNET_CLI_EnvironmentVariable_TelemetryIsDisabled
- Telemetry_WhenEnableTelemetryIsFalse_WithTestApplicationOptions_TelemetryIsDisabled
- MTP_RunTests_SendsTelemetryWithSettingsAndAttributes
- MTP_DiscoverTests_SendsTelemetryEvent
- MTP_WhenTelemetryDisabled_DoesNotSendMSTestEvent

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Evangelink Evangelink changed the title Fix NU1102 in JUnit retry acceptance fixtures by pinning Microsoft.Testing.Platform Fix CI: JUnit NU1102 + telemetry tests post-{asm}_{tfm}_{arch} default Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants