diff --git a/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs b/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs index c334f9afeb..004b0f3e8e 100644 --- a/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs +++ b/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs @@ -96,6 +96,9 @@ namespace Tgstation.Server.Tests.Live.Instance await InteropTestsForLongRunningDme(cancellationToken); + // for the restart staging tests + await DeployTestDme("LongRunning/long_running_test", DreamDaemonSecurity.Trusted, true, cancellationToken); + System.Console.WriteLine("TEST: END WATCHDOG TESTS"); } @@ -1030,7 +1033,8 @@ namespace Tgstation.Server.Tests.Live.Instance DisconnectTimeout = TimeSpan.FromSeconds(30) }, loggerFactory.CreateLogger("WatchdogTest.TopicClient")); - public async Task TellWorldToReboot(CancellationToken cancellationToken) + public Task TellWorldToReboot(CancellationToken cancellationToken) => TellWorldToReboot2(instanceClient, cancellationToken); + public static async Task TellWorldToReboot2(IInstanceClient instanceClient, CancellationToken cancellationToken) { var daemonStatus = await instanceClient.DreamDaemon.Read(cancellationToken); Assert.IsNotNull(daemonStatus.StagedCompileJob); diff --git a/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs b/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs index 47afd08b2b..015e6fcdf1 100644 --- a/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs +++ b/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs @@ -1000,6 +1000,7 @@ namespace Tgstation.Server.Tests.Live try { Api.Models.Instance instance; + long initialStaged, initialActive; using (var adminClient = await CreateAdminClient(server.Url, cancellationToken)) { if (server.DumpOpenApiSpecpath) @@ -1058,6 +1059,13 @@ namespace Tgstation.Server.Tests.Live await Task.WhenAll(rootTest, adminTest, instancesTest, instanceTests, usersTest); + var dd = await instanceClient.DreamDaemon.Read(cancellationToken); + Assert.AreEqual(WatchdogStatus.Online, dd.Status.Value); + Assert.IsNotNull(dd.StagedCompileJob); + Assert.AreNotEqual(dd.StagedCompileJob.Id, dd.ActiveCompileJob.Id); + initialActive = dd.ActiveCompileJob.Id.Value; + initialStaged = dd.StagedCompileJob.Id.Value; + await adminClient.Administration.Restart(cancellationToken); } @@ -1134,6 +1142,10 @@ namespace Tgstation.Server.Tests.Live var dd = await instanceClient.DreamDaemon.Read(cancellationToken); Assert.AreEqual(WatchdogStatus.Online, dd.Status.Value); + Assert.IsNotNull(dd.StagedCompileJob); + Assert.AreNotEqual(dd.StagedCompileJob.Id, dd.ActiveCompileJob.Id); + Assert.AreEqual(initialStaged, dd.StagedCompileJob.Id); + Assert.AreEqual(initialActive, dd.ActiveCompileJob.Id); var chatReadTask = instanceClient.ChatBots.List(null, cancellationToken); @@ -1155,6 +1167,13 @@ namespace Tgstation.Server.Tests.Live Assert.AreEqual(connectedChannelCount, channelsPresent); + await WatchdogTest.TellWorldToReboot2(instanceClient, cancellationToken); + + dd = await instanceClient.DreamDaemon.Read(cancellationToken); + Assert.AreEqual(WatchdogStatus.Online, dd.Status.Value); + Assert.IsNull(dd.StagedCompileJob); + Assert.AreEqual(initialStaged, dd.ActiveCompileJob.Id); + await instanceClient.DreamDaemon.Shutdown(cancellationToken); dd = await instanceClient.DreamDaemon.Update(new DreamDaemonRequest {