Skip to content

Commit f0e9815

Browse files
authored
Fix dump tests (#8518)
1 parent 66dde31 commit f0e9815

File tree

1 file changed

+13
-2
lines changed
  • src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests

1 file changed

+13
-2
lines changed

src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/DumpTests.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,19 @@ private Task DumpTestCore(DiagnosticPortConnectionMode mode, DumpType type)
6161
{
6262
int processId = await runner.ProcessIdTask;
6363

64-
using ResponseStreamHolder holder = await client.CaptureDumpAsync(processId, type);
65-
Assert.NotNull(holder);
64+
// In .Net 10, dump operations sometimes fail due to a lock on /proc/<pid>/mem.
65+
using ResponseStreamHolder holder = await RetryUtilities.RetryAsync<ResponseStreamHolder>(
66+
func: async () =>
67+
{
68+
ResponseStreamHolder holder = await client.CaptureDumpAsync(processId, type);
69+
Assert.NotNull(holder);
70+
holder.Response.EnsureSuccessStatusCode();
71+
return holder;
72+
},
73+
shouldRetry: (Exception e) =>
74+
((e is HttpRequestException requestException) &&
75+
(requestException.StatusCode == System.Net.HttpStatusCode.BadRequest)),
76+
outputHelper: _outputHelper);
6677

6778
// The dump operation may still be in progress but the process should still be discoverable.
6879
// If this check fails, then the dump operation is causing dotnet-monitor to not be able

0 commit comments

Comments
 (0)