Fixed: Integration tests on Mono 5.12 and 5.14

Mono 5.12 and 5.14 has a bug that means RestSharp can't handle non-200
responses.  Fix status api call so tests start and disable the tests
that use non-200 responses on these mono versions
This commit is contained in:
ta264 2019-10-14 21:20:59 +01:00 committed by Qstick
parent 97de1b4622
commit 304382f406
7 changed files with 46 additions and 1 deletions

View File

@ -11,6 +11,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test, Order(0)]
public void add_downloadclient_without_name_should_return_badrequest()
{
IgnoreOnMonoVersions("5.12", "5.14");
EnsureNoDownloadClient();
var schema = DownloadClients.Schema().First(v => v.Implementation == "UsenetBlackhole");
@ -25,6 +27,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test, Order(0)]
public void add_downloadclient_without_nzbfolder_should_return_badrequest()
{
IgnoreOnMonoVersions("5.12", "5.14");
EnsureNoDownloadClient();
var schema = DownloadClients.Schema().First(v => v.Implementation == "UsenetBlackhole");
@ -39,6 +43,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test, Order(0)]
public void add_downloadclient_without_watchfolder_should_return_badrequest()
{
IgnoreOnMonoVersions("5.12", "5.14");
EnsureNoDownloadClient();
var schema = DownloadClients.Schema().First(v => v.Implementation == "UsenetBlackhole");
@ -90,6 +96,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void get_downloadclient_by_unknown_id_should_return_404()
{
IgnoreOnMonoVersions("5.12", "5.14");
var result = DownloadClients.InvalidGet(1000000);
}

View File

@ -32,6 +32,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test, Order(0)]
public void add_movie_without_profileid_should_return_badrequest()
{
IgnoreOnMonoVersions("5.12", "5.14");
EnsureNoMovie(680, "Pulp Fiction");
var movie = Movies.Lookup("imdb:tt0110912").Single();
@ -44,6 +46,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test, Order(0)]
public void add_movie_without_path_should_return_badrequest()
{
IgnoreOnMonoVersions("5.12", "5.14");
EnsureNoMovie(680, "Pulp Fiction");
var movie = Movies.Lookup("imdb:tt0110912").Single();
@ -96,6 +100,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void get_movie_by_unknown_id_should_return_404()
{
IgnoreOnMonoVersions("5.12", "5.14");
var result = Movies.InvalidGet(1000000);
}

View File

@ -37,6 +37,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_get_bad_request_if_standard_format_is_empty()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameMovies = true;
config.StandardMovieFormat = "";
@ -48,6 +50,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_get_bad_request_if_standard_format_doesnt_contain_title()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameMovies = true;
config.StandardMovieFormat = "{quality}";
@ -59,6 +63,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_not_require_format_when_rename_episodes_is_false()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameMovies = false;
config.StandardMovieFormat = "";
@ -70,6 +76,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_require_format_when_rename_episodes_is_true()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameMovies = true;
config.StandardMovieFormat = "";
@ -81,6 +89,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_get_bad_request_if_movie_folder_format_does_not_contain_movie_title()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameMovies = true;
config.MovieFolderFormat = "This and That";

View File

@ -44,6 +44,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void invalid_path_should_return_bad_request()
{
IgnoreOnMonoVersions("5.12", "5.14");
var rootFolder = new RootFolderResource
{
Path = "invalid_path"

View File

@ -36,6 +36,7 @@ namespace NzbDrone.Integration.Test
[TestCase("application/junk")]
public void should_get_unacceptable_with_accept_header(string header)
{
IgnoreOnMonoVersions("5.12", "5.14");
var request = new RestRequest("system/status")
{
@ -48,4 +49,4 @@ namespace NzbDrone.Integration.Test
response.StatusCode.Should().Be(HttpStatusCode.NotAcceptable);
}
}
}
}

View File

@ -11,6 +11,8 @@ namespace NzbDrone.Integration.Test
[Test]
public void should_log_on_error()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = HostConfig.Get(1);
config.LogLevel = "Trace";
HostConfig.Put(config);

View File

@ -162,6 +162,22 @@ namespace NzbDrone.Integration.Test
}
}
protected void IgnoreOnMonoVersions(params string[] version_strings)
{
if (!PlatformInfo.IsMono)
{
return;
}
var current = PlatformInfo.GetVersion();
var versions = version_strings.Select(x => new Version(x)).ToList();
if (versions.Any(x => x.Major == current.Major && x.Minor == current.Minor))
{
throw new IgnoreException($"Ignored on mono {PlatformInfo.GetVersion()}");
}
}
public string GetTempDirectory(params string[] args)
{
var path = Path.Combine(TempDirectory, Path.Combine(args));