From 95c26b52b1fa2a8bace75e8a45fbb9663c8ef3cc Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Sat, 6 Jul 2024 11:16:05 -0400 Subject: [PATCH] Forgot to return the current cron in the API --- src/Tgstation.Server.Host/Models/Instance.cs | 1 + .../Tgstation.Server.Tests/Live/InstanceManagerTest.cs | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Tgstation.Server.Host/Models/Instance.cs b/src/Tgstation.Server.Host/Models/Instance.cs index a96470e9fa..35434d81e1 100644 --- a/src/Tgstation.Server.Host/Models/Instance.cs +++ b/src/Tgstation.Server.Host/Models/Instance.cs @@ -69,6 +69,7 @@ namespace Tgstation.Server.Host.Models public InstanceResponse ToApi() => new() { AutoUpdateInterval = AutoUpdateInterval, + AutoUpdateCron = AutoUpdateCron, ConfigurationType = ConfigurationType, Id = Id, Name = Name, diff --git a/tests/Tgstation.Server.Tests/Live/InstanceManagerTest.cs b/tests/Tgstation.Server.Tests/Live/InstanceManagerTest.cs index 21442827b6..a346b8b0ed 100644 --- a/tests/Tgstation.Server.Tests/Live/InstanceManagerTest.cs +++ b/tests/Tgstation.Server.Tests/Live/InstanceManagerTest.cs @@ -179,19 +179,25 @@ namespace Tgstation.Server.Tests.Live }, cancellationToken), ErrorCode.ModelValidationFailure); // regression check - await instanceManagerClient.Update(new InstanceUpdateRequest + var updated = await instanceManagerClient.Update(new InstanceUpdateRequest { Id = firstTest.Id, AutoUpdateInterval = 9999, }, cancellationToken); + Assert.AreEqual(String.Empty, updated.AutoUpdateCron); + Assert.AreEqual(9999U, updated.AutoUpdateInterval); + // check regular 6-part crons succeed - await instanceManagerClient.Update(new InstanceUpdateRequest + updated = await instanceManagerClient.Update(new InstanceUpdateRequest { Id = firstTest.Id, AutoUpdateCron = "0 0 0 1 1 *" }, cancellationToken); + Assert.AreEqual("0 0 0 1 1 *", updated.AutoUpdateCron); + Assert.AreEqual(0U, updated.AutoUpdateInterval); + //can't move online instance await ApiAssert.ThrowsException(() => instanceManagerClient.Update(new InstanceUpdateRequest {