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 <comedian_vs_clown@hotmail.com>
This commit is contained in:
Pieter-Jan Briers
2024-08-31 07:49:20 +02:00
committed by GitHub
parent 8ca4337bd8
commit 2d43bb6b38
2 changed files with 5 additions and 7 deletions

View File

@@ -32,8 +32,7 @@ public sealed class ActionPvsDetachTest
// PVS-detach action entities // PVS-detach action entities
// We do this by just giving them the ghost layer // We do this by just giving them the ghost layer
var visSys = server.System<VisibilitySystem>(); var visSys = server.System<VisibilitySystem>();
server.Post(() =>
await server.WaitPost(() =>
{ {
var enumerator = server.Transform(ent).ChildEnumerator; var enumerator = server.Transform(ent).ChildEnumerator;
while (enumerator.MoveNext(out var child)) while (enumerator.MoveNext(out var child))
@@ -41,7 +40,6 @@ public sealed class ActionPvsDetachTest
visSys.AddLayer(child, (int) VisibilityFlags.Ghost); visSys.AddLayer(child, (int) VisibilityFlags.Ghost);
} }
}); });
await pair.RunTicksSync(5); await pair.RunTicksSync(5);
// Client's actions have left been detached / are out of view, but action comp state has not changed // 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)); Assert.That(cSys.GetActions(cEnt).Count(), Is.EqualTo(initActions));
// Re-enter PVS view // Re-enter PVS view
await server.WaitPost(() => server.Post(() =>
{ {
var enumerator = server.Transform(ent).ChildEnumerator; var enumerator = server.Transform(ent).ChildEnumerator;
while (enumerator.MoveNext(out var child)) while (enumerator.MoveNext(out var child))

View File

@@ -253,12 +253,12 @@ public sealed class CargoTest
{ {
await using var pair = await PoolManager.GetServerClient(); await using var pair = await PoolManager.GetServerClient();
var server = pair.Server; var server = pair.Server;
var entManager = server.ResolveDependency<IEntityManager>(); var entManager = server.ResolveDependency<IEntityManager>();
var priceSystem = entManager.System<PricingSystem>();
await server.WaitAssertion(() => await server.WaitAssertion(() =>
{ {
var priceSystem = entManager.System<PricingSystem>();
var ent = entManager.SpawnEntity("StackEnt", MapCoordinates.Nullspace); var ent = entManager.SpawnEntity("StackEnt", MapCoordinates.Nullspace);
var price = priceSystem.GetPrice(ent); var price = priceSystem.GetPrice(ent);
Assert.That(price, Is.EqualTo(100.0)); Assert.That(price, Is.EqualTo(100.0));