From bca685e7d21277486b0769f9738aeb9bb592f256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Wed, 10 Jun 2026 16:32:05 +0200 Subject: [PATCH 1/2] Fix NU1102 in JUnit retry acceptance fixtures by pinning Microsoft.Testing.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> --- .../MSTest.Acceptance.IntegrationTests/JUnitReportTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/JUnitReportTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/JUnitReportTests.cs index efda20786e..32251577aa 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/JUnitReportTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/JUnitReportTests.cs @@ -100,6 +100,7 @@ public override (string ID, string Name, string Code) GetAssetsToGenerate() => ( + @@ -233,6 +234,7 @@ public override (string ID, string Name, string Code) GetAssetsToGenerate() => ( + From 7ed2a8efe1b93c598f4cac7048e018b2aec08080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Wed, 10 Jun 2026 17:37:08 +0200 Subject: [PATCH 2/2] Update telemetry acceptance tests to match {asm}_{tfm}_{arch} default 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> --- .../TelemetryTests.cs | 17 ++++++++++++++--- .../TelemetryDisabledTests.cs | 13 ++++++++++++- .../TelemetryTests.cs | 17 ++++++++++++++--- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TelemetryTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TelemetryTests.cs index bf099284bc..940fb2c83c 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TelemetryTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TelemetryTests.cs @@ -26,7 +26,7 @@ public sealed class TelemetryTests : AcceptanceTestBase AssertDiagnosticReportAsync(TestHostResult tes return (Regex.IsMatch(content, pattern), content); } + // Build a regex matching the deterministic default diagnostic file name shape: + // "___.diag". The arch token is taken from the + // current process (the testhost runs on the same machine, so its ProcessArchitecture matches). + private static string BuildDefaultDiagnosticFilePathPattern(string diagPath, string tfm) + { + string arch = RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(); + const string FileNamePlaceholder = "__DIAG_FILENAME__"; + string combinedPath = Path.Combine(diagPath, FileNamePlaceholder).Replace(@"\", @"\\"); + return combinedPath.Replace(FileNamePlaceholder, $@"{MTPAssetName}_{Regex.Escape(tfm)}_{arch}_\d{{15}}\.diag"); + } + #endregion public sealed class TestAssetFixture() : TestAssetFixtureBase() diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryDisabledTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryDisabledTests.cs index a025b50d32..4197891766 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryDisabledTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryDisabledTests.cs @@ -15,7 +15,7 @@ public sealed class TelemetryDisabledTests : AcceptanceTestBase AssertDiagnosticReportAsync(TestHostResult tes return (Regex.IsMatch(content, pattern), content); } + // Build a regex matching the deterministic default diagnostic file name shape: + // "___.diag". The arch token is taken from the + // current process (the testhost runs on the same machine, so its ProcessArchitecture matches). + private static string BuildDefaultDiagnosticFilePathPattern(string diagPath, string tfm) + { + string arch = RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(); + const string FileNamePlaceholder = "__DIAG_FILENAME__"; + string combinedPath = Path.Combine(diagPath, FileNamePlaceholder).Replace(@"\", @"\\"); + return combinedPath.Replace(FileNamePlaceholder, $@"{AssetName}_{Regex.Escape(tfm)}_{arch}_\d{{15}}\.diag"); + } + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string WithoutTelemetry = nameof(WithoutTelemetry); diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryTests.cs index 0272637c43..f8ae989fec 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryTests.cs @@ -15,7 +15,7 @@ public class TelemetryTests : AcceptanceTestBase AssertDiagnosticReportAsync(TestHostResult tes return (Regex.IsMatch(content, pattern), content); } + // Build a regex matching the deterministic default diagnostic file name shape: + // "___.diag". The arch token is taken from the + // current process (the testhost runs on the same machine, so its ProcessArchitecture matches). + private static string BuildDefaultDiagnosticFilePathPattern(string diagPath, string tfm) + { + string arch = RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(); + const string FileNamePlaceholder = "__DIAG_FILENAME__"; + string combinedPath = Path.Combine(diagPath, FileNamePlaceholder).Replace(@"\", @"\\"); + return combinedPath.Replace(FileNamePlaceholder, $@"{AssetName}_{Regex.Escape(tfm)}_{arch}_\d{{15}}\.diag"); + } + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string WithTelemetry = nameof(WithTelemetry);