Fix tests (#3707)
* First pass * Fix access and rename banananium to bananium * Fix captialization of CookTimeInfoLabel * Fix InteractUsing calls * Remove unused [Dependency] * Replace obsolete references to Anchored with BodyType * Assign default value to shoving someone in disposals * Fix naming * Replace Initialize TryGetComponents with EnsureComponent * Rework AnchorableComponent * Fix singularity component * Replace obsolete usages of Angle.South * Fix efcore warning * Fix container tests * Fix DebugPressurePump invalid PressurePump yaml * Fix getting pathfinding region of grid 0 * Fix atmos plaque missing layer and add info message when it happens * Fix AiSteeringSystem steering in an invalid grid in entity test * Make content able to choose which log level leads to test failures * Revert container test fix for Acruid * Fix sprite, pipe and saving errors Make EntityTest print all errors instead of stopping on the first * Reorder singularity visualizer * Disable pvs for container occlusion adn simple predict reconcile, they use entities other than map ones Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com> Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using NUnit.Framework;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
@@ -37,15 +37,31 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
private async Task<(ClientIntegrationInstance c, ServerIntegrationInstance s)> Start()
|
||||
{
|
||||
var optsServer = new ServerIntegrationOptions {ExtraPrototypes = ExtraPrototypes};
|
||||
var optsClient = new ClientIntegrationOptions {ExtraPrototypes = ExtraPrototypes};
|
||||
var optsServer = new ServerIntegrationOptions
|
||||
{
|
||||
CVarOverrides =
|
||||
{
|
||||
{CVars.NetPVS.Name, "false"}
|
||||
},
|
||||
ExtraPrototypes = ExtraPrototypes
|
||||
};
|
||||
var optsClient = new ClientIntegrationOptions
|
||||
{
|
||||
|
||||
CVarOverrides =
|
||||
{
|
||||
{CVars.NetPVS.Name, "false"}
|
||||
},
|
||||
ExtraPrototypes = ExtraPrototypes
|
||||
};
|
||||
|
||||
var (c, s) = await StartConnectedServerDummyTickerClientPair(optsClient, optsServer);
|
||||
|
||||
s.Post(() =>
|
||||
{
|
||||
IoCManager.Resolve<IPlayerManager>()
|
||||
.GetAllPlayers().Single()
|
||||
.GetAllPlayers()
|
||||
.Single()
|
||||
.JoinGame();
|
||||
|
||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
@@ -71,19 +71,22 @@ namespace Content.IntegrationTests.Tests
|
||||
prototypes.Add(prototype);
|
||||
}
|
||||
|
||||
//Iterate list of prototypes to spawn
|
||||
foreach (var prototype in prototypes)
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.DoesNotThrow(() =>
|
||||
{
|
||||
Logger.LogS(LogLevel.Debug, "EntityTest", $"Testing: {prototype.ID}");
|
||||
testEntity = entityMan.SpawnEntity(prototype.ID, testLocation);
|
||||
server.RunTicks(2);
|
||||
Assert.That(testEntity.Initialized);
|
||||
entityMan.DeleteEntity(testEntity.Uid);
|
||||
}, "Entity '{0}' threw an exception.",
|
||||
prototype.ID);
|
||||
}
|
||||
//Iterate list of prototypes to spawn
|
||||
foreach (var prototype in prototypes)
|
||||
{
|
||||
Assert.DoesNotThrow(() =>
|
||||
{
|
||||
Logger.LogS(LogLevel.Debug, "EntityTest", $"Testing: {prototype.ID}");
|
||||
testEntity = entityMan.SpawnEntity(prototype.ID, testLocation);
|
||||
server.RunTicks(2);
|
||||
Assert.That(testEntity.Initialized);
|
||||
entityMan.DeleteEntity(testEntity.Uid);
|
||||
}, "Entity '{0}' threw an exception.",
|
||||
prototype.ID);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
@@ -106,7 +109,11 @@ namespace Content.IntegrationTests.Tests
|
||||
- type: entity
|
||||
id: AllComponentsOneToOneDeleteTestEntity";
|
||||
|
||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption {ExtraPrototypes = testEntity});
|
||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
||||
{
|
||||
ExtraPrototypes = testEntity,
|
||||
FailureLogLevel = LogLevel.Error
|
||||
});
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
var mapManager = server.ResolveDependency<IMapManager>();
|
||||
@@ -142,43 +149,46 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
server.Assert(() =>
|
||||
{
|
||||
var testLocation = grid.ToCoordinates();
|
||||
|
||||
foreach (var type in componentFactory.AllRegisteredTypes)
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
var component = (Component) componentFactory.GetComponent(type);
|
||||
var testLocation = grid.ToCoordinates();
|
||||
|
||||
// If this component is ignored
|
||||
if (skipComponents.Contains(component.Name))
|
||||
foreach (var type in componentFactory.AllRegisteredTypes)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var component = (Component) componentFactory.GetComponent(type);
|
||||
|
||||
var entity = entityManager.SpawnEntity("AllComponentsOneToOneDeleteTestEntity", testLocation);
|
||||
|
||||
Assert.That(entity.Initialized);
|
||||
|
||||
// The component may already exist if it is a mandatory component
|
||||
// such as MetaData or Transform
|
||||
if (entity.HasComponent(type))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
component.Owner = entity;
|
||||
|
||||
Logger.LogS(LogLevel.Debug, "EntityTest", $"Adding component: {component.Name}");
|
||||
|
||||
Assert.DoesNotThrow(() =>
|
||||
// If this component is ignored
|
||||
if (skipComponents.Contains(component.Name))
|
||||
{
|
||||
entityManager.ComponentManager.AddComponent(entity, component);
|
||||
}, "Component '{0}' threw an exception.",
|
||||
component.Name);
|
||||
continue;
|
||||
}
|
||||
|
||||
server.RunTicks(2);
|
||||
var entity = entityManager.SpawnEntity("AllComponentsOneToOneDeleteTestEntity", testLocation);
|
||||
|
||||
entityManager.DeleteEntity(entity.Uid);
|
||||
}
|
||||
Assert.That(entity.Initialized);
|
||||
|
||||
// The component may already exist if it is a mandatory component
|
||||
// such as MetaData or Transform
|
||||
if (entity.HasComponent(type))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
component.Owner = entity;
|
||||
|
||||
Logger.LogS(LogLevel.Debug, "EntityTest", $"Adding component: {component.Name}");
|
||||
|
||||
Assert.DoesNotThrow(() =>
|
||||
{
|
||||
entityManager.ComponentManager.AddComponent(entity, component);
|
||||
}, "Component '{0}' threw an exception.",
|
||||
component.Name);
|
||||
|
||||
server.RunTicks(2);
|
||||
|
||||
entityManager.DeleteEntity(entity.Uid);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
@@ -201,7 +211,11 @@ namespace Content.IntegrationTests.Tests
|
||||
- type: entity
|
||||
id: AllComponentsOneEntityDeleteTestEntity";
|
||||
|
||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption {ExtraPrototypes = testEntity});
|
||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
||||
{
|
||||
ExtraPrototypes = testEntity,
|
||||
FailureLogLevel = LogLevel.Error
|
||||
});
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
var mapManager = server.ResolveDependency<IMapManager>();
|
||||
@@ -271,44 +285,46 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
server.Assert(() =>
|
||||
{
|
||||
foreach (var distinct in distinctComponents)
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
var testLocation = grid.ToCoordinates();
|
||||
var entity = entityManager.SpawnEntity("AllComponentsOneEntityDeleteTestEntity", testLocation);
|
||||
|
||||
Assert.That(entity.Initialized);
|
||||
|
||||
foreach (var type in distinct.components)
|
||||
foreach (var distinct in distinctComponents)
|
||||
{
|
||||
var component = (Component) componentFactory.GetComponent(type);
|
||||
var testLocation = grid.ToCoordinates();
|
||||
var entity = entityManager.SpawnEntity("AllComponentsOneEntityDeleteTestEntity", testLocation);
|
||||
|
||||
// If the entity already has this component, if it was ensured or added by another
|
||||
if (entity.HasComponent(component.GetType()))
|
||||
Assert.That(entity.Initialized);
|
||||
|
||||
foreach (var type in distinct.components)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var component = (Component) componentFactory.GetComponent(type);
|
||||
|
||||
// If this component is ignored
|
||||
if (skipComponents.Contains(component.Name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
component.Owner = entity;
|
||||
|
||||
Logger.LogS(LogLevel.Debug, "EntityTest", $"Adding component: {component.Name}");
|
||||
|
||||
Assert.DoesNotThrow(() =>
|
||||
// If the entity already has this component, if it was ensured or added by another
|
||||
if (entity.HasComponent(component.GetType()))
|
||||
{
|
||||
entityManager.ComponentManager.AddComponent(entity, component);
|
||||
}, "Component '{0}' threw an exception.",
|
||||
component.Name);
|
||||
continue;
|
||||
}
|
||||
|
||||
// If this component is ignored
|
||||
if (skipComponents.Contains(component.Name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
component.Owner = entity;
|
||||
|
||||
Logger.LogS(LogLevel.Debug, "EntityTest", $"Adding component: {component.Name}");
|
||||
|
||||
Assert.DoesNotThrow(() =>
|
||||
{
|
||||
entityManager.ComponentManager.AddComponent(entity, component);
|
||||
}, "Component '{0}' threw an exception.",
|
||||
component.Name);
|
||||
}
|
||||
|
||||
server.RunTicks(2);
|
||||
entityManager.DeleteEntity(entity.Uid);
|
||||
}
|
||||
|
||||
server.RunTicks(2);
|
||||
|
||||
entityManager.DeleteEntity(entity.Uid);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Movement;
|
||||
|
||||
@@ -8,6 +8,7 @@ using NUnit.Framework;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.GameStates;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
@@ -43,7 +44,11 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
// This test is designed around specific timing values and when I wrote it interpolation was off.
|
||||
// As such, I would have to update half this test to make sure it works with interpolation.
|
||||
// I'm kinda lazy.
|
||||
CVarOverrides = {{"net.interp", "false"}},
|
||||
CVarOverrides =
|
||||
{
|
||||
{CVars.NetInterp.Name, "false"},
|
||||
{CVars.NetPVS.Name, "false"}
|
||||
},
|
||||
ContentBeforeIoC = () =>
|
||||
{
|
||||
IoCManager.Resolve<IEntitySystemManager>().LoadExtraSystemType<PredictionTestEntitySystem>();
|
||||
@@ -52,6 +57,10 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
},
|
||||
new ServerContentIntegrationOption
|
||||
{
|
||||
CVarOverrides =
|
||||
{
|
||||
{CVars.NetPVS.Name, "false"}
|
||||
},
|
||||
ContentBeforeIoC = () =>
|
||||
{
|
||||
IoCManager.Resolve<IEntitySystemManager>().LoadExtraSystemType<PredictionTestEntitySystem>();
|
||||
|
||||
@@ -9,6 +9,7 @@ using NUnit.Framework;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
|
||||
namespace Content.IntegrationTests.Tests
|
||||
{
|
||||
@@ -89,6 +90,12 @@ namespace Content.IntegrationTests.Tests
|
||||
nodeGroupID: Apc
|
||||
- type: SnapGrid
|
||||
offset: Center
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
- key: enum.ApcUiKey.Key
|
||||
type: ApcBoundUserInterface
|
||||
- type: AccessReader
|
||||
access: [['Engineering']]
|
||||
|
||||
- type: entity
|
||||
name: ApcExtensionCableDummy
|
||||
@@ -138,7 +145,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
if (generatorEnt.TryGetComponent(out PhysicsComponent? physics))
|
||||
{
|
||||
physics.Anchored = true;
|
||||
physics.BodyType = BodyType.Static;
|
||||
}
|
||||
|
||||
supplier = generatorEnt.GetComponent<PowerSupplierComponent>();
|
||||
|
||||
@@ -4,6 +4,7 @@ using Robust.Server.Maps;
|
||||
using Robust.Shared.ContentPack;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -18,7 +19,10 @@ namespace Content.IntegrationTests.Tests
|
||||
{
|
||||
const string mapPath = @"/Maps/Test/TestMap.yml";
|
||||
|
||||
var server = StartServer();
|
||||
var server = StartServer(new ServerContentIntegrationOption
|
||||
{
|
||||
FailureLogLevel = LogLevel.Error
|
||||
});
|
||||
await server.WaitIdleAsync();
|
||||
var mapLoader = server.ResolveDependency<IMapLoader>();
|
||||
var mapManager = server.ResolveDependency<IMapManager>();
|
||||
|
||||
Reference in New Issue
Block a user