Fixes the flaky LibraryPathTemplate equality and TranscodingCacheCoordinator touch tests

This commit is contained in:
BinaryAlley committed 2026-11-01 10:41:51 +02:00
1 parent ebef8f4cae
commit d13246e6a0
2 files changed
+7 -3

No files matched your search

@@ -449,11 +449,13 @@ public class TranscodingCacheCoordinatorTests : IDisposable
string cacheId = CreateCacheId();
string cachePath = Path.Combine(_cacheRoot, cacheId);
PublishEntry(cacheId, 50, 100);
Thread.Sleep(200);
// The entry must be older than the grace period before the touch, and the touch must still be inside it when the reservation
// runs. A grace period of seconds keeps the second condition true on slow CI runners, where a few hundred milliseconds can pass between the two calls.
Thread.Sleep(2100);
// Act
_sut.Touch(cacheId, TimeSpan.Zero);
bool result = _sut.TryReserve(80, 100, TimeSpan.FromMilliseconds(100), out _);
bool result = _sut.TryReserve(80, 100, TimeSpan.FromSeconds(2), out _);
// Assert
Assert.False(result);