Make integration tests use an empty map instead of saltern by default (#3094)
This commit is contained in:
@@ -80,6 +80,9 @@ namespace Content.IntegrationTests
|
||||
// Avoid funny race conditions with the database.
|
||||
options.CVarOverrides[CCVars.DatabaseSynchronous.Name] = "true";
|
||||
|
||||
// Avoid loading a large map by default for integration tests.
|
||||
options.CVarOverrides[CCVars.GameMap.Name] = "Maps/Test/empty.yml";
|
||||
|
||||
return base.StartServer(options);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ using Content.Server.GameObjects.Components.Strap;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Body.Part;
|
||||
using Content.Shared.GameObjects.Components.Buckle;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||
using Content.Shared.GameObjects.EntitySystems.EffectBlocker;
|
||||
using Content.Shared.Utility;
|
||||
@@ -45,7 +44,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
public async Task BuckleUnbuckleCooldownRangeTest()
|
||||
{
|
||||
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES};
|
||||
var server = StartServerDummyTicker(options);
|
||||
var server = StartServer(options);
|
||||
|
||||
IEntity human = null;
|
||||
IEntity chair = null;
|
||||
@@ -55,13 +54,14 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
mapManager.CreateNewMapEntity(MapId.Nullspace);
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
human = entityManager.SpawnEntity("BuckleDummy", MapCoordinates.Nullspace);
|
||||
chair = entityManager.SpawnEntity("StrapDummy", MapCoordinates.Nullspace);
|
||||
var gridId = new GridId(1);
|
||||
var grid = mapManager.GetGrid(gridId);
|
||||
var coordinates = grid.GridEntityId.ToCoordinates();
|
||||
|
||||
human = entityManager.SpawnEntity("BuckleDummy", coordinates);
|
||||
chair = entityManager.SpawnEntity("StrapDummy", coordinates);
|
||||
|
||||
// Default state, unbuckled
|
||||
Assert.True(human.TryGetComponent(out buckle));
|
||||
@@ -197,31 +197,24 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES};
|
||||
var server = StartServer(options);
|
||||
|
||||
IEntity human;
|
||||
IEntity chair;
|
||||
IEntity human = null;
|
||||
BuckleComponent buckle = null;
|
||||
HandsComponent hands = null;
|
||||
IBody body = null;
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
var mapId = new MapId(1);
|
||||
mapManager.CreateNewMapEntity(mapId);
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var gridId = new GridId(1);
|
||||
var grid = mapManager.CreateGrid(mapId, gridId);
|
||||
var coordinates = grid.GridEntityId.ToCoordinates();
|
||||
var tileManager = IoCManager.Resolve<ITileDefinitionManager>();
|
||||
var tileId = tileManager["underplating"].TileId;
|
||||
var tile = new Tile(tileId);
|
||||
|
||||
grid.SetTile(coordinates, tile);
|
||||
var gridId = new GridId(1);
|
||||
var grid = mapManager.GetGrid(gridId);
|
||||
var coordinates = grid.GridEntityId.ToCoordinates();
|
||||
|
||||
human = entityManager.SpawnEntity("BuckleDummy", coordinates);
|
||||
chair = entityManager.SpawnEntity("StrapDummy", coordinates);
|
||||
IEntity chair = entityManager.SpawnEntity("StrapDummy", coordinates);
|
||||
|
||||
// Component sanity check
|
||||
Assert.True(human.TryGetComponent(out buckle));
|
||||
@@ -279,6 +272,8 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
{
|
||||
Assert.Null(hands.GetItem(slot));
|
||||
}
|
||||
|
||||
buckle.TryUnbuckle(human, true);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -295,19 +290,11 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
var mapId = new MapId(1);
|
||||
mapManager.CreateNewMapEntity(mapId);
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var gridId = new GridId(1);
|
||||
var grid = mapManager.CreateGrid(mapId, gridId);
|
||||
var coordinates = grid.GridEntityId.ToCoordinates();
|
||||
var tileManager = IoCManager.Resolve<ITileDefinitionManager>();
|
||||
var tileId = tileManager["underplating"].TileId;
|
||||
var tile = new Tile(tileId);
|
||||
|
||||
grid.SetTile(coordinates, tile);
|
||||
var gridId = new GridId(1);
|
||||
var grid = mapManager.GetGrid(gridId);
|
||||
var coordinates = grid.GridEntityId.ToCoordinates();
|
||||
|
||||
human = entityManager.SpawnEntity("BuckleDummy", coordinates);
|
||||
chair = entityManager.SpawnEntity("StrapDummy", coordinates);
|
||||
|
||||
@@ -16,7 +16,6 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
[TestOf(typeof(ServerAlertsComponent))]
|
||||
public class AlertsComponentTests : ContentIntegrationTest
|
||||
{
|
||||
|
||||
[Test]
|
||||
public async Task AlertsTest()
|
||||
{
|
||||
@@ -61,11 +60,11 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
Assert.NotNull(alertsUI);
|
||||
|
||||
// we should be seeing 3 alerts - our health, and the 2 debug alerts, in a specific order.
|
||||
Assert.That(alertsUI.Grid.ChildCount, Is.EqualTo(3));
|
||||
var alertControls = alertsUI.Grid.Children.Select(c => c as AlertControl);
|
||||
Assert.That(alertsUI.Grid.ChildCount, Is.GreaterThanOrEqualTo(3));
|
||||
var alertControls = alertsUI.Grid.Children.Select(c => (AlertControl) c);
|
||||
var alertIDs = alertControls.Select(ac => ac.Alert.AlertType).ToArray();
|
||||
var expectedIDs = new [] {AlertType.HumanHealth, AlertType.Debug1, AlertType.Debug2};
|
||||
Assert.That(alertIDs, Is.EqualTo(expectedIDs));
|
||||
Assert.That(alertIDs, Is.SupersetOf(expectedIDs));
|
||||
});
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
@@ -96,12 +95,12 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
clientUIMgr.StateRoot.Children.FirstOrDefault(c => c is AlertsUI) as AlertsUI;
|
||||
Assert.NotNull(alertsUI);
|
||||
|
||||
// we should be seeing only 2 alerts now because one was cleared
|
||||
Assert.That(alertsUI.Grid.ChildCount, Is.EqualTo(2));
|
||||
var alertControls = alertsUI.Grid.Children.Select(c => c as AlertControl);
|
||||
// we should be seeing 2 alerts now because one was cleared
|
||||
Assert.That(alertsUI.Grid.ChildCount, Is.GreaterThanOrEqualTo(2));
|
||||
var alertControls = alertsUI.Grid.Children.Select(c => (AlertControl) c);
|
||||
var alertIDs = alertControls.Select(ac => ac.Alert.AlertType).ToArray();
|
||||
var expectedIDs = new [] {AlertType.HumanHealth, AlertType.Debug2};
|
||||
Assert.That(alertIDs, Is.EqualTo(expectedIDs));
|
||||
Assert.That(alertIDs, Is.SupersetOf(expectedIDs));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Content.Server.GameObjects.Components.Gravity;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.GameObjects.Components.Gravity;
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Utility;
|
||||
@@ -45,10 +44,7 @@ namespace Content.IntegrationTests.Tests.Gravity
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var mapId = mapManager.CreateMap();
|
||||
|
||||
pauseManager.AddUninitializedMap(mapId);
|
||||
|
||||
var mapId = new MapId(1);
|
||||
var gridId = new GridId(1);
|
||||
|
||||
if (!mapManager.TryGetGrid(gridId, out var grid))
|
||||
@@ -56,14 +52,7 @@ namespace Content.IntegrationTests.Tests.Gravity
|
||||
grid = mapManager.CreateGrid(mapId, gridId);
|
||||
}
|
||||
|
||||
var tileDefinition = tileDefinitionManager["underplating"];
|
||||
var tile = new Tile(tileDefinition.TileId);
|
||||
var coordinates = grid.ToCoordinates();
|
||||
|
||||
grid.SetTile(coordinates, tile);
|
||||
|
||||
pauseManager.DoMapInitialize(mapId);
|
||||
|
||||
human = entityManager.SpawnEntity("HumanDummy", coordinates);
|
||||
|
||||
Assert.True(human.TryGetComponent(out alerts));
|
||||
@@ -98,7 +87,7 @@ namespace Content.IntegrationTests.Tests.Gravity
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
Assert.False(alerts.IsShowingAlert(AlertType.Weightless));
|
||||
Assert.True(alerts.IsShowingAlert(AlertType.Weightless));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user