mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-03-05 13:20:20 -05:00
Fixed flaky test.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
using RestSharp;
|
using RestSharp;
|
||||||
|
|
||||||
namespace NzbDrone.Integration.Test.Client
|
namespace NzbDrone.Integration.Test.Client
|
||||||
@@ -11,6 +12,12 @@ namespace NzbDrone.Integration.Test.Client
|
|||||||
}
|
}
|
||||||
|
|
||||||
public string[] GetLogFileLines(string filename)
|
public string[] GetLogFileLines(string filename)
|
||||||
|
{
|
||||||
|
var attempts = 10;
|
||||||
|
var attempt = 1;
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var request = BuildRequest(filename);
|
var request = BuildRequest(filename);
|
||||||
var content = Execute(request, System.Net.HttpStatusCode.OK);
|
var content = Execute(request, System.Net.HttpStatusCode.OK);
|
||||||
@@ -20,5 +27,18 @@ namespace NzbDrone.Integration.Test.Client
|
|||||||
Array.Resize(ref lines, lines.Length - 1);
|
Array.Resize(ref lines, lines.Length - 1);
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (attempt == attempts)
|
||||||
|
{
|
||||||
|
_logger.Error(ex, "Failed to get log lines");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
_logger.Info(ex, "Failed to get log lines, attempt {0}/{1}", attempt, attempts);
|
||||||
|
Thread.Sleep(10);
|
||||||
|
attempt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user