mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-23 13:07:07 +01:00
Fix DummyChatProvider interference with health check tests
This commit is contained in:
@@ -44,6 +44,8 @@ namespace Tgstation.Server.Tests.Live
|
||||
|
||||
ulong channelIdAllocator;
|
||||
|
||||
public static Task MessageGuard = Task.CompletedTask;
|
||||
|
||||
static IAsyncDelayer CreateMockDelayer()
|
||||
{
|
||||
// at time of writing, this is used exclusively for the reconnection interval which works in minutes
|
||||
@@ -219,6 +221,8 @@ namespace Tgstation.Server.Tests.Live
|
||||
var delay = random.Next(0, 10000);
|
||||
await Task.Delay(delay, cancellationToken);
|
||||
|
||||
await MessageGuard;
|
||||
|
||||
// %5 chance to disconnect randomly
|
||||
if (enableRandomDisconnections != 0 && random.Next(0, 100) > 95)
|
||||
connected = false;
|
||||
|
||||
@@ -165,9 +165,21 @@ namespace Tgstation.Server.Tests.Live.Instance
|
||||
await RunLongRunningTestThenUpdateWithNewDme(cancellationToken);
|
||||
await RunLongRunningTestThenUpdateWithByondVersionSwitch(cancellationToken);
|
||||
|
||||
// no chatty bullshit while we test health checks
|
||||
var tcs = new TaskCompletionSource();
|
||||
var oldTask = Interlocked.Exchange(ref DummyChatProvider.MessageGuard, tcs.Task);
|
||||
|
||||
await RunHealthCheckTest(true, cancellationToken);
|
||||
await RunHealthCheckTest(false, cancellationToken);
|
||||
|
||||
async void Cleanup()
|
||||
{
|
||||
await oldTask;
|
||||
tcs.SetResult();
|
||||
}
|
||||
|
||||
Cleanup();
|
||||
|
||||
await InteropTestsForLongRunningDme(cancellationToken);
|
||||
|
||||
await instanceClient.DreamDaemon.Update(new DreamDaemonRequest
|
||||
|
||||
Reference in New Issue
Block a user