mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Make RobustIntegrationTest pool by default (#5872)
This commit is contained in:
@@ -57,8 +57,9 @@ namespace Robust.UnitTesting.Shared
|
||||
await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync());
|
||||
|
||||
// Connect client to the server...
|
||||
var netMan = client.ResolveDependency<IClientNetManager>();
|
||||
Assert.DoesNotThrow(() => client.SetConnectTarget(server));
|
||||
client.Post(() => IoCManager.Resolve<IClientNetManager>().ClientConnect(null!, 0, null!));
|
||||
client.Post(() => netMan.ClientConnect(null!, 0, null!));
|
||||
|
||||
// Run 10 synced ticks...
|
||||
for (int i = 0; i < 10; i++)
|
||||
@@ -89,6 +90,10 @@ namespace Robust.UnitTesting.Shared
|
||||
Assert.That(netManager.ServerChannel, Is.Not.Null);
|
||||
Assert.That(netManager.ServerChannel!.IsConnected, Is.True);
|
||||
});
|
||||
|
||||
await client.WaitPost(() => netMan.ClientDisconnect(""));
|
||||
await server.WaitRunTicks(5);
|
||||
await client.WaitRunTicks(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public sealed partial class AutoIncludeSerializationTest : RobustIntegrationTest
|
||||
[Test]
|
||||
public async Task TestAutoIncludeSerialization()
|
||||
{
|
||||
var server = StartServer();
|
||||
var server = StartServer(new() {Pool = false}); // Pool=false due to TileDef registration
|
||||
await server.WaitIdleAsync();
|
||||
var entMan = server.EntMan;
|
||||
var mapSys = server.System<SharedMapSystem>();
|
||||
@@ -274,6 +274,7 @@ public sealed partial class AutoIncludeSerializationTest : RobustIntegrationTest
|
||||
await server.WaitPost(() => entMan.DeleteEntity(otherMap));
|
||||
await server.WaitPost(() => entMan.DeleteEntity(grid.Comp1.ParentUid));
|
||||
await server.WaitPost(() => entMan.DeleteEntity(nullSpace));
|
||||
await server.WaitPost(() => mapSys.DeleteMap(mapId));
|
||||
AssertCount(0);
|
||||
|
||||
// Check the map file
|
||||
@@ -302,5 +303,8 @@ public sealed partial class AutoIncludeSerializationTest : RobustIntegrationTest
|
||||
await server.WaitPost(() => entMan.DeleteEntity(otherMap));
|
||||
await server.WaitPost(() => entMan.DeleteEntity(nullSpace));
|
||||
AssertCount(0);
|
||||
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(0));
|
||||
Assert.That(entMan.Count<MapComponent>(), Is.EqualTo(0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using Robust.Shared.EntitySerialization.Components;
|
||||
using Robust.Shared.EntitySerialization.Systems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Utility;
|
||||
using static Robust.UnitTesting.Shared.EntitySerialization.EntitySaveTestComponent;
|
||||
|
||||
@@ -51,7 +52,7 @@ public sealed partial class BackwardsCompatibilityTest
|
||||
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(0));
|
||||
await server.WaitPost(() => mapUid = mapSys.CreateMap(out mapId));
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadGrid(mapId, gridPath, out _)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadGrid(mapId, gridPath, out _)));
|
||||
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(0));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(2));
|
||||
@@ -77,7 +78,7 @@ public sealed partial class BackwardsCompatibilityTest
|
||||
|
||||
var mapPath = new ResPath($"{nameof(MapDataV3Map)}.yml");
|
||||
resourceManager.MountString(mapPath.ToString(), MapDataV3Map);
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadMap(mapPath, out _, out _)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadMap(mapPath, out _, out _)));
|
||||
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(1));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(3));
|
||||
@@ -111,7 +112,7 @@ public sealed partial class BackwardsCompatibilityTest
|
||||
resourceManager.MountString(mapPath2.ToString(), MapDataV3Map);
|
||||
|
||||
var opts = DeserializationOptions.Default with {InitializeMaps = true};
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadMap(mapPath2, out _, out _, opts)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadMap(mapPath2, out _, out _, opts)));
|
||||
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(1));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(3));
|
||||
@@ -137,6 +138,8 @@ public sealed partial class BackwardsCompatibilityTest
|
||||
|
||||
await server.WaitPost(() => entMan.DeleteEntity(map));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(0));
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(0));
|
||||
Assert.That(entMan.Count<MapComponent>(), Is.EqualTo(0));
|
||||
}
|
||||
|
||||
private const string MapDataV3Grid = @"
|
||||
|
||||
@@ -6,6 +6,7 @@ using Robust.Shared.EntitySerialization.Components;
|
||||
using Robust.Shared.EntitySerialization.Systems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Utility;
|
||||
using static Robust.UnitTesting.Shared.EntitySerialization.EntitySaveTestComponent;
|
||||
|
||||
@@ -47,7 +48,7 @@ public sealed partial class BackwardsCompatibilityTest
|
||||
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(0));
|
||||
await server.WaitPost(() => mapUid = mapSys.CreateMap(out mapId));
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadGrid(mapId, gridPath, out _)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadGrid(mapId, gridPath, out _)));
|
||||
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(0));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(2));
|
||||
@@ -73,7 +74,7 @@ public sealed partial class BackwardsCompatibilityTest
|
||||
|
||||
var mapPath = new ResPath($"{nameof(MapDataV4Map)}.yml");
|
||||
resourceManager.MountString(mapPath.ToString(), MapDataV4Map);
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadMap(mapPath, out _, out _)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadMap(mapPath, out _, out _)));
|
||||
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(1));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(3));
|
||||
@@ -107,7 +108,7 @@ public sealed partial class BackwardsCompatibilityTest
|
||||
resourceManager.MountString(mapPath2.ToString(), MapDataV4Map);
|
||||
|
||||
var opts = DeserializationOptions.Default with {InitializeMaps = true};
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadMap(mapPath2, out _, out _, opts)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadMap(mapPath2, out _, out _, opts)));
|
||||
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(1));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(3));
|
||||
@@ -133,6 +134,8 @@ public sealed partial class BackwardsCompatibilityTest
|
||||
|
||||
await server.WaitPost(() => entMan.DeleteEntity(map));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(0));
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(0));
|
||||
Assert.That(entMan.Count<MapComponent>(), Is.EqualTo(0));
|
||||
}
|
||||
|
||||
private const string MapDataV4Grid = @"
|
||||
|
||||
@@ -6,6 +6,7 @@ using Robust.Shared.EntitySerialization.Components;
|
||||
using Robust.Shared.EntitySerialization.Systems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Utility;
|
||||
using static Robust.UnitTesting.Shared.EntitySerialization.EntitySaveTestComponent;
|
||||
|
||||
@@ -47,7 +48,7 @@ public sealed partial class BackwardsCompatibilityTest
|
||||
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(0));
|
||||
await server.WaitPost(() => mapUid = mapSys.CreateMap(out mapId));
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadGrid(mapId, gridPath, out _)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadGrid(mapId, gridPath, out _)));
|
||||
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(0));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(2));
|
||||
@@ -73,7 +74,7 @@ public sealed partial class BackwardsCompatibilityTest
|
||||
|
||||
var mapPath = new ResPath($"{nameof(MapDataV5Map)}.yml");
|
||||
resourceManager.MountString(mapPath.ToString(), MapDataV5Map);
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadMap(mapPath, out _, out _)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadMap(mapPath, out _, out _)));
|
||||
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(1));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(3));
|
||||
@@ -107,7 +108,7 @@ public sealed partial class BackwardsCompatibilityTest
|
||||
resourceManager.MountString(mapPath2.ToString(), MapDataV5Map);
|
||||
|
||||
var opts = DeserializationOptions.Default with {InitializeMaps = true};
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadMap(mapPath2, out _, out _, opts)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadMap(mapPath2, out _, out _, opts)));
|
||||
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(1));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(3));
|
||||
@@ -133,6 +134,8 @@ public sealed partial class BackwardsCompatibilityTest
|
||||
|
||||
await server.WaitPost(() => entMan.DeleteEntity(map));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(0));
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(0));
|
||||
Assert.That(entMan.Count<MapComponent>(), Is.EqualTo(0));
|
||||
}
|
||||
|
||||
private const string MapDataV5Grid = @"
|
||||
|
||||
@@ -6,6 +6,7 @@ using Robust.Shared.EntitySerialization.Components;
|
||||
using Robust.Shared.EntitySerialization.Systems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Utility;
|
||||
using static Robust.UnitTesting.Shared.EntitySerialization.EntitySaveTestComponent;
|
||||
|
||||
@@ -47,7 +48,7 @@ public sealed partial class BackwardsCompatibilityTest
|
||||
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(0));
|
||||
await server.WaitPost(() => mapUid = mapSys.CreateMap(out mapId));
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadGrid(mapId, gridPath, out _)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadGrid(mapId, gridPath, out _)));
|
||||
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(0));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(2));
|
||||
@@ -73,7 +74,7 @@ public sealed partial class BackwardsCompatibilityTest
|
||||
|
||||
var mapPath = new ResPath($"{nameof(MapDataV6Map)}.yml");
|
||||
resourceManager.MountString(mapPath.ToString(), MapDataV6Map);
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadMap(mapPath, out _, out _)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadMap(mapPath, out _, out _)));
|
||||
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(1));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(3));
|
||||
@@ -107,7 +108,7 @@ public sealed partial class BackwardsCompatibilityTest
|
||||
resourceManager.MountString(mapPath2.ToString(), MapDataV6Map);
|
||||
|
||||
var opts = DeserializationOptions.Default with {InitializeMaps = true};
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadMap(mapPath2, out _, out _, opts)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadMap(mapPath2, out _, out _, opts)));
|
||||
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(1));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(3));
|
||||
@@ -133,6 +134,8 @@ public sealed partial class BackwardsCompatibilityTest
|
||||
|
||||
await server.WaitPost(() => entMan.DeleteEntity(map));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(0));
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(0));
|
||||
Assert.That(entMan.Count<MapComponent>(), Is.EqualTo(0));
|
||||
}
|
||||
|
||||
private const string MapDataV6Grid = @"
|
||||
|
||||
@@ -6,6 +6,7 @@ using Robust.Shared.EntitySerialization.Components;
|
||||
using Robust.Shared.EntitySerialization.Systems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Utility;
|
||||
using static Robust.UnitTesting.Shared.EntitySerialization.EntitySaveTestComponent;
|
||||
|
||||
@@ -41,8 +42,8 @@ public sealed partial class BackwardsCompatibilityTest : RobustIntegrationTest
|
||||
tileMan.Register(new TileDef("a"));
|
||||
|
||||
void AssertCount(int expected) => Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(expected));
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(0));
|
||||
|
||||
await server.WaitPost(() => mapSys.CreateMap(out _));
|
||||
var mapLoadOpts = MapLoadOptions.Default with
|
||||
{
|
||||
DeserializationOptions = DeserializationOptions.Default with {LogOrphanedGrids = false}
|
||||
@@ -85,6 +86,7 @@ public sealed partial class BackwardsCompatibilityTest : RobustIntegrationTest
|
||||
await server.WaitPost(() => entMan.DeleteEntity(grid.Comp1.ParentUid));
|
||||
await server.WaitPost(() => entMan.DeleteEntity(nullSpace));
|
||||
AssertCount(0);
|
||||
await server.WaitPost(() => loader.Delete(result));
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +106,7 @@ public sealed partial class BackwardsCompatibilityTest : RobustIntegrationTest
|
||||
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(0));
|
||||
LoadResult? result = default;
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadGeneric(pathLifestage, out result)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadGeneric(pathLifestage, out result)));
|
||||
Assert.That(result!.Version, Is.EqualTo(7));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(8));
|
||||
|
||||
@@ -140,7 +142,13 @@ public sealed partial class BackwardsCompatibilityTest : RobustIntegrationTest
|
||||
: Is.EqualTo(EntityLifeStage.MapInitialized));
|
||||
}
|
||||
}
|
||||
|
||||
await server.WaitPost(() => loader.Delete(result));
|
||||
}
|
||||
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(0));
|
||||
Assert.That(entMan.Count<LoadedMapComponent>(), Is.EqualTo(0));
|
||||
Assert.That(entMan.Count<MapComponent>(), Is.EqualTo(0));
|
||||
}
|
||||
|
||||
private const string MapDataV7 = @"
|
||||
|
||||
@@ -20,7 +20,7 @@ public sealed partial class CategorizationTest : RobustIntegrationTest
|
||||
[TestOf(typeof(FileCategory))]
|
||||
public async Task TestCategorization()
|
||||
{
|
||||
var server = StartServer();
|
||||
var server = StartServer(new() {Pool = false}); // Pool=false due to TileDef registration
|
||||
await server.WaitIdleAsync();
|
||||
var entMan = server.EntMan;
|
||||
var meta = server.System<MetaDataSystem>();
|
||||
@@ -76,7 +76,7 @@ public sealed partial class CategorizationTest : RobustIntegrationTest
|
||||
DeserializationOptions = DeserializationOptions.Default with { LogOrphanedGrids = false}
|
||||
};
|
||||
LoadResult? result = null;
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadGeneric(path, out result, opts)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadGeneric(path, out result, opts)));
|
||||
Assert.That(result!.Category, Is.EqualTo(expected));
|
||||
Assert.That(result.Entities, Has.Count.EqualTo(count));
|
||||
return result;
|
||||
|
||||
@@ -87,7 +87,7 @@ public sealed partial class LifestageSerializationTest : RobustIntegrationTest
|
||||
async Task Load(ResPath f, DeserializationOptions? o)
|
||||
{
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(0));
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadMap(f, out _, out _, o)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadMap(f, out _, out _, o)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(5));
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ public sealed partial class LifestageSerializationTest : RobustIntegrationTest
|
||||
{
|
||||
DeserializationOptions = o ?? DeserializationOptions.Default
|
||||
};
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadGeneric(f, out _, oo)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadGeneric(f, out _, oo)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(8));
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public sealed partial class MapMergeTest : RobustIntegrationTest
|
||||
[Test]
|
||||
public async Task TestMapMerge()
|
||||
{
|
||||
var server = StartServer();
|
||||
var server = StartServer(new() {Pool = false}); // Pool=false due to TileDef registration
|
||||
await server.WaitIdleAsync();
|
||||
var entMan = server.EntMan;
|
||||
var mapSys = server.System<SharedMapSystem>();
|
||||
@@ -77,8 +77,8 @@ public sealed partial class MapMergeTest : RobustIntegrationTest
|
||||
AssertPreInit(grid);
|
||||
|
||||
// Save then delete everything
|
||||
Assert.That(loader.TrySaveMap(map, mapPath));
|
||||
Assert.That(loader.TrySaveGrid(grid, gridPath));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TrySaveMap(map, mapPath)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TrySaveGrid(grid, gridPath)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(3));
|
||||
await server.WaitPost(() => mapSys.DeleteMap(mapId));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(0));
|
||||
@@ -87,7 +87,7 @@ public sealed partial class MapMergeTest : RobustIntegrationTest
|
||||
await server.WaitPost(() => mapSys.CreateMap(out mapId, runMapInit: false));
|
||||
Assert.That(mapSys.IsInitialized(mapId), Is.False);
|
||||
Assert.That(mapSys.IsPaused(mapId), Is.True);
|
||||
Assert.That(loader.TryLoadGrid(mapId, gridPath, out _));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadGrid(mapId, gridPath, out _)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(1));
|
||||
grid = Find(nameof(grid), entMan);
|
||||
AssertPaused(grid);
|
||||
@@ -99,7 +99,7 @@ public sealed partial class MapMergeTest : RobustIntegrationTest
|
||||
await server.WaitPost(() => mapSys.CreateMap(out mapId, runMapInit: false));
|
||||
Assert.That(mapSys.IsInitialized(mapId), Is.False);
|
||||
Assert.That(mapSys.IsPaused(mapId), Is.True);
|
||||
Assert.That(loader.TryMergeMap(mapId, mapPath, out _));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryMergeMap(mapId, mapPath, out _)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(2)); // The loaded map entity gets deleted after merging
|
||||
ent = Find(nameof(ent), entMan);
|
||||
grid = Find(nameof(grid), entMan);
|
||||
@@ -114,7 +114,7 @@ public sealed partial class MapMergeTest : RobustIntegrationTest
|
||||
await server.WaitPost(() => mapSys.CreateMap(out mapId, runMapInit: true));
|
||||
Assert.That(mapSys.IsInitialized(mapId), Is.True);
|
||||
Assert.That(mapSys.IsPaused(mapId), Is.False);
|
||||
Assert.That(loader.TryLoadGrid(mapId, gridPath, out _));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadGrid(mapId, gridPath, out _)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(1));
|
||||
grid = Find(nameof(grid), entMan);
|
||||
AssertPaused(grid, false);
|
||||
@@ -126,7 +126,7 @@ public sealed partial class MapMergeTest : RobustIntegrationTest
|
||||
await server.WaitPost(() => mapSys.CreateMap(out mapId, runMapInit: true));
|
||||
Assert.That(mapSys.IsInitialized(mapId), Is.True);
|
||||
Assert.That(mapSys.IsPaused(mapId), Is.False);
|
||||
Assert.That(loader.TryMergeMap(mapId, mapPath, out _));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryMergeMap(mapId, mapPath, out _)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(2));
|
||||
ent = Find(nameof(ent), entMan);
|
||||
grid = Find(nameof(grid), entMan);
|
||||
@@ -142,7 +142,7 @@ public sealed partial class MapMergeTest : RobustIntegrationTest
|
||||
await server.WaitPost(() => mapSys.SetPaused(mapId, true));
|
||||
Assert.That(mapSys.IsInitialized(mapId), Is.True);
|
||||
Assert.That(mapSys.IsPaused(mapId), Is.True);
|
||||
Assert.That(loader.TryLoadGrid(mapId, gridPath, out _));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadGrid(mapId, gridPath, out _)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(1));
|
||||
grid = Find(nameof(grid), entMan);
|
||||
AssertPaused(grid);
|
||||
@@ -155,7 +155,7 @@ public sealed partial class MapMergeTest : RobustIntegrationTest
|
||||
await server.WaitPost(() => mapSys.SetPaused(mapId, true));
|
||||
Assert.That(mapSys.IsInitialized(mapId), Is.True);
|
||||
Assert.That(mapSys.IsPaused(mapId), Is.True);
|
||||
Assert.That(loader.TryMergeMap(mapId, mapPath, out _));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryMergeMap(mapId, mapPath, out _)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(2));
|
||||
ent = Find(nameof(ent), entMan);
|
||||
grid = Find(nameof(grid), entMan);
|
||||
@@ -175,7 +175,7 @@ public sealed partial class MapMergeTest : RobustIntegrationTest
|
||||
Assert.That(mapSys.IsInitialized(mapId), Is.False);
|
||||
Assert.That(mapSys.IsPaused(mapId), Is.True);
|
||||
var opts = DeserializationOptions.Default with {InitializeMaps = true};
|
||||
Assert.That(loader.TryLoadGrid(mapId, gridPath, out _, opts));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadGrid(mapId, gridPath, out _, opts)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(1));
|
||||
grid = Find(nameof(grid), entMan);
|
||||
AssertPaused(grid);
|
||||
@@ -188,7 +188,7 @@ public sealed partial class MapMergeTest : RobustIntegrationTest
|
||||
Assert.That(mapSys.IsInitialized(mapId), Is.False);
|
||||
Assert.That(mapSys.IsPaused(mapId), Is.True);
|
||||
opts = DeserializationOptions.Default with {InitializeMaps = true};
|
||||
Assert.That(loader.TryMergeMap(mapId, mapPath, out _));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryMergeMap(mapId, mapPath, out _, opts)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(2)); // The loaded map entity gets deleted after merging
|
||||
ent = Find(nameof(ent), entMan);
|
||||
grid = Find(nameof(grid), entMan);
|
||||
@@ -204,7 +204,7 @@ public sealed partial class MapMergeTest : RobustIntegrationTest
|
||||
Assert.That(mapSys.IsInitialized(mapId), Is.True);
|
||||
Assert.That(mapSys.IsPaused(mapId), Is.False);
|
||||
opts = DeserializationOptions.Default with {PauseMaps = true};
|
||||
Assert.That(loader.TryLoadGrid(mapId, gridPath, out _));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadGrid(mapId, gridPath, out _, opts)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(1));
|
||||
grid = Find(nameof(grid), entMan);
|
||||
AssertPaused(grid, false);
|
||||
@@ -217,7 +217,7 @@ public sealed partial class MapMergeTest : RobustIntegrationTest
|
||||
Assert.That(mapSys.IsInitialized(mapId), Is.True);
|
||||
Assert.That(mapSys.IsPaused(mapId), Is.False);
|
||||
opts = DeserializationOptions.Default with {PauseMaps = true};
|
||||
Assert.That(loader.TryMergeMap(mapId, mapPath, out _));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryMergeMap(mapId, mapPath, out _, opts)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(2));
|
||||
ent = Find(nameof(ent), entMan);
|
||||
grid = Find(nameof(grid), entMan);
|
||||
|
||||
@@ -69,7 +69,7 @@ public sealed partial class OrphanSerializationTest : RobustIntegrationTest
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(0));
|
||||
|
||||
// Load in the file containing only entA.
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadEntity(pathA, out _)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadEntity(pathA, out _)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(1));
|
||||
entA = Find(nameof(entA), entMan);
|
||||
Assert.That(entA.Comp1!.ParentUid, Is.EqualTo(EntityUid.Invalid));
|
||||
@@ -77,7 +77,7 @@ public sealed partial class OrphanSerializationTest : RobustIntegrationTest
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(0));
|
||||
|
||||
// Load in the file containing entB and its child
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadEntity(pathB, out _)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadEntity(pathB, out _)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(2));
|
||||
entB = Find(nameof(entB), entMan);
|
||||
child = Find(nameof(child), entMan);
|
||||
@@ -92,7 +92,7 @@ public sealed partial class OrphanSerializationTest : RobustIntegrationTest
|
||||
|
||||
// Load the file that contains both of them
|
||||
LoadResult? result = null;
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadGeneric(pathCombined, out result)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadGeneric(pathCombined, out result)));
|
||||
Assert.That(result!.Category, Is.EqualTo(FileCategory.Unknown));
|
||||
Assert.That(result.Orphans, Has.Count.EqualTo(2));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(3));
|
||||
@@ -114,7 +114,7 @@ public sealed partial class OrphanSerializationTest : RobustIntegrationTest
|
||||
[Test]
|
||||
public async Task TestOrphanedGridSerialization()
|
||||
{
|
||||
var server = StartServer();
|
||||
var server = StartServer(new() {Pool = false}); // Pool=false due to TileDef registration
|
||||
await server.WaitIdleAsync();
|
||||
var entMan = server.EntMan;
|
||||
var mapSys = server.System<SharedMapSystem>();
|
||||
@@ -169,9 +169,10 @@ public sealed partial class OrphanSerializationTest : RobustIntegrationTest
|
||||
Assert.That(map.Comp1!.ParentUid, Is.EqualTo(EntityUid.Invalid));
|
||||
|
||||
// Save the grids without their map
|
||||
Assert.That(loader.TrySaveGrid(gridA, pathA));
|
||||
Assert.That(loader.TrySaveGrid(gridB, pathB));
|
||||
Assert.That(loader.TrySaveGeneric([gridA.Owner, gridB.Owner], pathCombined, out var cat));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TrySaveGrid(gridA, pathA)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TrySaveGrid(gridB, pathB)));
|
||||
FileCategory cat = default;
|
||||
await server.WaitAssertion(() => Assert.That(loader.TrySaveGeneric([gridA.Owner, gridB.Owner], pathCombined, out cat)));
|
||||
Assert.That(cat, Is.EqualTo(FileCategory.Unknown));
|
||||
|
||||
// Delete all the entities.
|
||||
@@ -182,7 +183,7 @@ public sealed partial class OrphanSerializationTest : RobustIntegrationTest
|
||||
// Load in the file containing only gridA.
|
||||
EntityUid newMap = default;
|
||||
await server.WaitPost(() => newMap = mapSys.CreateMap(out mapId));
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadGrid(mapId, pathA, out _)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadGrid(mapId, pathA, out _)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(1));
|
||||
gridA = Find(nameof(gridA), entMan);
|
||||
Assert.That(gridA.Comp1.LocalPosition, Is.Approximately(new Vector2(100, 100)));
|
||||
@@ -192,7 +193,7 @@ public sealed partial class OrphanSerializationTest : RobustIntegrationTest
|
||||
|
||||
// Load in the file containing gridB and its child
|
||||
await server.WaitPost(() => newMap = mapSys.CreateMap(out mapId));
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadGrid(mapId, pathB, out _)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadGrid(mapId, pathB, out _)));
|
||||
Assert.That(entMan.Count<EntitySaveTestComponent>(), Is.EqualTo(2));
|
||||
gridB = Find(nameof(gridB), entMan);
|
||||
child = Find(nameof(child), entMan);
|
||||
@@ -208,7 +209,7 @@ public sealed partial class OrphanSerializationTest : RobustIntegrationTest
|
||||
{
|
||||
DeserializationOptions = DeserializationOptions.Default with {LogOrphanedGrids = false}
|
||||
};
|
||||
await server.WaitPost(() => Assert.That(loader.TryLoadGeneric(pathCombined, out result, opts)));
|
||||
await server.WaitAssertion(() => Assert.That(loader.TryLoadGeneric(pathCombined, out result, opts)));
|
||||
Assert.That(result!.Category, Is.EqualTo(FileCategory.Unknown));
|
||||
Assert.That(result.Grids, Has.Count.EqualTo(2));
|
||||
Assert.That(result.Maps, Has.Count.EqualTo(2));
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Timing;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.EntitySerialization.Systems;
|
||||
@@ -34,7 +33,6 @@ namespace Robust.UnitTesting.Shared.GameObjects
|
||||
var cEntManager = client.ResolveDependency<IEntityManager>();
|
||||
var clientNetManager = client.ResolveDependency<IClientNetManager>();
|
||||
|
||||
var sMapManager = server.ResolveDependency<IMapManager>();
|
||||
var sEntManager = server.ResolveDependency<IEntityManager>();
|
||||
var sPlayerManager = server.ResolveDependency<IPlayerManager>();
|
||||
|
||||
@@ -140,6 +138,10 @@ namespace Robust.UnitTesting.Shared.GameObjects
|
||||
Assert.That(!cContainerSys.ExpectedEntities.ContainsKey(sEntManager.GetNetEntity(itemUid)));
|
||||
Assert.That(cContainerSys.ExpectedEntities, Is.Empty);
|
||||
});
|
||||
|
||||
await client.WaitPost(() => clientNetManager.ClientDisconnect(""));
|
||||
await server.WaitRunTicks(5);
|
||||
await client.WaitRunTicks(5);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -279,6 +281,10 @@ namespace Robust.UnitTesting.Shared.GameObjects
|
||||
Assert.That(!cContainerSys.ExpectedEntities.ContainsKey(netEnt));
|
||||
Assert.That(cContainerSys.ExpectedEntities.Count, Is.EqualTo(0));
|
||||
});
|
||||
|
||||
await client.WaitPost(() => clientNetManager.ClientDisconnect(""));
|
||||
await server.WaitRunTicks(5);
|
||||
await client.WaitRunTicks(5);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -138,6 +138,10 @@ public sealed partial class ComponentStateTests : RobustIntegrationTest
|
||||
await client!.WaitRunTicks(1);
|
||||
}
|
||||
}
|
||||
|
||||
await client.WaitPost(() => netMan.ClientDisconnect(""));
|
||||
await server.WaitRunTicks(5);
|
||||
await client.WaitRunTicks(5);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -276,6 +280,10 @@ public sealed partial class ComponentStateTests : RobustIntegrationTest
|
||||
await client!.WaitRunTicks(1);
|
||||
}
|
||||
}
|
||||
|
||||
await client.WaitPost(() => netMan.ClientDisconnect(""));
|
||||
await server.WaitRunTicks(5);
|
||||
await client.WaitRunTicks(5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,10 +57,10 @@ public sealed class DeletionNetworkingTests : RobustIntegrationTest
|
||||
EntityUid grid2 = default;
|
||||
NetEntity grid1Net = default;
|
||||
NetEntity grid2Net = default;
|
||||
mapSys.CreateMap(out var mapId);
|
||||
|
||||
await server.WaitPost(() =>
|
||||
{
|
||||
mapSys.CreateMap(out var mapId);
|
||||
var gridComp = mapMan.CreateGridEntity(mapId);
|
||||
mapSys.SetTile(gridComp, Vector2i.Zero, new Tile(1));
|
||||
grid1 = gridComp.Owner;
|
||||
@@ -216,6 +216,10 @@ public sealed class DeletionNetworkingTests : RobustIntegrationTest
|
||||
// Was never explicitly deleted by the client.
|
||||
Assert.That(cEntMan.EntityExists(clientChildA));
|
||||
});
|
||||
|
||||
await client.WaitPost(() => netMan.ClientDisconnect(""));
|
||||
await server.WaitRunTicks(5);
|
||||
await client.WaitRunTicks(5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,10 @@ public sealed partial class NoSharedReferencesTest : RobustIntegrationTest
|
||||
await client.WaitRunTicks(1);
|
||||
}
|
||||
}
|
||||
|
||||
await client.WaitPost(() => netMan.ClientDisconnect(""));
|
||||
await server.WaitRunTicks(5);
|
||||
await client.WaitRunTicks(5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ public sealed class GridDeleteSingleTileRemoveTestTest : RobustIntegrationTest
|
||||
var sEntMan = server.ResolveDependency<IEntityManager>();
|
||||
var confMan = server.ResolveDependency<IConfigurationManager>();
|
||||
var sPlayerMan = server.ResolveDependency<ISharedPlayerManager>();
|
||||
var xforms = sEntMan.System<SharedTransformSystem>();
|
||||
var stateMan = (ClientGameStateManager) client.ResolveDependency<IClientGameStateManager>();
|
||||
|
||||
var cEntMan = client.ResolveDependency<IEntityManager>();
|
||||
var netMan = client.ResolveDependency<IClientNetManager>();
|
||||
@@ -135,5 +133,9 @@ public sealed class GridDeleteSingleTileRemoveTestTest : RobustIntegrationTest
|
||||
// Entity should now be parented to the map
|
||||
Assert.That(sQuery.GetComponent(sEntity).ParentUid, Is.EqualTo(sMap));
|
||||
Assert.That(cQuery.GetComponent(cEntity.Value).ParentUid, Is.EqualTo(cMap));
|
||||
|
||||
await client.WaitPost(() => netMan.ClientDisconnect(""));
|
||||
await server.WaitRunTicks(5);
|
||||
await client.WaitRunTicks(5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,10 @@ public sealed class DisconnectTest : RobustIntegrationTest
|
||||
await client.WaitRunTicks(1);
|
||||
}
|
||||
}
|
||||
|
||||
await client.WaitPost(() => cNetMan.ClientDisconnect(""));
|
||||
await server.WaitRunTicks(5);
|
||||
await client.WaitRunTicks(5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -162,6 +162,10 @@ public sealed class BroadphaseNetworkingTest : RobustIntegrationTest
|
||||
Assert.That(cPlayerXform.Broadphase?.Static, Is.EqualTo(broadphase.Static));
|
||||
Assert.That(cPlayerXform.Broadphase?.CanCollide, Is.EqualTo(broadphase.CanCollide));
|
||||
Assert.That(sPlayerXform.Broadphase, Is.EqualTo(broadphase));
|
||||
|
||||
await client.WaitPost(() => netMan.ClientDisconnect(""));
|
||||
await server.WaitRunTicks(5);
|
||||
await client.WaitRunTicks(5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -397,6 +397,10 @@ public sealed class CollisionPredictionTest : RobustIntegrationTest
|
||||
Assert.That(sSys.CollisionEnded, Is.False);
|
||||
Assert.That(cSys.CollisionEnded, Is.False);
|
||||
}
|
||||
|
||||
await client.WaitPost(() => netMan.ClientDisconnect(""));
|
||||
await server.WaitRunTicks(5);
|
||||
await client.WaitRunTicks(5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,6 +117,5 @@ public sealed class SpawnInContainerOrDropTest : EntitySpawnHelpersTest
|
||||
});
|
||||
|
||||
await Server.WaitPost(() => MapSys.DeleteMap(MapId));
|
||||
Server.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +122,5 @@ public sealed class SpawnNextToOrDropTest : EntitySpawnHelpersTest
|
||||
});
|
||||
|
||||
await Server.WaitPost(() => MapSys.DeleteMap(MapId));
|
||||
Server.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,5 @@ public sealed class TrySpawnInContainerTest : EntitySpawnHelpersTest
|
||||
});
|
||||
|
||||
await Server.WaitPost(() => MapSys.DeleteMap(MapId));
|
||||
Server.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,5 @@ public sealed class TrySpawnNextToTest : EntitySpawnHelpersTest
|
||||
});
|
||||
|
||||
await Server.WaitPost(() => MapSys.DeleteMap(MapId));
|
||||
Server.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@ public abstract class ToolshedTest : RobustIntegrationTest, IInvocationContext
|
||||
{
|
||||
protected virtual bool AssertOnUnexpectedError => true;
|
||||
|
||||
#pragma warning disable NUnit1032
|
||||
protected ServerIntegrationInstance Server = default!;
|
||||
#pragma warning restore NUnit1032
|
||||
|
||||
public ToolshedManager Toolshed { get; private set; } = default!;
|
||||
public ToolshedEnvironment Environment => Toolshed.DefaultEnvironment;
|
||||
@@ -30,7 +32,8 @@ public abstract class ToolshedTest : RobustIntegrationTest, IInvocationContext
|
||||
public async Task TearDownInternal()
|
||||
{
|
||||
await TearDown();
|
||||
Server.Dispose();
|
||||
await ReturnToPool(Server);
|
||||
Server = default!;
|
||||
}
|
||||
|
||||
protected virtual Task TearDown()
|
||||
|
||||
Reference in New Issue
Block a user