Revert PVS changes (#10735)

This commit is contained in:
Leon Friedrich
2022-08-21 07:27:41 +12:00
committed by GitHub
parent f99d0151e6
commit ff2a67bc74
7 changed files with 26 additions and 32 deletions

View File

@@ -6,11 +6,8 @@ using System.Threading.Tasks;
using NUnit.Framework;
using Robust.Client.GameObjects;
using Robust.Client.GameStates;
using Robust.Client.Timing;
using Robust.Server.GameStates;
using Robust.Server.Player;
using Robust.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.IoC;
@@ -38,7 +35,7 @@ namespace Content.IntegrationTests.Tests.Networking
[Test]
public async Task Test()
{
await using var pairTracker = await PoolManager.GetServerClient(new (){Fresh = true, DummyTicker = true});
await using var pairTracker = await PoolManager.GetServerClient(new (){Fresh = true, DisableInterpolate = true, DummyTicker = true});
var server = pairTracker.Pair.Server;
var client = pairTracker.Pair.Client;
@@ -48,12 +45,8 @@ namespace Content.IntegrationTests.Tests.Networking
var sEntityManager = server.ResolveDependency<IEntityManager>();
var cEntityManager = client.ResolveDependency<IEntityManager>();
var sGameTiming = server.ResolveDependency<IGameTiming>();
var cGameTiming = client.ResolveDependency<IClientGameTiming>();
var cGameTiming = client.ResolveDependency<IGameTiming>();
var cGameStateManager = client.ResolveDependency<IClientGameStateManager>();
var cfg = client.ResolveDependency<IConfigurationManager>();
var log = cfg.GetCVar(CVars.NetLogging);
//cfg.SetCVar(CVars.NetLogging, true);
EntityUid serverEnt = default;
PredictionTestComponent serverComponent = default!;
@@ -79,13 +72,15 @@ namespace Content.IntegrationTests.Tests.Networking
// Run some ticks so that
await PoolManager.RunTicksSync(pairTracker.Pair, 3);
// Check client buffer is full
Assert.That(cGameStateManager.CurrentBufferSize, Is.EqualTo(cGameStateManager.TargetBufferSize));
// This isn't required anymore, but the test had this for the sake of "technical things", and I cbf shifting
// all the tick times over. So it stays.
// Due to technical things with the game state processor it has an extra state in the buffer here.
// This burns through it real quick, but I'm not sure it should be there?
// Under normal operation (read: not integration test) this gets corrected for via tick time adjustment,
// so it's probably not an issue?
await client.WaitRunTicks(1);
// 2 is target buffer size.
Assert.That(cGameStateManager.CurrentBufferSize, Is.EqualTo(2));
await client.WaitPost(() =>
{
clientComponent = cEntityManager.GetComponent<PredictionTestComponent>(serverEnt);
@@ -102,7 +97,7 @@ namespace Content.IntegrationTests.Tests.Networking
// Client last ran tick 15 meaning it's ahead of the last server tick it processed (12)
Assert.That(cGameTiming.CurTick, Is.EqualTo(new GameTick(16)));
Assert.That(cGameTiming.LastProcessedTick, Is.EqualTo(new GameTick(12)));
Assert.That(cGameStateManager.CurServerTick, Is.EqualTo(new GameTick(12)));
// *** I am using block scopes to visually distinguish these sections of the test to make it more readable.
@@ -178,7 +173,7 @@ namespace Content.IntegrationTests.Tests.Networking
// Assert timing is still correct, should be but it's a good reference for the rest of the test.
Assert.That(sGameTiming.CurTick, Is.EqualTo(new GameTick(18)));
Assert.That(cGameTiming.CurTick, Is.EqualTo(new GameTick(20)));
Assert.That(cGameTiming.LastProcessedTick, Is.EqualTo(new GameTick(16)));
Assert.That(cGameStateManager.CurServerTick, Is.EqualTo(new GameTick(16)));
{
// Send event to server to change flag again, this time to disable it..
@@ -249,7 +244,7 @@ namespace Content.IntegrationTests.Tests.Networking
// Assert timing is still correct.
Assert.That(sGameTiming.CurTick, Is.EqualTo(new GameTick(22)));
Assert.That(cGameTiming.CurTick, Is.EqualTo(new GameTick(24)));
Assert.That(cGameTiming.LastProcessedTick, Is.EqualTo(new GameTick(20)));
Assert.That(cGameStateManager.CurServerTick, Is.EqualTo(new GameTick(20)));
{
// Send first event to disable the flag (reminder: it never got accepted by the server).
@@ -364,8 +359,6 @@ namespace Content.IntegrationTests.Tests.Networking
Assert.That(clientComponent.Foo, Is.True);
}
}
cfg.SetCVar(CVars.NetLogging, log);
await pairTracker.CleanReturnAsync();
}