From 77e8d0e3a0b91e7921d27b0f3041549fb6fc3430 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 15 May 2025 14:31:24 -0400 Subject: [PATCH 1/5] TestsReportGenerator: Always show the error message, and truncate only the stdout --- .../TestSummaryGenerator.cs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/tools/GenerateTestSummary/TestSummaryGenerator.cs b/tools/GenerateTestSummary/TestSummaryGenerator.cs index 0e90db5f2a8..9724444e0c3 100644 --- a/tools/GenerateTestSummary/TestSummaryGenerator.cs +++ b/tools/GenerateTestSummary/TestSummaryGenerator.cs @@ -144,21 +144,17 @@ public static void CreateSingleTestSummaryReport(string trxFilePath, StringBuild """); - var errorMsgBuilder = new StringBuilder(); - errorMsgBuilder.AppendLine(test.Output?.ErrorInfo?.InnerText ?? string.Empty); + reportBuilder.AppendLine(); + reportBuilder.AppendLine("```yml"); + + reportBuilder.AppendLine(test.Output?.ErrorInfo?.InnerText ?? string.Empty); if (test.Output?.StdOut is not null) { - errorMsgBuilder.AppendLine(); - errorMsgBuilder.AppendLine("### StdOut"); - errorMsgBuilder.AppendLine(test.Output.StdOut); + reportBuilder.AppendLine(); + reportBuilder.AppendLine("### StdOut"); + reportBuilder.AppendLine(TruncateTheStart(test.Output.StdOut, 50_000)); } - // Truncate long error messages for readability - var errorMsgTruncated = TruncateTheStart(errorMsgBuilder.ToString(), 50_000); - - reportBuilder.AppendLine(); - reportBuilder.AppendLine("```yml"); - reportBuilder.AppendLine(errorMsgTruncated); reportBuilder.AppendLine("```"); reportBuilder.AppendLine(); reportBuilder.AppendLine(""); From 12453217d002047e15be80c92ddb0943f1b45067 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 15 May 2025 14:44:45 -0400 Subject: [PATCH 2/5] Update tools/GenerateTestSummary/TestSummaryGenerator.cs Co-authored-by: Dan Moseley --- tools/GenerateTestSummary/TestSummaryGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/GenerateTestSummary/TestSummaryGenerator.cs b/tools/GenerateTestSummary/TestSummaryGenerator.cs index 9724444e0c3..1b624b03fb9 100644 --- a/tools/GenerateTestSummary/TestSummaryGenerator.cs +++ b/tools/GenerateTestSummary/TestSummaryGenerator.cs @@ -147,7 +147,7 @@ public static void CreateSingleTestSummaryReport(string trxFilePath, StringBuild reportBuilder.AppendLine(); reportBuilder.AppendLine("```yml"); - reportBuilder.AppendLine(test.Output?.ErrorInfo?.InnerText ?? string.Empty); + reportBuilder.AppendLine(test.Output?.ErrorInfo?.InnerText); if (test.Output?.StdOut is not null) { reportBuilder.AppendLine(); From 9300379d2d3d8cd0123924896cbf88a7526113cc Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 15 May 2025 15:15:25 -0400 Subject: [PATCH 3/5] Address review feedback from @ danmoseley . feedback: `what about taking the first 25_000, the last 25_000, and removing any overlap. So all you lose is in the middle` ``` | [2025-05-15T16:36:23] Aspire.Hosting.Tests.Resources.backend Information: 29: 2025-05-15T16:36:23.8940000Z 14da29b7e816: Download complete | [2025-05-15T16:36:23] Aspire.Hosting.Tests.Resources.backend Information: 30: 2025-05-15T16 ... (snip) ... ... sources.yarp Information: 50: 2025-05-15T16:36:28.1672245Z dbug: Microsoft.Extensions.ServiceDiscovery.ServiceEndpointWatcher[1] | [2025-05-15T16:36:28] Aspire.Hosting.Tests.Resources.yarp Information: 51: 2025-05-15T16:36:28.1672374Z Resolving endpoints for service 'http://backend'. ``` --- .../TestSummaryGenerator.cs | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tools/GenerateTestSummary/TestSummaryGenerator.cs b/tools/GenerateTestSummary/TestSummaryGenerator.cs index 1b624b03fb9..dfdb9219d9f 100644 --- a/tools/GenerateTestSummary/TestSummaryGenerator.cs +++ b/tools/GenerateTestSummary/TestSummaryGenerator.cs @@ -150,9 +150,23 @@ public static void CreateSingleTestSummaryReport(string trxFilePath, StringBuild reportBuilder.AppendLine(test.Output?.ErrorInfo?.InnerText); if (test.Output?.StdOut is not null) { + const int halfLength = 25_000; + var stdOutSpan = test.Output.StdOut.AsSpan(); + reportBuilder.AppendLine(); reportBuilder.AppendLine("### StdOut"); - reportBuilder.AppendLine(TruncateTheStart(test.Output.StdOut, 50_000)); + + var startSpan = stdOutSpan[..Math.Min(halfLength, stdOutSpan.Length)]; + reportBuilder.AppendLine(startSpan.ToString()); + + if (stdOutSpan.Length > halfLength) + { + reportBuilder.AppendLine(CultureInfo.InvariantCulture, $"{Environment.NewLine}... (snip) ...{Environment.NewLine}"); + var endSpan = stdOutSpan[^halfLength..]; + // `endSpan` might not begin at the true beginning of the original line + reportBuilder.Append("... "); + reportBuilder.Append(endSpan); + } } reportBuilder.AppendLine("```"); @@ -177,9 +191,4 @@ public static string GetTestTitle(string trxFileName) [GeneratedRegex(@"(?.*)_(?net\d+\.0)_.*")] private static partial Regex TestNameFromTrxFileNameRegex(); - - private static string? TruncateTheStart(string? s, int maxLength) - => s is null || s.Length <= maxLength - ? s - : "... (truncated) " + s[^maxLength..]; } From 34a646690d67cb2661aaa01564c9cdeb126ab8cd Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 15 May 2025 17:28:09 -0400 Subject: [PATCH 4/5] Quarantine Aspire.Hosting.Tests.DistributedApplicationTests.TestServicesWithMultipleReplicas Issue: https://github.com/dotnet/aspire/issues/9340 --- tests/Aspire.Hosting.Tests/DistributedApplicationTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Aspire.Hosting.Tests/DistributedApplicationTests.cs b/tests/Aspire.Hosting.Tests/DistributedApplicationTests.cs index 7d4920db1f3..46ee19759bf 100644 --- a/tests/Aspire.Hosting.Tests/DistributedApplicationTests.cs +++ b/tests/Aspire.Hosting.Tests/DistributedApplicationTests.cs @@ -367,6 +367,7 @@ public Task AfterEndpointsAllocatedAsync(DistributedApplicationModel appModel, C } [Fact] + [QuarantinedTest("https://github.com/dotnet/aspire/issues/9340")] public async Task TestServicesWithMultipleReplicas() { var replicaCount = 3; From cfa668a77ec7199f3e2a30a610407f6a9f42656e Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 15 May 2025 18:36:31 -0400 Subject: [PATCH 5/5] Quarantine YarpFunctionalTests.VerifyYarpResource - https://github.com/dotnet/aspire/issues/9344 --- tests/Aspire.Hosting.Yarp.Tests/YarpFunctionalTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Aspire.Hosting.Yarp.Tests/YarpFunctionalTests.cs b/tests/Aspire.Hosting.Yarp.Tests/YarpFunctionalTests.cs index aa19184fb9e..3c62e817843 100644 --- a/tests/Aspire.Hosting.Yarp.Tests/YarpFunctionalTests.cs +++ b/tests/Aspire.Hosting.Yarp.Tests/YarpFunctionalTests.cs @@ -11,6 +11,7 @@ public class YarpFunctionalTests(ITestOutputHelper testOutputHelper) { [Fact] [RequiresDocker] + [QuarantinedTest("https://github.com/dotnet/aspire/issues/9344")] public async Task VerifyYarpResource() { var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));