From 23f2bbc7001c1a6d938a151f47a9c6dd324c0947 Mon Sep 17 00:00:00 2001 From: ta264 Date: Tue, 27 Apr 2021 19:26:38 +0100 Subject: [PATCH] Don't start integration tests too soon (cherry picked from commit b284f40716269dc4f641323b8293f40dfda8a424) (cherry picked from commit d549975d96f04cc6b197d719d8389110cb24b8e6) --- src/NzbDrone.Integration.Test/ApiTests/AuthorEditorFixture.cs | 2 ++ src/NzbDrone.Integration.Test/IntegrationTest.cs | 4 ++++ src/NzbDrone.Integration.Test/IntegrationTestBase.cs | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/NzbDrone.Integration.Test/ApiTests/AuthorEditorFixture.cs b/src/NzbDrone.Integration.Test/ApiTests/AuthorEditorFixture.cs index 9f6ff3e49..9e99cf331 100644 --- a/src/NzbDrone.Integration.Test/ApiTests/AuthorEditorFixture.cs +++ b/src/NzbDrone.Integration.Test/ApiTests/AuthorEditorFixture.cs @@ -11,6 +11,8 @@ namespace NzbDrone.Integration.Test.ApiTests { private void GivenExistingAuthor() { + WaitForCompletion(() => Profiles.All().Count > 0); + foreach (var name in new[] { "Alien Ant Farm", "Kiss" }) { var newAuthor = Author.Lookup(name).First(); diff --git a/src/NzbDrone.Integration.Test/IntegrationTest.cs b/src/NzbDrone.Integration.Test/IntegrationTest.cs index 7ccb41f43..22387c902 100644 --- a/src/NzbDrone.Integration.Test/IntegrationTest.cs +++ b/src/NzbDrone.Integration.Test/IntegrationTest.cs @@ -1,6 +1,7 @@ using System.Threading; using NLog; using NUnit.Framework; +using NzbDrone.Common.Extensions; using NzbDrone.Core.Indexers.Newznab; using NzbDrone.Test.Common; using Readarr.Http.ClientSchema; @@ -34,6 +35,9 @@ namespace NzbDrone.Integration.Test protected override void InitializeTestTarget() { + // Make sure tasks have been initialized so the config put below doesn't cause errors + WaitForCompletion(() => Tasks.All().SelectList(x => x.TaskName).Contains("RssSync")); + Indexers.Post(new Readarr.Api.V1.Indexers.IndexerResource { EnableRss = false, diff --git a/src/NzbDrone.Integration.Test/IntegrationTestBase.cs b/src/NzbDrone.Integration.Test/IntegrationTestBase.cs index e1275566a..06ff0c564 100644 --- a/src/NzbDrone.Integration.Test/IntegrationTestBase.cs +++ b/src/NzbDrone.Integration.Test/IntegrationTestBase.cs @@ -24,6 +24,7 @@ using Readarr.Api.V1.DownloadClient; using Readarr.Api.V1.History; using Readarr.Api.V1.Profiles.Quality; using Readarr.Api.V1.RootFolders; +using Readarr.Api.V1.System.Tasks; using Readarr.Api.V1.Tags; using RestSharp; using RestSharp.Serializers.SystemTextJson; @@ -37,6 +38,7 @@ namespace NzbDrone.Integration.Test public ClientBase Blacklist; public CommandClient Commands; + public ClientBase Tasks; public DownloadClientClient DownloadClients; public BookClient Books; public ClientBase History; @@ -101,6 +103,7 @@ namespace NzbDrone.Integration.Test Blacklist = new ClientBase(RestClient, ApiKey); Commands = new CommandClient(RestClient, ApiKey); + Tasks = new ClientBase(RestClient, ApiKey, "system/task"); DownloadClients = new DownloadClientClient(RestClient, ApiKey); Books = new BookClient(RestClient, ApiKey); History = new ClientBase(RestClient, ApiKey);