ModernUO/Projects/UOContent.Tests/Tests/Engines/Pathing
Kamron Batman 225c634bf7
test: stop the 1 ms promotion window leaking out of StepCacheLifecycleTests (#2679)
## Summary

`Find_TwoPathfindsOverlappingChunks_PromoteToBuildOnSecondFind` fails intermittently in CI with `second Find through overlapping chunks must promote (got 0 builds)`.

**Cause:** `SecondTouchAfterWindow_RestartsTheCount` and `TwoFindsAcrossTheWindow_DoNotPromote` set `StepCache.Instance.MissPromotionWindowMs = 1` and never restore it, and `Clear()` does not reset it. Both classes share the `Sequential Pathfinding Tests` collection, so when a lifecycle test runs first, the promotion test's two Finds have to land within 1 ms of each other. On Linux, `Environment.TickCount` moves in coarse steps of several ms, so even a sub-millisecond test can see the window lapse. The second Find then restarts the miss count instead of promoting. On Windows the ~15.6 ms tick nearly always reads the same value for both Finds, which is why it didn't reproduce locally.

**Fix (tests only):**
- `StepCacheLifecycleTests` implements `IDisposable` and restores the window after each test.
- The promotion test sets the window it depends on (30 s) instead of inheriting it.

## Test plan

- [x] Reproduced deterministically: with a temporary 20 ms sleep between the two Finds, the test fails whenever the lifecycle tests run first and passes when run alone
- [x] With the sleep still in, the test passes with the Dispose restore alone and with both fixes
- [x] All pathfinding tests pass (123/123) with the sleep removed
2026-09-25 00:55:07 -07:00
..
Multi fix(ci): run test projects on CI; remove brittle OPL attribute tests (#2513) 2026-07-02 22:35:37 -07:00
BitmapAStarAlgorithmTests.cs test: stop the 1 ms promotion window leaking out of StepCacheLifecycleTests (#2679) 2026-09-25 00:55:07 -07:00
PathfindRecorderTests.cs fix: Cleans up AI Pathfinding code to make it more portable for custom requirements. (#2474) 2026-06-07 13:25:10 -07:00
PathingTestSupport.cs perf(pathing): pool the StepCache strata buffer, then clean up the pathing engine around it (#2523) 2026-07-12 20:02:29 -07:00
StepCacheFileFormatTests.cs perf(pathing): pool the StepCache strata buffer, then clean up the pathing engine around it (#2523) 2026-07-12 20:02:29 -07:00
StepCacheFileTests.cs perf(pathing): pool the StepCache strata buffer, then clean up the pathing engine around it (#2523) 2026-07-12 20:02:29 -07:00
StepCacheFingerprintTests.cs fix: Fixes pathfinding prebake and pathfinding multi-fallthrough. (#2478) 2026-06-08 11:59:24 -07:00
StepCacheLifecycleTests.cs test: stop the 1 ms promotion window leaking out of StepCacheLifecycleTests (#2679) 2026-09-25 00:55:07 -07:00
StepCacheParityTests.cs perf(pathing): pool the StepCache strata buffer, then clean up the pathing engine around it (#2523) 2026-07-12 20:02:29 -07:00
StepProbeTests.cs fix(ci): run test projects on CI; remove brittle OPL attribute tests (#2513) 2026-07-02 22:35:37 -07:00