Skip to content

Commit 8238e9b

Browse files
committed
Improve file detection logic in ResilientFileSystemMonitorTests with enhanced polling and reconciliation wait times
1 parent 0c58c66 commit 8238e9b

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎src/Cocoar.FileSystem.Tests/ResilientFileSystemMonitorTests.cs‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,14 +434,21 @@ await ActiveWaitHelpers.WaitUntilAsync(
434434

435435
// Recreate with modified file (this will be a "created" event since old file was deleted)
436436
Directory.CreateDirectory(_testRoot);
437-
await Task.Delay(200);
438437
File.WriteAllText(GetTestPath("test.txt"), "v2_modified");
439438

439+
// Wait for polling to detect directory and switch back to watcher
440+
await ActiveWaitHelpers.WaitUntilAsync(
441+
() => monitor.IsUsingWatcher,
442+
TimeSpan.FromSeconds(5),
443+
TimeSpan.FromMilliseconds(100),
444+
"switch back to watcher");
445+
446+
// Wait for reconciliation to detect the file
440447
await ActiveWaitHelpers.WaitUntilAsync(
441448
() => createdFiles.Contains("test.txt"),
442-
TimeSpan.FromSeconds(8),
443-
TimeSpan.FromMilliseconds(200),
444-
"detect file recreation via reconciliation");
449+
TimeSpan.FromSeconds(3),
450+
TimeSpan.FromMilliseconds(100),
451+
"detect file via reconciliation");
445452

446453
Assert.Contains("test.txt", createdFiles);
447454
}

0 commit comments

Comments
 (0)