From f89108222536ebb60aa9b154fff51bfaf5daff16 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Wed, 6 May 2020 10:44:00 -0400 Subject: [PATCH] Add integration test sync delays --- tests/Tgstation.Server.Tests/Instance/WatchdogTest.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/Tgstation.Server.Tests/Instance/WatchdogTest.cs b/tests/Tgstation.Server.Tests/Instance/WatchdogTest.cs index 8805f90fd8..54c90225cd 100644 --- a/tests/Tgstation.Server.Tests/Instance/WatchdogTest.cs +++ b/tests/Tgstation.Server.Tests/Instance/WatchdogTest.cs @@ -56,6 +56,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); @@ -88,6 +89,8 @@ 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) @@ -122,6 +125,8 @@ namespace Tgstation.Server.Tests.Instance }, cancellationToken); + var initialStatus = await instanceClient.DreamDaemon.Read(cancellationToken); + var startJob = await instanceClient.DreamDaemon.Start(cancellationToken).ConfigureAwait(false); var byondInstallJob = await byondInstallJobTask; @@ -140,7 +145,7 @@ namespace Tgstation.Server.Tests.Instance if (new PlatformIdentifier().IsWindows) { // basic watchdog won't do this because it reboots instantly - Assert.IsNotNull(daemonStatus.StagedCompileJob); + Assert.IsTrue(daemonStatus.StagedCompileJob != null || daemonStatus.ActiveCompileJob.Id != initialStatus.ActiveCompileJob.Id); Assert.AreNotEqual(daemonStatus.ActiveCompileJob.ByondVersion, daemonStatus.StagedCompileJob.ByondVersion); Assert.AreEqual(versionToInstall, daemonStatus.StagedCompileJob.ByondVersion); Assert.AreEqual(true, daemonStatus.SoftRestart); @@ -203,7 +208,7 @@ namespace Tgstation.Server.Tests.Instance }, cancellationToken); var newStatus = await instanceClient.DreamDaemon.Read(cancellationToken); - Assert.AreEqual(true, newStatus.SoftShutdown); + Assert.IsTrue(newStatus.SoftShutdown.Value || !newStatus.Running.Value); do {