Skip to content

Fix flaky WatcherYamlRestIT test#145671

Merged
michalborek merged 1 commit intoelastic:mainfrom
michalborek:issue-139663
Apr 3, 2026
Merged

Fix flaky WatcherYamlRestIT test#145671
michalborek merged 1 commit intoelastic:mainfrom
michalborek:issue-139663

Conversation

@michalborek
Copy link
Copy Markdown
Contributor

@michalborek michalborek commented Apr 3, 2026

Prerequisite fix:
Fix the test that broke when being muted

Fix:
The test adds a scheduled watch that runs immediately and right after executes the watch.
This scenario is not concurrency-safe. The TickerScheduleTriggerEngine does not check whether a processed watch is currently executing (side note: the there is such a check in the execute watch operation). This introduces a possibility of a watch being executed simultaneously and this is what's happening in the test.

Since Execute Watch operation is described as a testing/debugging tool, we may want to leave the functionality as is and just fix the test.

Closes: #139663

Avoid concurrent execution of the same watch via schedule and API
@michalborek michalborek added >test Issues or PRs that are addressing/adding tests :Distributed/Watcher labels Apr 3, 2026
@michalborek michalborek marked this pull request as ready for review April 3, 2026 07:09
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Meta label for distributed team. label Apr 3, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

@albertzaharovits
Copy link
Copy Markdown
Contributor

I'm not sure this is going to address the problem that I'd explore myself, i.e.

[2025-12-15T01:13:14,806][DEBUG][o.e.x.w.WatcherIndexingListener] [test-cluster-0] failed to add watch [test_watch] to trigger service [.watches/O9oJ1AlCR8aPfeD0DmKnXw][[.watches][0]] org.elasticsearch.index.engine.VersionConflictEngineException: [test_watch]: version conflict, required seqNo [0], primary term [1]. current document has seqNo [1] and primary term [1]

but I'm also not opposed to merging this because it's valuable to capture recent possible failures.

@albertzaharovits albertzaharovits self-requested a review April 3, 2026 07:27
@michalborek michalborek merged commit a6a7be1 into elastic:main Apr 3, 2026
36 checks passed
mromaios pushed a commit to mromaios/elasticsearch that referenced this pull request Apr 9, 2026
Avoid concurrent execution of the same watch via schedule and API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Watcher Team:Distributed Meta label for distributed team. >test Issues or PRs that are addressing/adding tests v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] WatcherYamlRestIT test {p0=mustache/10_webhook/Test webhook action with mustache integration} failing

3 participants