Fixes admin logs and tests to not depend on IEntity caching (#5657)
Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com>
This commit is contained in:
committed by
GitHub
parent
c4c139041c
commit
3f8f4c818e
@@ -161,7 +161,7 @@ public class AddTests : ContentIntegrationTest
|
||||
await server.WaitPost(() =>
|
||||
{
|
||||
var coordinates = GetMainEntityCoordinates(sMaps);
|
||||
var entity = sEntities.SpawnEntity(null, coordinates);
|
||||
var entity = sEntities.SpawnEntity(null, coordinates).Uid;
|
||||
|
||||
if (parallel)
|
||||
{
|
||||
|
||||
@@ -178,10 +178,14 @@ namespace Content.IntegrationTests.Tests.Body
|
||||
|
||||
var increment = 10;
|
||||
|
||||
|
||||
for (var tick = 0; tick < 600; tick += increment)
|
||||
{
|
||||
await server.WaitRunTicks(increment);
|
||||
Assert.False(respirator.Suffocating, $"Entity {human.Name} is suffocating on tick {tick}");
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
Assert.False(respirator.Suffocating, $"Entity {human.Name} is suffocating on tick {tick}");
|
||||
});
|
||||
}
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
@@ -144,14 +144,13 @@ namespace Content.IntegrationTests.Tests.Doors
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
// Push the human towards the airlock
|
||||
Assert.That(physBody != null);
|
||||
physBody.LinearVelocity = (0.5f, 0);
|
||||
await server.WaitAssertion(() => Assert.That(physBody != null));
|
||||
await server.WaitPost(() => physBody.LinearVelocity = (0.5f, 0));
|
||||
|
||||
for (var i = 0; i < 240; i += 10)
|
||||
{
|
||||
// Keep the airlock awake so they collide
|
||||
airlock.GetComponent<IPhysBody>().WakeBody();
|
||||
|
||||
server.Post(() => airlock.GetComponent<IPhysBody>().WakeBody());
|
||||
|
||||
await server.WaitRunTicks(10);
|
||||
await server.WaitIdleAsync();
|
||||
@@ -164,7 +163,7 @@ namespace Content.IntegrationTests.Tests.Doors
|
||||
// Assert.That(physicsDummy.Transform.MapPosition.X, Is.GreaterThan(physicsDummyStartingX));
|
||||
|
||||
// Blocked by the airlock
|
||||
Assert.That(Math.Abs(physicsDummy.Transform.MapPosition.X - 1) > 0.01f);
|
||||
await server.WaitAssertion(() => Assert.That(Math.Abs(physicsDummy.Transform.MapPosition.X - 1) > 0.01f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,9 +179,6 @@ namespace Content.IntegrationTests.Tests.Fluids
|
||||
// Puddle evaporation should have ticked
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
// Check that the puddle is unpaused
|
||||
Assert.False(puddle.Owner.Paused);
|
||||
|
||||
// Check that puddle has been deleted
|
||||
Assert.True(puddle.Deleted);
|
||||
});
|
||||
|
||||
@@ -50,9 +50,9 @@ namespace Content.IntegrationTests.Tests.Lobby
|
||||
serverConfig.SetCVar(CCVars.GameDummyTicker, false);
|
||||
serverConfig.SetCVar(CCVars.GameLobbyEnabled, true);
|
||||
serverTicker.RestartRound();
|
||||
});
|
||||
|
||||
Assert.That(serverTicker.RunLevel, Is.EqualTo(GameRunLevel.PreRoundLobby));
|
||||
Assert.That(serverTicker.RunLevel, Is.EqualTo(GameRunLevel.PreRoundLobby));
|
||||
});
|
||||
|
||||
// Need to run them in sync to receive the messages.
|
||||
await RunTicksSync(client, server, 1);
|
||||
@@ -68,7 +68,8 @@ namespace Content.IntegrationTests.Tests.Lobby
|
||||
{
|
||||
clientPrefManager.SelectCharacter(0);
|
||||
|
||||
var clientCharacters = clientPrefManager.Preferences.Characters;
|
||||
var clientCharacters = clientPrefManager.Preferences?.Characters;
|
||||
Assert.That(clientCharacters, Is.Not.Null);
|
||||
Assert.That(clientCharacters.Count, Is.EqualTo(1));
|
||||
|
||||
Assert.That(clientStateManager.CurrentState, Is.TypeOf<LobbyState>());
|
||||
@@ -76,8 +77,9 @@ namespace Content.IntegrationTests.Tests.Lobby
|
||||
profile = HumanoidCharacterProfile.Random();
|
||||
clientPrefManager.CreateCharacter(profile);
|
||||
|
||||
clientCharacters = clientPrefManager.Preferences.Characters;
|
||||
clientCharacters = clientPrefManager.Preferences?.Characters;
|
||||
|
||||
Assert.That(clientCharacters, Is.Not.Null);
|
||||
Assert.That(clientCharacters.Count, Is.EqualTo(2));
|
||||
Assert.That(clientCharacters[1].MemberwiseEquals(profile));
|
||||
});
|
||||
@@ -96,7 +98,7 @@ namespace Content.IntegrationTests.Tests.Lobby
|
||||
{
|
||||
clientPrefManager.DeleteCharacter(1);
|
||||
|
||||
var clientCharacters = clientPrefManager.Preferences.Characters.Count;
|
||||
var clientCharacters = clientPrefManager.Preferences?.Characters.Count;
|
||||
Assert.That(clientCharacters, Is.EqualTo(1));
|
||||
});
|
||||
|
||||
@@ -116,8 +118,9 @@ namespace Content.IntegrationTests.Tests.Lobby
|
||||
|
||||
clientPrefManager.CreateCharacter(profile);
|
||||
|
||||
var clientCharacters = clientPrefManager.Preferences.Characters;
|
||||
var clientCharacters = clientPrefManager.Preferences?.Characters;
|
||||
|
||||
Assert.That(clientCharacters, Is.Not.Null);
|
||||
Assert.That(clientCharacters.Count, Is.EqualTo(2));
|
||||
Assert.That(clientCharacters[1].MemberwiseEquals(profile));
|
||||
});
|
||||
|
||||
@@ -55,10 +55,10 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
var clEntityManager = client.ResolveDependency<IEntityManager>();
|
||||
var svEntityManager = server.ResolveDependency<IEntityManager>();
|
||||
|
||||
var lastSvEntity = svEntityManager.GetEntities().Last();
|
||||
var lastClEntity = clEntityManager.GetEntity(lastSvEntity.Uid);
|
||||
var lastSvEntity = svEntityManager.GetEntities().Last().Uid;
|
||||
|
||||
Assert.That(lastClEntity.Transform.Coordinates, Is.EqualTo(lastSvEntity.Transform.Coordinates));
|
||||
Assert.That(clEntityManager.GetComponent<TransformComponent>(lastSvEntity).Coordinates,
|
||||
Is.EqualTo(svEntityManager.GetComponent<TransformComponent>(lastSvEntity).Coordinates));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,21 +60,24 @@ namespace Content.IntegrationTests.Tests
|
||||
mapLoader.LoadMap(new MapId(10), mapPath);
|
||||
});
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
if(!mapManager.TryFindGridAt(new MapId(10), new Vector2(10,10), out var mapGrid))
|
||||
Assert.Fail();
|
||||
{
|
||||
if (!mapManager.TryFindGridAt(new MapId(10), new Vector2(10, 10), out var mapGrid))
|
||||
Assert.Fail();
|
||||
|
||||
Assert.That(mapGrid.WorldPosition, Is.EqualTo(new Vector2(10, 10)));
|
||||
Assert.That(mapGrid.GetTileRef(new Vector2i(0, 0)).Tile, Is.EqualTo(new Tile(1, 512)));
|
||||
}
|
||||
{
|
||||
if (!mapManager.TryFindGridAt(new MapId(10), new Vector2(-8, -8), out var mapGrid))
|
||||
Assert.Fail();
|
||||
Assert.That(mapGrid.WorldPosition, Is.EqualTo(new Vector2(10, 10)));
|
||||
|
||||
Assert.That(mapGrid.WorldPosition, Is.EqualTo(new Vector2(-8, -8)));
|
||||
Assert.That(mapGrid.GetTileRef(new Vector2i(0, 0)).Tile, Is.EqualTo(new Tile(2, 511)));
|
||||
}
|
||||
Assert.That(mapGrid.GetTileRef(new Vector2i(0, 0)).Tile, Is.EqualTo(new Tile(1, 512)));
|
||||
}
|
||||
{
|
||||
if (!mapManager.TryFindGridAt(new MapId(10), new Vector2(-8, -8), out var mapGrid))
|
||||
Assert.Fail();
|
||||
|
||||
Assert.That(mapGrid.WorldPosition, Is.EqualTo(new Vector2(-8, -8)));
|
||||
Assert.That(mapGrid.GetTileRef(new Vector2i(0, 0)).Tile, Is.EqualTo(new Tile(2, 511)));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user