-
Notifications
You must be signed in to change notification settings - Fork 285
(fix): Fixed flaky test TestReadDirSymlink that frequently failed in CI environments due to platform-specific filesystem issues. #22743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨No code suggestions found for the PR. |
User description
What type of PR is this?
Which issue(s) this PR fixes:
issue #22009
What this PR does / why we need it:
Problem
The test was failing with high probability in CI with errors like:
FSEventStreamStart errors on macOS
Path mismatches due to symlink resolution (/var vs /private/var)
panic: index out of range [0] when filesystem watching failed
Root Causes
Symlink path inconsistency: macOS resolves /var to /private/var, causing path comparison failures
Filesystem watching failures: notify.Watch() can fail on macOS, Docker containers, and restricted CI environments
Temporary directory paths: os.MkdirTemp() may return paths containing symlinks that need normalization
Changes
Normalize root path with filepath.EvalSymlinks() at test start
Make filesystem watching failures non-fatal (changed from assert to warning log)
Fix symlink comparison by using EvalSymlinks on both sides
Handle nil event channel gracefully
PR Type
Tests, Bug fix
Description
Normalize temporary directory path using
filepath.EvalSymlinks()to handle platform-specific symlink resolution (e.g., /var → /private/var on macOS)Make filesystem watching failures non-fatal by logging warnings instead of failing test assertions
Handle nil event channel gracefully when
notify.Watch()fails in restricted CI environmentsFix symlink comparison by applying
filepath.EvalSymlinks()to both expected and actual pathsDiagram Walkthrough
flowchart LR A["Test Start"] --> B["Normalize root path<br/>with EvalSymlinks"] B --> C["Attempt notify.Watch"] C --> D{Watch succeeds?} D -->|Yes| E["Monitor filesystem<br/>events"] D -->|No| F["Log warning<br/>continue test"] E --> G["Compare symlinks<br/>with EvalSymlinks"] F --> G G --> H["Test Complete"]File Walkthrough
external_test.go
Normalize symlinks and handle watch failures gracefullypkg/sql/colexec/external/external_test.go
filepath.EvalSymlinks()call on temporary directory root tonormalize symlink paths
notify.Watch()error handling from assertion to warning logfor non-fatal failures
monitoring goroutine
filepath.EvalSymlinks()to both sides of symlink pathcomparison to ensure consistent resolution