From 6cb7adca38a83e914edb2dffb4265b5991cdad89 Mon Sep 17 00:00:00 2001 From: Martin Molinero Date: Mon, 28 Sep 2026 13:54:58 -0300 Subject: [PATCH] Keep an empty errors list on live reads and stop the deployment when the live api test fails The live results converter set Errors to null whenever the response carried no errors array, which is every successful read, so callers joining the errors threw. The CreatesLiveAlgorithm api test hit exactly that, and its cleanup deleted the project without stopping the deployment, leaving live nodes busy for later runs. Co-Authored-By: Claude Opus 5.5 (1M context) --- Common/Api/LiveAlgorithmResultsJsonConverter.cs | 2 +- Tests/Api/LiveAlgorithmResultsJsonConverterTests.cs | 2 +- Tests/Api/ProjectTests.cs | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Common/Api/LiveAlgorithmResultsJsonConverter.cs b/Common/Api/LiveAlgorithmResultsJsonConverter.cs index 206a757ecc2f..6369adcde9ee 100644 --- a/Common/Api/LiveAlgorithmResultsJsonConverter.cs +++ b/Common/Api/LiveAlgorithmResultsJsonConverter.cs @@ -90,7 +90,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist Datacenter = jObject.Value("datacenter"), Public = jObject.Value("public"), Success = jObject.Value("success"), - Errors = jObject["errors"]?.ToObject>() + Errors = jObject["errors"]?.ToObject>() ?? new List() }; if (!liveAlgoResults.Success) diff --git a/Tests/Api/LiveAlgorithmResultsJsonConverterTests.cs b/Tests/Api/LiveAlgorithmResultsJsonConverterTests.cs index 49be26842b0e..39b79f209b6e 100644 --- a/Tests/Api/LiveAlgorithmResultsJsonConverterTests.cs +++ b/Tests/Api/LiveAlgorithmResultsJsonConverterTests.cs @@ -65,7 +65,7 @@ public void EveryFieldIsOptional() Assert.IsFalse(result.Success); Assert.IsNull(result.Status); Assert.IsNull(result.DeployId); - Assert.IsNull(result.Errors); + CollectionAssert.IsEmpty(result.Errors, "Like every other response, a missing errors array reads as no errors"); Assert.IsNull(result.Stopped); Assert.AreEqual(default(DateTime), result.Launched); Assert.IsNull(result.Charts); diff --git a/Tests/Api/ProjectTests.cs b/Tests/Api/ProjectTests.cs index 472c519c17fe..bd04dcd2fa10 100644 --- a/Tests/Api/ProjectTests.cs +++ b/Tests/Api/ProjectTests.cs @@ -930,11 +930,12 @@ public void CreatesLiveAlgorithm() Assert.IsTrue(readLiveLogs.Length >= 0, "The length of the logs was negative!"); Assert.IsTrue(readLiveLogs.DeploymentOffset >= 0, "The deploymentOffset"); } - catch (Exception ex) + catch { - // Delete the project in case of an error + // Stop whatever is running and delete the project in case of an error + ApiClient.LiquidateLiveAlgorithm(projectId); Assert.IsTrue(ApiClient.DeleteProject(projectId).Success); - throw ex; + throw; } // Delete the project