Fix SpawnAndDeleteEntityCountTest heisentest (#21975)

This commit is contained in:
metalgearsloth
2023-11-30 22:08:08 +11:00
committed by GitHub
parent af1130e917
commit 30f4a3ca6d
3 changed files with 20 additions and 7 deletions

View File

@@ -69,7 +69,6 @@ public static partial class PoolManager
options.BeforeStart += () =>
{
var entSysMan = IoCManager.Resolve<IEntitySystemManager>();
var compFactory = IoCManager.Resolve<IComponentFactory>();
entSysMan.LoadExtraSystemType<ResettingEntitySystemTests.TestRoundRestartCleanupEvent>();
entSysMan.LoadExtraSystemType<InteractionSystemTests.TestInteractionSystem>();
entSysMan.LoadExtraSystemType<DeviceNetworkTestSystem>();

View File

@@ -216,6 +216,7 @@ namespace Content.IntegrationTests.Tests
{
var settings = new PoolSettings { Connected = true, Dirty = true };
await using var pair = await PoolManager.GetServerClient(settings);
var mapManager = pair.Server.ResolveDependency<IMapManager>();
var server = pair.Server;
var client = pair.Client;
@@ -245,8 +246,15 @@ namespace Content.IntegrationTests.Tests
.Select(p => p.ID)
.ToList();
var mapId = await pair.CreateTestMap();
var coords = mapId.MapCoords;
protoIds.Sort();
var mapId = MapId.Nullspace;
await server.WaitPost(() =>
{
mapId = mapManager.CreateMap();
});
var coords = new MapCoordinates(Vector2.Zero, mapId);
await pair.RunTicksSync(3);
@@ -273,7 +281,9 @@ namespace Content.IntegrationTests.Tests
if (client.EntMan.EntityCount != clientCount)
{
Assert.Fail($"Client prototype {protoId} failed on deleting itself");
Assert.Fail($"Client prototype {protoId} failed on deleting itself\n" +
$"Expected {clientCount} and found {client.EntMan.EntityCount}.\n" +
$"Server was {count}.");
}
continue;
}
@@ -286,7 +296,9 @@ namespace Content.IntegrationTests.Tests
if (client.EntMan.EntityCount <= clientCount)
{
Assert.Fail($"Client prototype {protoId} failed on spawning as entity count didn't increase");
Assert.Fail($"Client prototype {protoId} failed on spawning as entity count didn't increase" +
$"Expected at least {clientCount} and found {client.EntMan.EntityCount}. " +
$"Server was {count}");
}
await server.WaitPost(() => server.EntMan.DeleteEntity(uid));
@@ -300,7 +312,9 @@ namespace Content.IntegrationTests.Tests
if (client.EntMan.EntityCount != clientCount)
{
Assert.Fail($"Client prototype {protoId} failed on deletion count didn't reset properly");
Assert.Fail($"Client prototype {protoId} failed on deletion count didn't reset properly:\n" +
$"Expected {clientCount} and found {client.EntMan.EntityCount}.\n" +
$"Server was {count}.");
}
}

View File

@@ -140,7 +140,7 @@ public abstract partial class InteractionTest
[SetUp]
public virtual async Task Setup()
{
Pair = await PoolManager.GetServerClient(new PoolSettings { Connected = true });
Pair = await PoolManager.GetServerClient(new PoolSettings { Connected = true, Dirty = true});
// server dependencies
SEntMan = Server.ResolveDependency<IEntityManager>();