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
pull/6/head
ta264 5 years ago
parent cc008fb21d
commit 7050a20df5

@ -32,6 +32,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test, Order(0)]
public void add_artist_without_profileid_should_return_badrequest()
{
IgnoreOnMonoVersions("5.12", "5.14");
EnsureNoArtist("f59c5520-5f46-4d2c-b2c4-822eabf53419", "Linkin Park");
var artist = Artist.Lookup("lidarr:f59c5520-5f46-4d2c-b2c4-822eabf53419").Single();
@ -44,6 +46,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test, Order(0)]
public void add_artist_without_path_should_return_badrequest()
{
IgnoreOnMonoVersions("5.12", "5.14");
EnsureNoArtist("f59c5520-5f46-4d2c-b2c4-822eabf53419", "Linkin Park");
var artist = Artist.Lookup("lidarr:f59c5520-5f46-4d2c-b2c4-822eabf53419").Single();
@ -100,6 +104,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void get_artist_by_unknown_id_should_return_404()
{
IgnoreOnMonoVersions("5.12", "5.14");
var result = Artist.InvalidGet(1000000);
}

@ -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);
}

@ -36,6 +36,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.RenameTracks = true;
config.StandardTrackFormat = "";
@ -48,6 +50,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_get_bad_request_if_standard_format_doesnt_contain_track_number_and_title()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameTracks = true;
config.StandardTrackFormat = "{track:00}";
@ -59,6 +63,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_not_require_format_when_rename_tracks_is_false()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameTracks = false;
config.StandardTrackFormat = "";
@ -70,6 +76,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_require_format_when_rename_tracks_is_true()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameTracks = true;
config.StandardTrackFormat = "";
@ -81,6 +89,8 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_get_bad_request_if_artist_folder_format_does_not_contain_artist_name()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameTracks = true;
config.ArtistFolderFormat = "This and That";

@ -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"

@ -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);
}
}
}
}

@ -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);

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
@ -12,21 +11,17 @@ using NLog.Config;
using NLog.Targets;
using NUnit.Framework;
using Lidarr.Api.V1.Blacklist;
using Lidarr.Api.V1.Commands;
using Lidarr.Api.V1.Config;
using Lidarr.Api.V1.DownloadClient;
using Lidarr.Api.V1.TrackFiles;
using Lidarr.Api.V1.History;
using Lidarr.Api.V1.Profiles.Quality;
using Lidarr.Api.V1.RootFolders;
using Lidarr.Api.V1.Artist;
using Lidarr.Api.V1.Albums;
using Lidarr.Api.V1.Tracks;
using Lidarr.Api.V1.Tags;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Serializer;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Music.Commands;
using NzbDrone.Integration.Test.Client;
using NzbDrone.SignalR;
using NzbDrone.Test.Common.Categories;
@ -171,6 +166,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));

@ -24,7 +24,7 @@ namespace NzbDrone.Test.Common
public NzbDroneRunner(Logger logger, int port = 8686)
{
_processProvider = new ProcessProvider(logger);
_restClient = new RestClient("http://localhost:8686/api");
_restClient = new RestClient("http://localhost:8686/api/v1");
}
public void Start()

Loading…
Cancel
Save