Regression tests for #1490

This commit is contained in:
Dominion
2023-05-20 19:30:18 -04:00
parent ddc7130887
commit 1214cfbbfd
2 changed files with 39 additions and 0 deletions
+20
View File
@@ -35,6 +35,12 @@
for(var/i in 1 to 10000000)
dab()
TgsNew(new /datum/tgs_event_handler/impl, TGS_SECURITY_SAFE)
var/list/channels = TgsChatChannelInfo()
if(!length(channels))
text2file("Expected some chat channels!", "test_fail_reason.txt")
del(world)
StartAsync()
/proc/dab()
@@ -133,9 +139,17 @@ var/run_bridge_test
// Bridge response queuing
var/tactics6 = data["tgs_integration_test_tactics6"]
if(tactics6)
if (length(world.TgsChatChannelInfo()))
return "channels_present!"
DetachedChatMessageQueuing()
return "queued"
var/tactics7 = data["tgs_integration_test_tactics7"]
if(tactics7)
var/list/channels = TgsChatChannelInfo()
return "[length(channels)]"
TgsChatBroadcast(new /datum/tgs_message_content("Recieved non-tgs topic: `[T]`"))
return "feck"
@@ -162,6 +176,12 @@ var/run_bridge_test
/datum/tgs_event_handler/impl/HandleEvent(event_code, ...)
set waitfor = FALSE
if(event_code == TGS_EVENT_WATCHDOG_DETACH)
var/list/channels = world.TgsChatChannelInfo()
if(length(channels))
text2file("Expected no chat channels after detach!", "test_fail_reason.txt")
del(world)
world.TgsChatBroadcast(new /datum/tgs_message_content("Recieved event: `[json_encode(args)]`"))
/world/Export(url)
@@ -840,6 +840,25 @@ namespace Tgstation.Server.Tests.Live
var dd = await instanceClient.DreamDaemon.Read(cancellationToken);
Assert.AreEqual(WatchdogStatus.Online, dd.Status.Value);
var chatReadTask = instanceClient.ChatBots.List(null, cancellationToken);
topicRequestResult = await WatchdogTest.TopicClient.SendTopic(
IPAddress.Loopback,
$"tgs_integration_test_tactics7=1",
DDPort,
cancellationToken);
Assert.IsNotNull(topicRequestResult);
if(!Int32.TryParse(topicRequestResult.StringData, out var channelsPresent))
{
Assert.Fail("Expected DD to send us an int!");
}
var currentChatBots = await chatReadTask;
var connectedChannelCount = currentChatBots.Where(x => x.Enabled.Value).SelectMany(x => x.Channels).Count();
Assert.AreEqual(connectedChannelCount, channelsPresent);
await instanceClient.DreamDaemon.Shutdown(cancellationToken);
dd = await instanceClient.DreamDaemon.Update(new DreamDaemonRequest
{