Skip to content

Commit

Permalink
ProcessWatchdogTest: isolate logger
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed Dec 2, 2023
1 parent 2e42a45 commit 5d61b6e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rd-net/Test.Lifetimes/Diagnostics/ProcessWatchdogTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using JetBrains.Core;
using JetBrains.Diagnostics;
Expand All @@ -11,7 +12,7 @@

namespace Test.Lifetimes.Diagnostics;

public class ProcessWatchdogTest
public class ProcessWatchdogTest : LifetimesTestBase
{
[Test]
public Task TestWithSleepingProcess() => DoTest(StartSleepingProcess, true);
Expand Down Expand Up @@ -52,6 +53,11 @@ private static Task DoTest(Func<Process> processCreator, bool assertAlive) => Li
{
Assert.Fail($"Termination of process {process.Id} wasn't detected during the timeout.");
}
var exs = Assert.Throws<AggregateException>(TestLogger.ExceptionLogger.ThrowLoggedExceptions).InnerExceptions;
Assert.IsTrue(
exs.All(e => e.Message.Contains($"Parent process PID:{process.Id} has quit, killing ourselves via Process.Kill")),
$"No expected data in some of the exceptions: {string.Join("\n", exs.Select(e => e.Message))}");
});

private Process StartSleepingProcess()
Expand Down

0 comments on commit 5d61b6e

Please sign in to comment.