From e0de16773f23dd8ba76a7bec3712553aeda1f694 Mon Sep 17 00:00:00 2001 From: wrexbe <81056464+wrexbe@users.noreply.github.com> Date: Wed, 24 Aug 2022 20:55:30 -0700 Subject: [PATCH] Kill tests when can't make test pair (#10861) --- Content.IntegrationTests/PoolManager.cs | 26 +++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/Content.IntegrationTests/PoolManager.cs b/Content.IntegrationTests/PoolManager.cs index 39f699b38f..03b457dd46 100644 --- a/Content.IntegrationTests/PoolManager.cs +++ b/Content.IntegrationTests/PoolManager.cs @@ -61,6 +61,7 @@ public static class PoolManager private static int PairId; private static object PairLock = new(); private static List Pairs = new(); + private static Exception PoolFailureReason; private static async Task ConfigurePrototypes(RobustIntegrationTest.IntegrationInstance instance, PoolSettings settings) @@ -410,10 +411,27 @@ public static class PoolManager private static async Task CreateServerClientPair(PoolSettings poolSettings) { - var client = await GenerateClient(poolSettings); - var server = await GenerateServer(poolSettings); + Pair pair; + if (PoolFailureReason != null) + { + Assert.Inconclusive(@" +In a different test, the pool manager had an exception when trying to create a server/client pair. +Instead of risking that the pool manager will fail at creating a server/client pairs for every single test, +we are just going to end this here to save a lot of time. This is the exception that started this:\n {0}", PoolFailureReason); + } + + try + { + var client = await GenerateClient(poolSettings); + var server = await GenerateServer(poolSettings); + pair = new Pair { Server = server, Client = client, PairId = Interlocked.Increment(ref PairId) }; + } + catch (Exception ex) + { + PoolFailureReason = ex; + throw; + } - var pair = new Pair { Server = server, Client = client, PairId = Interlocked.Increment(ref PairId)}; if (!poolSettings.NotConnected) { pair.Client.SetConnectTarget(pair.Server); @@ -426,7 +444,7 @@ public static class PoolManager } }); await ReallyBeIdle(pair, 10); - await client.WaitRunTicks(1); + await pair.Client.WaitRunTicks(1); } return pair; }