Kill tests when can't make test pair (#10861)

This commit is contained in:
wrexbe
2022-08-24 20:55:30 -07:00
committed by GitHub
parent c9f43f3646
commit e0de16773f

View File

@@ -61,6 +61,7 @@ public static class PoolManager
private static int PairId;
private static object PairLock = new();
private static List<Pair> Pairs = new();
private static Exception PoolFailureReason;
private static async Task ConfigurePrototypes(RobustIntegrationTest.IntegrationInstance instance,
PoolSettings settings)
@@ -409,11 +410,28 @@ public static class PoolManager
}
private static async Task<Pair> CreateServerClientPair(PoolSettings 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;
}