From 2d43bb6b3897d805b9f792c3d8aed85964f9174a Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 31 Aug 2024 07:49:20 +0200 Subject: [PATCH] Fix broken tests directly mutating entities from wrong thread. (#31647) * Fix broken tests directly mutating entities from wrong thread. * fix build * gundam * stuff --------- Co-authored-by: metalgearsloth --- .../Tests/Actions/ActionPvsDetachTest.cs | 8 +++----- Content.IntegrationTests/Tests/CargoTest.cs | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Content.IntegrationTests/Tests/Actions/ActionPvsDetachTest.cs b/Content.IntegrationTests/Tests/Actions/ActionPvsDetachTest.cs index b07c352c81..45addff00b 100644 --- a/Content.IntegrationTests/Tests/Actions/ActionPvsDetachTest.cs +++ b/Content.IntegrationTests/Tests/Actions/ActionPvsDetachTest.cs @@ -32,16 +32,14 @@ public sealed class ActionPvsDetachTest // PVS-detach action entities // We do this by just giving them the ghost layer var visSys = server.System(); - - await server.WaitPost(() => + server.Post(() => { var enumerator = server.Transform(ent).ChildEnumerator; while (enumerator.MoveNext(out var child)) { - visSys.AddLayer(child, (int)VisibilityFlags.Ghost); + visSys.AddLayer(child, (int) VisibilityFlags.Ghost); } }); - await pair.RunTicksSync(5); // Client's actions have left been detached / are out of view, but action comp state has not changed @@ -49,7 +47,7 @@ public sealed class ActionPvsDetachTest Assert.That(cSys.GetActions(cEnt).Count(), Is.EqualTo(initActions)); // Re-enter PVS view - await server.WaitPost(() => + server.Post(() => { var enumerator = server.Transform(ent).ChildEnumerator; while (enumerator.MoveNext(out var child)) diff --git a/Content.IntegrationTests/Tests/CargoTest.cs b/Content.IntegrationTests/Tests/CargoTest.cs index 1b29e7ea7a..37fd3a80f9 100644 --- a/Content.IntegrationTests/Tests/CargoTest.cs +++ b/Content.IntegrationTests/Tests/CargoTest.cs @@ -253,12 +253,12 @@ public sealed class CargoTest { await using var pair = await PoolManager.GetServerClient(); var server = pair.Server; - var entManager = server.ResolveDependency(); - var priceSystem = entManager.System(); await server.WaitAssertion(() => { + var priceSystem = entManager.System(); + var ent = entManager.SpawnEntity("StackEnt", MapCoordinates.Nullspace); var price = priceSystem.GetPrice(ent); Assert.That(price, Is.EqualTo(100.0));