diff --git a/Content.IntegrationTests/Tests/Utility/SandboxTest.cs b/Content.IntegrationTests/Tests/Utility/SandboxTest.cs index 633ab860f1..8ff2c126ea 100644 --- a/Content.IntegrationTests/Tests/Utility/SandboxTest.cs +++ b/Content.IntegrationTests/Tests/Utility/SandboxTest.cs @@ -1,3 +1,11 @@ +using Content.Client.IoC; +using Content.Client.Parallax.Managers; +using Robust.Client; +using Robust.Shared.Configuration; +using Robust.Shared.ContentPack; +using Robust.Shared.IoC; +using Robust.Shared.Log; +using Robust.UnitTesting; namespace Content.IntegrationTests.Tests.Utility; @@ -6,9 +14,41 @@ public sealed class SandboxTest [Test] public async Task Test() { - await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { Destructive = true }); - var client = pairTracker.Pair.Client; + // Not using PoolManager.GetServerClient() because we want to avoid having to unnecessarily create & destroy a + // server. This all becomes unnecessary if ever the test becomes non-destructive or the no-server option + // actually creates a pair without a server. + + var logHandler = new PoolTestLogHandler("CLIENT"); + logHandler.ActivateContext(TestContext.Out); + var options = new RobustIntegrationTest.ClientIntegrationOptions + { + ContentStart = true, + OverrideLogHandler = () => logHandler, + ContentAssemblies = new[] + { + typeof(Shared.Entry.EntryPoint).Assembly, + typeof(Client.Entry.EntryPoint).Assembly + }, + Options = new GameControllerOptions { LoadConfigAndUserData = false } + }; + + options.BeforeStart += () => + { + IoCManager.Resolve().SetModuleBaseCallbacks(new ClientModuleTestingCallbacks + { + ClientBeforeIoC = () => + { + IoCManager.Register(true); + IoCManager.Resolve().GetSawmill("loc").Level = LogLevel.Error; + IoCManager.Resolve() + .OnValueChanged(RTCVars.FailureLogLevel, value => logHandler.FailureLevel = value, true); + } + }); + }; + + using var client = new RobustIntegrationTest.ClientIntegrationInstance(options); + await client.WaitIdleAsync(); await client.CheckSandboxed(typeof(Client.Entry.EntryPoint).Assembly); - await pairTracker.CleanReturnAsync(); + await client.CheckSandboxed(typeof(Shared.IoC.SharedContentIoC).Assembly); } }