From 0acc6a627bbc77ff46fd5105461cf5e5998265f8 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Mon, 19 Jun 2023 11:41:36 -0400 Subject: [PATCH 1/2] Do not auto-approve draft pull requests --- .github/workflows/auto-approve-dominions-prs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-approve-dominions-prs.yml b/.github/workflows/auto-approve-dominions-prs.yml index dc38f8117a..c404c41b32 100644 --- a/.github/workflows/auto-approve-dominions-prs.yml +++ b/.github/workflows/auto-approve-dominions-prs.yml @@ -16,7 +16,7 @@ concurrency: jobs: approve-pr-if-dominion-is-author: name: Approve PR if Dominion is Author - if: github.event.pull_request.user.login == 'Cyberboss' && (github.event.pull_request.base.repo.owner.login == 'tgstation' || github.event.pull_request.base.repo.owner.login == 'Cyberboss') + if: github.event.pull_request.user.login == 'Cyberboss' && !github.event.pull_request.draft && (github.event.pull_request.base.repo.owner.login == 'tgstation' || github.event.pull_request.base.repo.owner.login == 'Cyberboss') runs-on: ubuntu-latest steps: - name: GitHub API Call From a5970e9ab28c59f0abd888680e8c6c23e372f360 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Mon, 19 Jun 2023 19:41:25 -0400 Subject: [PATCH 2/2] Test for an edge case I already handled See `ranInitialDmbCheck` in WatchdogBase.MonitorLifetimes() --- .../Live/Instance/WatchdogTest.cs | 6 +++++- .../Live/TestLiveServer.cs | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs b/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs index 62aa017dac..bb6a000b3b 100644 --- a/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs +++ b/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs @@ -95,6 +95,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"); } @@ -998,7 +1001,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 4e53bc70b5..4e3001d187 100644 --- a/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs +++ b/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs @@ -864,6 +864,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) @@ -922,6 +923,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); } @@ -998,6 +1006,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); @@ -1019,6 +1031,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 {