Skip to content

Backport(v1.19): test_in_tail: fix flaky unwatched files test by waiting for update_watcher to finish (#5561) - #5573

Open
github-actions[bot] wants to merge 1 commit into
v1.19from
backport-to-v1.19/pr5561
Open

github-actions[bot] wants to merge 1 commit into
v1.19from
backport-to-v1.19/pr5561

Conversation

@github-actions

Copy link
Copy Markdown

Which issue(s) this PR fixes:
Backport #5561
Fixes #

What this PR does / why we need it:

test_unwatched_files_should_be_removed sometimes fails on Windows CI (https://github.com/fluent/fluentd/actions/runs/39098295736/job/117589230842, and https://github.com/fluent/fluentd/actions/runs/31663244407 in August).

<{:files=>[], :tails=>[]}> expected but was
<{:files=>[],
 :tails=>
  ["D:/a/fluentd/fluentd/test/plugin/../tmp/tail/53546056ce0a33469414/tail.txt"]}>.

On Windows, refresh_watchers removes the watcher of the deleted file first. Then the old watcher detects the rotation, and update_watcher adds a watcher for the path again. Because update_watcher logs "detected rotation" before it updates @tails, the test could see an empty @tails in between. This PR reads @tails under @watcher_refresh_monitor, which update_watcher holds.

Docs Changes:

N/A

Release Note:

N/A

🤖 Generated with Claude Code

…tcher to finish (#5561)

**Which issue(s) this PR fixes**:
Fixes #

**What this PR does / why we need it**:

`test_unwatched_files_should_be_removed` sometimes fails on Windows CI
(https://github.com/fluent/fluentd/actions/runs/39098295736/job/117589230842,
and https://github.com/fluent/fluentd/actions/runs/31663244407 in
August).

```
<{:files=>[], :tails=>[]}> expected but was
<{:files=>[],
 :tails=>
  ["D:/a/fluentd/fluentd/test/plugin/../tmp/tail/53546056ce0a33469414/tail.txt"]}>.
```

On Windows, `refresh_watchers` removes the watcher of the deleted file
first. Then the old watcher detects the rotation, and `update_watcher`
adds a watcher for the path again. Because `update_watcher` logs
"detected rotation" before it updates `@tails`, the test could see an
empty `@tails` in between. This PR reads `@tails` under
`@watcher_refresh_monitor`, which `update_watcher` holds.

**Docs Changes**:

N/A

**Release Note**:

N/A

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant