Commit aaa9202
authored
[ML] Fix DatafeedJobsIT#testDatafeedTimingStats_DatafeedRecreated (#137086)
Problem:
The test was failing intermittently with AssertionError: Expected: a value greater than <0L> but: <0L> was equal to <0L> due to a race condition between data processing completion and asynchronous datafeed timing stats persistence.
Root Cause:
Datafeed timing stats are persisted asynchronously. The test's single assertBusy() block checked both data processing completion AND timing stats simultaneously. Data processing could complete before timing stats persistence finished, causing search_count to still appear as 0.
Solution:
Split the assertion into two phases:
Phase 1: Wait for data processing to complete (processedRecordCount == numDocs)
Phase 2: Wait for timing stats to be persisted (search_count > 0)
This eliminates the race condition while maintaining the test's validation goals and testing realistic client-observable behavior.1 parent f446a4b commit aaa9202
File tree
1 file changed
+11
-8
lines changed- x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration
1 file changed
+11
-8
lines changedLines changed: 11 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
232 | 231 | | |
233 | 232 | | |
234 | 233 | | |
235 | | - | |
236 | 234 | | |
237 | 235 | | |
238 | 236 | | |
| |||
254 | 252 | | |
255 | 253 | | |
256 | 254 | | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
262 | 266 | | |
263 | 267 | | |
264 | 268 | | |
| |||
788 | 792 | | |
789 | 793 | | |
790 | 794 | | |
791 | | - | |
792 | 795 | | |
793 | 796 | | |
794 | 797 | | |
| |||
0 commit comments