From 5d61b6efd2521ff3b08409a150b048b49ff72e97 Mon Sep 17 00:00:00 2001 From: Ivan Migalev Date: Sat, 2 Dec 2023 18:03:34 +0100 Subject: [PATCH] ProcessWatchdogTest: isolate logger --- rd-net/Test.Lifetimes/Diagnostics/ProcessWatchdogTest.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rd-net/Test.Lifetimes/Diagnostics/ProcessWatchdogTest.cs b/rd-net/Test.Lifetimes/Diagnostics/ProcessWatchdogTest.cs index aac9213fa..6de86126e 100644 --- a/rd-net/Test.Lifetimes/Diagnostics/ProcessWatchdogTest.cs +++ b/rd-net/Test.Lifetimes/Diagnostics/ProcessWatchdogTest.cs @@ -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; @@ -11,7 +12,7 @@ namespace Test.Lifetimes.Diagnostics; -public class ProcessWatchdogTest +public class ProcessWatchdogTest : LifetimesTestBase { [Test] public Task TestWithSleepingProcess() => DoTest(StartSleepingProcess, true); @@ -52,6 +53,11 @@ private static Task DoTest(Func processCreator, bool assertAlive) => Li { Assert.Fail($"Termination of process {process.Id} wasn't detected during the timeout."); } + + var exs = Assert.Throws(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()