From f9a68eec8051a3b4987fd1afdd83dee225639dce Mon Sep 17 00:00:00 2001 From: Enkidu93 Date: Mon, 11 Dec 2023 11:11:28 -0500 Subject: [PATCH] Reordered test so builds we cancelled even on failure. (Also, removed some unnecessary usings). --- src/SIL.DataAccess/Usings.cs | 3 --- tests/Serval.E2ETests/ServalApiTests.cs | 22 +++++++++------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/SIL.DataAccess/Usings.cs b/src/SIL.DataAccess/Usings.cs index 63eb16a9..f7fc6ea7 100644 --- a/src/SIL.DataAccess/Usings.cs +++ b/src/SIL.DataAccess/Usings.cs @@ -3,9 +3,6 @@ global using System.Diagnostics.CodeAnalysis; global using System.Linq.Expressions; global using System.Reflection; -global using System.Text.Encodings.Web; -global using System.Text.Json; -global using System.Text.Json.Serialization; global using Microsoft.Extensions.DependencyInjection.Extensions; global using Microsoft.Extensions.Hosting; global using Microsoft.Extensions.Options; diff --git a/tests/Serval.E2ETests/ServalApiTests.cs b/tests/Serval.E2ETests/ServalApiTests.cs index 1e064d15..d58ef550 100644 --- a/tests/Serval.E2ETests/ServalApiTests.cs +++ b/tests/Serval.E2ETests/ServalApiTests.cs @@ -130,7 +130,7 @@ public async Task NmtQueueMultiple() { await _helperClient!.ClearEngines(); const int NUM_ENGINES = 9; - const int NUM_WORKERS = 6; + const int NUM_WORKERS = 1; string[] engineIds = new string[NUM_ENGINES]; for (int i = 0; i < NUM_ENGINES; i++) { @@ -164,18 +164,8 @@ public async Task NmtQueueMultiple() TranslationBuild newestEngineCurrentBuild = await _helperClient.translationEnginesClient.GetCurrentBuildAsync( engineIds[NUM_ENGINES - 1] ); - Assert.NotNull( - newestEngineCurrentBuild.QueueDepth, - JsonSerializer.Serialize(newestEngineCurrentBuild) + "|||" + builds - ); - Assert.Multiple(async () => - { - Assert.That(newestEngineCurrentBuild.QueueDepth, Is.GreaterThan(0), message: builds); - Assert.That( - (await _helperClient.translationEnginesClient.GetQueueAsync("Nmt")).Size, - Is.GreaterThanOrEqualTo(NUM_ENGINES - NUM_WORKERS) - ); - }); + int? queueDepth = newestEngineCurrentBuild.QueueDepth; + Queue queue = await _helperClient.translationEnginesClient.GetQueueAsync("Nmt"); for (int i = 0; i < NUM_ENGINES; i++) { try @@ -184,6 +174,12 @@ public async Task NmtQueueMultiple() } catch { } } + Assert.NotNull(queueDepth, JsonSerializer.Serialize(newestEngineCurrentBuild) + "|||" + builds); + Assert.Multiple(() => + { + Assert.That(queueDepth, Is.GreaterThan(0), message: builds); + Assert.That(queue.Size, Is.GreaterThanOrEqualTo(NUM_ENGINES - NUM_WORKERS)); + }); } [Test]