From 8c4e17eef3467207db98534e96919c7eacd552e5 Mon Sep 17 00:00:00 2001 From: wrexbe <81056464+wrexbe@users.noreply.github.com> Date: Tue, 5 Jul 2022 08:02:24 -0700 Subject: [PATCH] Make destructible test more reliable (#9425) --- Content.IntegrationTests/PoolManager.cs | 2 ++ .../Tests/Destructible/DestructibleDamageTypeTest.cs | 1 + .../Tests/Destructible/DestructibleDestructionTest.cs | 1 + .../Destructible/TestDestructibleListenerSystem.cs | 10 ++-------- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Content.IntegrationTests/PoolManager.cs b/Content.IntegrationTests/PoolManager.cs index b63a8ac3e8..8a772835a7 100644 --- a/Content.IntegrationTests/PoolManager.cs +++ b/Content.IntegrationTests/PoolManager.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Content.Client.IoC; using Content.Client.Parallax.Managers; using Content.IntegrationTests.Tests; +using Content.IntegrationTests.Tests.Destructible; using Content.IntegrationTests.Tests.DeviceNetwork; using Content.IntegrationTests.Tests.Interaction.Click; using Content.IntegrationTests.Tests.Networking; @@ -106,6 +107,7 @@ public static class PoolManager IoCManager.Resolve() .LoadExtraSystemType(); IoCManager.Resolve().LoadExtraSystemType(); + IoCManager.Resolve().LoadExtraSystemType(); IoCManager.Resolve().GetSawmill("loc").Level = LogLevel.Error; }; diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs index ac670fdc64..29c25be5d9 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs @@ -39,6 +39,7 @@ namespace Content.IntegrationTests.Tests.Destructible sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageTypeEntityId, coordinates); sDamageableComponent = IoCManager.Resolve().GetComponent(sDestructibleEntity); sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem(); + sTestThresholdListenerSystem.ThresholdsReached.Clear(); sDamageableSystem = sEntitySystemManager.GetEntitySystem(); }); diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs index 90dc6f4cf3..be26c38c59 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs @@ -36,6 +36,7 @@ namespace Content.IntegrationTests.Tests.Destructible sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDestructionEntityId, coordinates); sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem(); + sTestThresholdListenerSystem.ThresholdsReached.Clear(); }); await server.WaitAssertion(() => diff --git a/Content.IntegrationTests/Tests/Destructible/TestDestructibleListenerSystem.cs b/Content.IntegrationTests/Tests/Destructible/TestDestructibleListenerSystem.cs index 276cedea0d..1bb397d4b3 100644 --- a/Content.IntegrationTests/Tests/Destructible/TestDestructibleListenerSystem.cs +++ b/Content.IntegrationTests/Tests/Destructible/TestDestructibleListenerSystem.cs @@ -1,9 +1,8 @@ using System.Collections.Generic; using Content.Server.Destructible; using Content.Shared.GameTicking; -using Content.Shared.Module; using Robust.Shared.GameObjects; -using Robust.Shared.IoC; +using Robust.Shared.Reflection; namespace Content.IntegrationTests.Tests.Destructible { @@ -11,19 +10,14 @@ namespace Content.IntegrationTests.Tests.Destructible /// This is just a system for testing destructible thresholds. Whenever any threshold is reached, this will add that /// threshold to a list for checking during testing. /// + [Reflect(false)] public sealed class TestDestructibleListenerSystem : EntitySystem { - [Dependency] private readonly IModuleManager _modManager; - public readonly List ThresholdsReached = new(); public override void Initialize() { base.Initialize(); - - if (_modManager.IsClientModule) - return; - SubscribeLocalEvent(AddThresholdsToList); SubscribeLocalEvent(OnRoundRestart); }