test: Increase requireTrueWithinDuration timeouts in ldfilewatch tests#366
Conversation
On Windows, fsnotify (ReadDirectoryChangesW) can have higher latency than Linux inotify, especially under the race detector. The 1-second timeouts in TestNewWatchedFileDataSource and TestNewWatchedFileMissing were too tight, causing intermittent failures on Windows CI (Go 1.25 and 1.26). Increase both from 1s to 3s, consistent with the 2s timeout already used by TestNewWatchedDirectoryMissing. Co-Authored-By: Aaron Zeisler <azeisler@launchdarkly.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
This is a reaction to CI failing on this PR: #365 I audited CI failures to understand if the 2-second timeout in the existing |
|
This might help, but I have generally found there to be flaws with the test methodology for these file watcher tests. Just don't be surprised if there continue to be flakes. Basically assumptions with how many times file modifications will be generated (where windows will rate limit and coalesce them), the granularity of the timestamps (two updates within the same granularity and ignoring one), the handling of failed partial states (JSON parsing causing us to stop watching the file, even though it was just because of a partial flush). |
Requirements
Related issues
TestNewWatchedFileMissingandTestNewWatchedFileDataSource(observed on PR #365, Windows Go 1.25 and Go 1.26 jobs)Describe the solution you've provided
Increases the
requireTrueWithinDurationtimeout from 1s to 3s in two tests:TestNewWatchedFileDataSource(line 156) — waits for a flag update after file modificationTestNewWatchedFileMissing(line 189) — waits for a flag to appear after a missing file is createdOn Windows,
fsnotifyusesReadDirectoryChangesW, which can deliver filesystem notifications with higher latency than Linux'sinotify. Combined with-racedetector overhead, the 1s window is too tight and causes intermittent failures. The sibling testTestNewWatchedDirectoryMissingalready uses a 2s timeout for the same reason; 3s provides additional headroom.Describe alternatives you've considered
Human review checklist
requireTrueWithinDurationcalls with tight timeouts were missed (there is one more at line 229 which already uses 2s)Link to Devin session: https://app.devin.ai/sessions/d3cef2cb9a624014baff3d51440b6715
Note
Low Risk
Low risk: test-only change that relaxes polling timeouts to reduce flakes; no production logic is modified.
Overview
Increases
requireTrueWithinDurationtimeouts from 1s to 3s inTestNewWatchedFileDataSourceandTestNewWatchedFileMissingto give more headroom for filesystem watcher latency (notably on Windows) when waiting for flag updates after file creation/modification.Reviewed by Cursor Bugbot for commit 15c9723. Bugbot is set up for automated code reviews on this repo. Configure here.