From 56b53874ada13585db092bd66ab088df8e792f9f Mon Sep 17 00:00:00 2001 From: MrDevRobot Date: Sun, 18 Oct 2026 22:36:25 +0200 Subject: [PATCH] test: give the DropIndex concurrency tests a load-tolerant lock timeout DynamicCollection_DropIndex_WaitsForTheCollectionLock and DynamicCollection_DropIndex_WhileInserting failed intermittently on CI with lock timeouts: eight writers and a drop contend for the collection lock, and the 500 ms default is too short on a loaded runner. The tests check ordering and consistency, not lock latency, so they open the engine with 30 s locks. Co-Authored-By: Claude Opus 5.5 --- tests/BLite.Tests/IndexPageReleaseTests.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/BLite.Tests/IndexPageReleaseTests.cs b/tests/BLite.Tests/IndexPageReleaseTests.cs index df422676..f37a92b9 100644 --- a/tests/BLite.Tests/IndexPageReleaseTests.cs +++ b/tests/BLite.Tests/IndexPageReleaseTests.cs @@ -374,7 +374,7 @@ public async Task Dispose_WaitsForThePendingFreeCheckpoint_LongerThanTheLockTime [Fact] public async Task DynamicCollection_DropIndex_WaitsForTheCollectionLock() { - using var engine = new BLiteEngine(_dbPath); + using var engine = new BLiteEngine(_dbPath, LoadTolerant); var col = engine.GetOrCreateCollection("docs"); await InsertIndexableDocsAsync(col, 100); await col.CreateIndexAsync("value", "idx_value"); @@ -406,7 +406,7 @@ public async Task DynamicCollection_DropIndex_WaitsForTheCollectionLock() [Fact] public async Task DynamicCollection_DropIndex_WhileInserting_KeepsCollectionAndOtherIndexConsistent() { - using var engine = new BLiteEngine(_dbPath); + using var engine = new BLiteEngine(_dbPath, LoadTolerant); var col = engine.GetOrCreateCollection("docs"); await InsertIndexableDocsAsync(col, 500); await col.CreateIndexAsync("value", "idx_value"); @@ -439,6 +439,11 @@ await col.InsertAsync(col.CreateDocument(["value", "payload"], // Helpers // ====================================================================== + // The concurrency tests check ordering and consistency, not lock latency: on a loaded CI + // runner the 500 ms default lets a writer time out behind its peers, which says nothing + // about the behaviour under test. + private static readonly PageFileConfig LoadTolerant = PageFileConfig.Default with { LockTimeout = LockTimeout.From(30_000, 30_000) }; + private static readonly System.Reflection.BindingFlags Flags = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance;