Files
Jordan Dominion a6c85366ae Add Windows service commands 128, 129, and 130
- 128 triggers a server shutdown.
- 129 and 130 are identical to SIGUSR1 and SIGUSR2 respectively, triggering a graceful shutdown and detaching shutdown respectively.
- These are implemented via pipes and are preferred to using the update path going forward. Should eventually replace the param entirely at the next possibility.
- New service params to detach and restart any running server as opposed to stopping entirely.
- Defer all service control to Service executable from Configure app.
- Console runner returns non-zero on error.
- Fix setting ACL of appsettings.Production.yml.
2023-06-25 21:00:26 -04:00

30 lines
929 B
C#

using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Host.Watchdog;
namespace Tgstation.Server.Host.Console.Tests
{
[TestClass]
public class TestProgram
{
[TestMethod]
public async Task TestProgramRuns()
{
var mockServer = new Mock<IWatchdog>();
var args = Array.Empty<string>();
mockServer.Setup(x => x.RunAsync(false, args, It.IsAny<CancellationToken>())).Returns(Task.FromResult(true)).Verifiable();
var mockServerFactory = new Mock<IWatchdogFactory>();
mockServerFactory.Setup(x => x.CreateWatchdog(It.IsNotNull<ISignalChecker>(), It.IsNotNull<ILoggerFactory>())).Returns(mockServer.Object).Verifiable();
Program.WatchdogFactory = mockServerFactory.Object;
await Program.Main(args);
mockServer.VerifyAll();
mockServerFactory.VerifyAll();
}
}
}