|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
@ -9,25 +9,26 @@ namespace NzbDrone.Integration.Test
|
|
|
|
|
public class HttpLogFixture : IntegrationTest
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
[Retry(5)]
|
|
|
|
|
public void should_log_on_error()
|
|
|
|
|
{
|
|
|
|
|
var config = HostConfig.Get(1);
|
|
|
|
|
config.LogLevel = "Trace";
|
|
|
|
|
HostConfig.Put(config);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var resultGet = Series.All();
|
|
|
|
|
|
|
|
|
|
var logFile = Path.Combine(_runner.AppData, "logs", "sonarr.trace.txt");
|
|
|
|
|
var logLines = File.ReadAllLines(logFile);
|
|
|
|
|
var logFile = "sonarr.trace.txt";
|
|
|
|
|
var logLines = Logs.GetLogFileLines(logFile);
|
|
|
|
|
|
|
|
|
|
var resultPost = Series.InvalidPost(new Api.Series.SeriesResource());
|
|
|
|
|
|
|
|
|
|
logLines = File.ReadAllLines(logFile).Skip(logLines.Length).ToArray();
|
|
|
|
|
// Skip 2 and 1 to ignore the logs endpoint
|
|
|
|
|
logLines = Logs.GetLogFileLines(logFile).Skip(logLines.Length + 2).ToArray();
|
|
|
|
|
Array.Resize(ref logLines, logLines.Length - 1);
|
|
|
|
|
|
|
|
|
|
logLines.Should().Contain(v => v.Contains("|Trace|Http|Req"));
|
|
|
|
|
logLines.Should().Contain(v => v.Contains("|Trace|Http|Res"));
|
|
|
|
|
logLines.Should().Contain(v => v.Contains("|Debug|Api|"));
|
|
|
|
|
logLines.Should().Contain(v => v.Contains("|Trace|Http|Req") && v.Contains("/api/series/"));
|
|
|
|
|
logLines.Should().Contain(v => v.Contains("|Trace|Http|Res") && v.Contains("/api/series/: 400.BadRequest"));
|
|
|
|
|
logLines.Should().Contain(v => v.Contains("|Debug|Api|") && v.Contains("/api/series/: 400.BadRequest"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|