From 304382f406f7e52d5326b1fa9e13a7415f21384c Mon Sep 17 00:00:00 2001 From: ta264 Date: Mon, 14 Oct 2019 21:20:59 +0100 Subject: [PATCH] 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 --- .../ApiTests/DownloadClientFixture.cs | 8 ++++++++ .../ApiTests/MovieFixture.cs | 6 ++++++ .../ApiTests/NamingConfigFixture.cs | 10 ++++++++++ .../ApiTests/RootFolderFixture.cs | 2 ++ .../GenericApiFixture.cs | 3 ++- src/NzbDrone.Integration.Test/HttpLogFixture.cs | 2 ++ .../IntegrationTestBase.cs | 16 ++++++++++++++++ 7 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Integration.Test/ApiTests/DownloadClientFixture.cs b/src/NzbDrone.Integration.Test/ApiTests/DownloadClientFixture.cs index a95d44641..d30bc7d58 100644 --- a/src/NzbDrone.Integration.Test/ApiTests/DownloadClientFixture.cs +++ b/src/NzbDrone.Integration.Test/ApiTests/DownloadClientFixture.cs @@ -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); } diff --git a/src/NzbDrone.Integration.Test/ApiTests/MovieFixture.cs b/src/NzbDrone.Integration.Test/ApiTests/MovieFixture.cs index e0a632c18..257b0d4b2 100644 --- a/src/NzbDrone.Integration.Test/ApiTests/MovieFixture.cs +++ b/src/NzbDrone.Integration.Test/ApiTests/MovieFixture.cs @@ -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); } diff --git a/src/NzbDrone.Integration.Test/ApiTests/NamingConfigFixture.cs b/src/NzbDrone.Integration.Test/ApiTests/NamingConfigFixture.cs index df59cc90d..96cc07f52 100644 --- a/src/NzbDrone.Integration.Test/ApiTests/NamingConfigFixture.cs +++ b/src/NzbDrone.Integration.Test/ApiTests/NamingConfigFixture.cs @@ -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"; diff --git a/src/NzbDrone.Integration.Test/ApiTests/RootFolderFixture.cs b/src/NzbDrone.Integration.Test/ApiTests/RootFolderFixture.cs index c8332e4cb..3f2ba7967 100644 --- a/src/NzbDrone.Integration.Test/ApiTests/RootFolderFixture.cs +++ b/src/NzbDrone.Integration.Test/ApiTests/RootFolderFixture.cs @@ -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" diff --git a/src/NzbDrone.Integration.Test/GenericApiFixture.cs b/src/NzbDrone.Integration.Test/GenericApiFixture.cs index d4295a459..2f2b2bca7 100644 --- a/src/NzbDrone.Integration.Test/GenericApiFixture.cs +++ b/src/NzbDrone.Integration.Test/GenericApiFixture.cs @@ -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); } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Integration.Test/HttpLogFixture.cs b/src/NzbDrone.Integration.Test/HttpLogFixture.cs index ba2d4cf35..26d0f2ea7 100644 --- a/src/NzbDrone.Integration.Test/HttpLogFixture.cs +++ b/src/NzbDrone.Integration.Test/HttpLogFixture.cs @@ -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); diff --git a/src/NzbDrone.Integration.Test/IntegrationTestBase.cs b/src/NzbDrone.Integration.Test/IntegrationTestBase.cs index 389327c59..e912fc119 100644 --- a/src/NzbDrone.Integration.Test/IntegrationTestBase.cs +++ b/src/NzbDrone.Integration.Test/IntegrationTestBase.cs @@ -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));