From 1ace52784b41a17106b646988f7dbdd5d644aac6 Mon Sep 17 00:00:00 2001 From: ta264 Date: Sun, 16 Aug 2020 03:45:12 +0100 Subject: [PATCH] Print log file on fail --- src/NzbDrone.Test.Common/NzbDroneRunner.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/NzbDrone.Test.Common/NzbDroneRunner.cs b/src/NzbDrone.Test.Common/NzbDroneRunner.cs index ecb705fb1..713101a71 100644 --- a/src/NzbDrone.Test.Common/NzbDroneRunner.cs +++ b/src/NzbDrone.Test.Common/NzbDroneRunner.cs @@ -102,6 +102,14 @@ public void Kill() { if (_nzbDroneProcess != null) { + _nzbDroneProcess.Refresh(); + if (_nzbDroneProcess.HasExited) + { + var log = File.ReadAllLines(Path.Combine(AppData, "logs", "Readarr.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); } } @@ -167,6 +175,7 @@ private void GenerateConfigFile() 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)));