diff --git a/Projects/UOContent.Tests/Tests/Engines/Pathing/BitmapAStarAlgorithmTests.cs b/Projects/UOContent.Tests/Tests/Engines/Pathing/BitmapAStarAlgorithmTests.cs index 20d729c0f..667995278 100644 --- a/Projects/UOContent.Tests/Tests/Engines/Pathing/BitmapAStarAlgorithmTests.cs +++ b/Projects/UOContent.Tests/Tests/Engines/Pathing/BitmapAStarAlgorithmTests.cs @@ -371,6 +371,9 @@ public class BitmapAStarAlgorithmTests { StepCache.Instance.Clear(); StepCache.Instance.MissPromotionThreshold = 2; + // Pinned: promotion needs both Finds inside the window, and Linux's coarse TickCount can + // step several ms between two back-to-back Finds. + StepCache.Instance.MissPromotionWindowMs = 30_000; var map = Map.Maps[1]; var stub = new DefaultWalkerStub(); diff --git a/Projects/UOContent.Tests/Tests/Engines/Pathing/StepCacheLifecycleTests.cs b/Projects/UOContent.Tests/Tests/Engines/Pathing/StepCacheLifecycleTests.cs index 7b630173c..b4257f112 100644 --- a/Projects/UOContent.Tests/Tests/Engines/Pathing/StepCacheLifecycleTests.cs +++ b/Projects/UOContent.Tests/Tests/Engines/Pathing/StepCacheLifecycleTests.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Reflection; using System.Threading; @@ -14,8 +15,14 @@ namespace Server.Tests.Pathfinding; /// layers, and LRU eviction. /// [Collection("Sequential Pathfinding Tests")] -public class StepCacheLifecycleTests +public class StepCacheLifecycleTests : IDisposable { + // The window is a knob on the singleton and Clear() leaves it alone, so a test that narrows + // it would otherwise leak the narrow window into every later test in the collection. + private readonly uint _savedWindowMs = StepCache.Instance.MissPromotionWindowMs; + + public void Dispose() => StepCache.Instance.MissPromotionWindowMs = _savedWindowMs; + /// Resets to a known state and returns the singleton. private static StepCache FreshCache(int promotionThreshold) {