mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-24 13:36:50 +01:00
Change how we restart during integration tests
This commit is contained in:
@@ -14,6 +14,13 @@
|
||||
/world/Topic(T, Addr, Master, Keys)
|
||||
TGS_TOPIC
|
||||
|
||||
var/list/data = params2list(T)
|
||||
var/special_tactics = data["tgs_integration_test_special_tactics"]
|
||||
if(special_tactics)
|
||||
RebootAsync()
|
||||
return "ack"
|
||||
return "feck"
|
||||
|
||||
/world/Reboot(reason)
|
||||
TgsChatBroadcast("World Rebooting")
|
||||
TgsReboot()
|
||||
@@ -23,17 +30,6 @@
|
||||
|
||||
world.TgsChatBroadcast("Recieved event: [json_encode(args)]")
|
||||
|
||||
if(event_code != TGS_EVENT_REBOOT_MODE_CHANGE)
|
||||
world.TgsChatBroadcast("Not rebooting, wrong event");
|
||||
return
|
||||
|
||||
if(args[3] != TGS_REBOOT_MODE_RESTART)
|
||||
world.TgsChatBroadcast("Not rebooting, wrong reboot mode");
|
||||
return
|
||||
|
||||
RebootAsync()
|
||||
|
||||
|
||||
/proc/RebootAsync()
|
||||
set waitfor = FALSE
|
||||
world.TgsChatBroadcast("Rebooting after 3 seconds");
|
||||
|
||||
@@ -6,6 +6,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Api.Models;
|
||||
@@ -56,7 +57,7 @@ namespace Tgstation.Server.Tests.Instance
|
||||
var startJob = await instanceClient.DreamDaemon.Start(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
await WaitForJob(startJob, 10, false, cancellationToken);
|
||||
await Task.Delay(TimeSpan.FromSeconds(1));
|
||||
|
||||
daemonStatus = await instanceClient.DreamDaemon.Read(cancellationToken);
|
||||
Assert.IsTrue(daemonStatus.Running.Value);
|
||||
Assert.AreEqual(false, daemonStatus.SoftRestart);
|
||||
@@ -89,21 +90,13 @@ namespace Tgstation.Server.Tests.Instance
|
||||
|
||||
daemonStatus = await DeployTestDme(DmeName, DreamDaemonSecurity.Safe, cancellationToken);
|
||||
|
||||
await Task.Delay(TimeSpan.FromSeconds(3), cancellationToken);
|
||||
|
||||
Assert.IsTrue(daemonStatus.Running.Value);
|
||||
|
||||
if (new PlatformIdentifier().IsWindows)
|
||||
{
|
||||
// basic watchdog won't do this because it reboots instantly
|
||||
Assert.AreEqual(initialCompileJob.Id, daemonStatus.ActiveCompileJob.Id);
|
||||
Assert.AreNotEqual(initialCompileJob.Id, daemonStatus.StagedCompileJob.Id);
|
||||
Assert.AreEqual(DreamDaemonSecurity.Ultrasafe, daemonStatus.StagedCompileJob.MinimumSecurityLevel);
|
||||
Assert.AreEqual(initialCompileJob.Id, daemonStatus.ActiveCompileJob.Id);
|
||||
Assert.AreNotEqual(initialCompileJob.Id, daemonStatus.StagedCompileJob.Id);
|
||||
Assert.AreEqual(DreamDaemonSecurity.Ultrasafe, daemonStatus.StagedCompileJob.MinimumSecurityLevel);
|
||||
|
||||
await TellWorldToReboot(cancellationToken);
|
||||
}
|
||||
|
||||
await Task.Delay(10000, cancellationToken);
|
||||
await TellWorldToReboot(cancellationToken);
|
||||
|
||||
daemonStatus = await instanceClient.DreamDaemon.Read(cancellationToken);
|
||||
Assert.AreNotEqual(initialCompileJob.Id, daemonStatus.ActiveCompileJob.Id);
|
||||
@@ -177,12 +170,14 @@ namespace Tgstation.Server.Tests.Instance
|
||||
|
||||
async Task TellWorldToReboot(CancellationToken cancellationToken)
|
||||
{
|
||||
//we've wired long_running_test to reboot if its reboot mode is changed TO normal
|
||||
|
||||
await instanceClient.DreamDaemon.Update(new DreamDaemon
|
||||
IByondTopicSender bts = new ByondTopicSender
|
||||
{
|
||||
SoftRestart = true
|
||||
}, cancellationToken);
|
||||
SendTimeout = 5000,
|
||||
ReceiveTimeout = 5000
|
||||
};
|
||||
|
||||
var result = await bts.SendTopic(IPAddress.Loopback, "tgs_integration_test_special_tactics=1", 1337, cancellationToken);
|
||||
Assert.AreEqual("ack", result);
|
||||
|
||||
await Task.Delay(6000, cancellationToken);
|
||||
}
|
||||
@@ -199,9 +194,6 @@ namespace Tgstation.Server.Tests.Instance
|
||||
|
||||
await WaitForJob(compileJobJob, 90, false, cancellationToken);
|
||||
|
||||
// Compile job isn't loaded until after the job completes
|
||||
await Task.Delay(TimeSpan.FromSeconds(3));
|
||||
|
||||
return await instanceClient.DreamDaemon.Read(cancellationToken);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user