Make tests faster (#8737)
* Test changes * Make finding the test tile a little smarter
This commit is contained in:
@@ -16,7 +16,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
||||
[TestFixture]
|
||||
[TestOf(typeof(CuffableComponent))]
|
||||
[TestOf(typeof(HandcuffComponent))]
|
||||
public sealed class HandCuffTest : ContentIntegrationTest
|
||||
public sealed class HandCuffTest
|
||||
{
|
||||
private const string Prototypes = @"
|
||||
- type: entity
|
||||
@@ -39,8 +39,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
||||
[Test]
|
||||
public async Task Test()
|
||||
{
|
||||
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
||||
var server = StartServer(options);
|
||||
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
|
||||
var server = pairTracker.Pair.Server;
|
||||
|
||||
EntityUid human;
|
||||
EntityUid otherHuman;
|
||||
@@ -49,7 +49,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
||||
CuffableComponent cuffed;
|
||||
HandsComponent hands;
|
||||
|
||||
server.Assert(() =>
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
var mapId = mapManager.CreateMap();
|
||||
@@ -89,7 +89,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
||||
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
await pairTracker.CleanReturnAsync();
|
||||
}
|
||||
|
||||
private void AddHand(EntityUid to)
|
||||
|
||||
@@ -13,14 +13,14 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components
|
||||
{
|
||||
[TestFixture]
|
||||
[TestOf(typeof(Server.Entry.IgnoredComponents))]
|
||||
public sealed class EntityPrototypeComponentsTest : ContentIntegrationTest
|
||||
public sealed class EntityPrototypeComponentsTest
|
||||
{
|
||||
[Test]
|
||||
public async Task PrototypesHaveKnownComponents()
|
||||
{
|
||||
var (client, server) = await StartConnectedServerDummyTickerClientPair();
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
await using var pairTracker = await PoolManager.GetServerClient();
|
||||
var server = pairTracker.Pair.Server;
|
||||
var client = pairTracker.Pair.Client;
|
||||
|
||||
var sResourceManager = server.ResolveDependency<IResourceManager>();
|
||||
var prototypePath = new ResourcePath("/Prototypes/");
|
||||
@@ -95,6 +95,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components
|
||||
|
||||
if (unknownComponentsClient.Count + unknownComponentsServer.Count == 0)
|
||||
{
|
||||
await pairTracker.CleanReturnAsync();
|
||||
Assert.Pass($"Validated {entitiesValidated} entities with {componentsValidated} components in {paths.Length} files.");
|
||||
return;
|
||||
}
|
||||
@@ -119,7 +120,9 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components
|
||||
[Test]
|
||||
public async Task IgnoredComponentsExistInTheCorrectPlaces()
|
||||
{
|
||||
var (client, server) = await StartConnectedServerClientPair();
|
||||
await using var pairTracker = await PoolManager.GetServerClient();
|
||||
var server = pairTracker.Pair.Server;
|
||||
var client = pairTracker.Pair.Client;
|
||||
var serverComponents = server.ResolveDependency<IComponentFactory>();
|
||||
var ignoredServerNames = Server.Entry.IgnoredComponents.List;
|
||||
var clientComponents = client.ResolveDependency<IComponentFactory>();
|
||||
@@ -137,6 +140,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components
|
||||
}
|
||||
}
|
||||
Assert.IsEmpty(failureMessages);
|
||||
await pairTracker.CleanReturnAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,15 +12,14 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
{
|
||||
[TestFixture]
|
||||
[TestOf(typeof(AlertsComponent))]
|
||||
public sealed class AlertsComponentTests : ContentIntegrationTest
|
||||
public sealed class AlertsComponentTests
|
||||
{
|
||||
[Test]
|
||||
public async Task AlertsTest()
|
||||
{
|
||||
var (client, server) = await StartConnectedServerClientPair();
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
await client.WaitIdleAsync();
|
||||
await using var pairTracker = await PoolManager.GetServerClient();
|
||||
var server = pairTracker.Pair.Server;
|
||||
var client = pairTracker.Pair.Client;
|
||||
|
||||
var serverPlayerManager = server.ResolveDependency<IPlayerManager>();
|
||||
var alertsSystem = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<AlertsSystem>();
|
||||
@@ -39,7 +38,6 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
|
||||
await server.WaitRunTicks(5);
|
||||
await client.WaitRunTicks(5);
|
||||
|
||||
var clientPlayerMgr = client.ResolveDependency<Robust.Client.Player.IPlayerManager>();
|
||||
var clientUIMgr = client.ResolveDependency<IUserInterfaceManager>();
|
||||
await client.WaitAssertion(() =>
|
||||
@@ -74,8 +72,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
|
||||
alertsSystem.ClearAlert(alertsComponent.Owner, AlertType.Debug1);
|
||||
});
|
||||
await server.WaitRunTicks(5);
|
||||
await client.WaitRunTicks(5);
|
||||
|
||||
await PoolManager.RunTicksSync(pairTracker.Pair, 5);
|
||||
|
||||
await client.WaitAssertion(() =>
|
||||
{
|
||||
@@ -99,6 +97,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
var expectedIDs = new [] {AlertType.HumanHealth, AlertType.Debug2};
|
||||
Assert.That(alertIDs, Is.SupersetOf(expectedIDs));
|
||||
});
|
||||
await pairTracker.CleanReturnAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,15 +6,13 @@ using NUnit.Framework;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Content.Server.Climbing;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
|
||||
{
|
||||
[TestFixture]
|
||||
[TestOf(typeof(ClimbableComponent))]
|
||||
[TestOf(typeof(ClimbingComponent))]
|
||||
public sealed class ClimbUnitTest : ContentIntegrationTest
|
||||
public sealed class ClimbUnitTest
|
||||
{
|
||||
private const string Prototypes = @"
|
||||
- type: entity
|
||||
@@ -35,14 +33,14 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
|
||||
[Test]
|
||||
public async Task Test()
|
||||
{
|
||||
var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
|
||||
var server = StartServer(options);
|
||||
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
|
||||
var server = pairTracker.Pair.Server;
|
||||
|
||||
EntityUid human;
|
||||
EntityUid table;
|
||||
ClimbingComponent climbing;
|
||||
|
||||
server.Assert(() =>
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
mapManager.CreateNewMapEntity(MapId.Nullspace);
|
||||
@@ -69,7 +67,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
|
||||
// climbing.IsClimbing = false;
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
await pairTracker.CleanReturnAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user