From d92895381c2faf7232ec8ea3927e8daafdfdeeec Mon Sep 17 00:00:00 2001 From: ta264 Date: Mon, 17 Aug 2020 22:27:05 +0100 Subject: [PATCH] Print log file on fail --- src/NzbDrone.Test.Common/NzbDroneRunner.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/NzbDrone.Test.Common/NzbDroneRunner.cs b/src/NzbDrone.Test.Common/NzbDroneRunner.cs index 54f8bb343..b00759ea7 100644 --- a/src/NzbDrone.Test.Common/NzbDroneRunner.cs +++ b/src/NzbDrone.Test.Common/NzbDroneRunner.cs @@ -1,11 +1,13 @@ using System; using System.Diagnostics; using System.IO; +using System.Linq; using System.Threading; using System.Xml.Linq; using NLog; using NUnit.Framework; using NzbDrone.Common.EnvironmentInfo; +using NzbDrone.Common.Extensions; using NzbDrone.Common.Processes; using NzbDrone.Core.Configuration; using RestSharp; @@ -94,6 +96,14 @@ namespace NzbDrone.Test.Common { if (_nzbDroneProcess != null) { + _nzbDroneProcess.Refresh(); + if (_nzbDroneProcess.HasExited) + { + var log = File.ReadAllLines(Path.Combine(AppData, "logs", "Radarr.trace.txt")); + var output = log.Join(Environment.NewLine); + TestContext.Progress.WriteLine("Process has exited prematurely: ExitCode={0} Output:\n{1}", _nzbDroneProcess.ExitCode, output); + } + _processProvider.Kill(_nzbDroneProcess.Id); } } @@ -153,6 +163,7 @@ namespace NzbDrone.Test.Common new XDeclaration("1.0", "utf-8", "yes"), new XElement(ConfigFileProvider.CONFIG_ELEMENT_NAME, new XElement(nameof(ConfigFileProvider.ApiKey), apiKey), + new XElement(nameof(ConfigFileProvider.LogLevel), "trace"), new XElement(nameof(ConfigFileProvider.AnalyticsEnabled), false), new XElement(nameof(ConfigFileProvider.Port), Port)));