Skip to content

Commit f76ce43

Browse files
[ML][TEST] Fix bucket count assertion in all tests in ModelPlotsIT (#31026)
This fixes the last remaining test that was missed in #30717. Closes #30715
1 parent b991365 commit f76ce43

File tree

1 file changed

+5
-1
lines changed
  • x-pack/qa/ml-native-tests/src/test/java/org/elasticsearch/xpack/ml/integration

1 file changed

+5
-1
lines changed

x-pack/qa/ml-native-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ModelPlotsIT.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ public void testByFieldWithTerms() throws Exception {
129129
startDatafeed(datafeedId, 0, System.currentTimeMillis());
130130
waitUntilJobIsClosed(job.getId());
131131

132-
assertThat(getBuckets(job.getId()).size(), equalTo(23));
132+
// As the initial time is random, there's a chance the first record is
133+
// aligned on a bucket start. Thus we check the buckets are in [23, 24]
134+
assertThat(getBuckets(job.getId()).size(), greaterThanOrEqualTo(23));
135+
assertThat(getBuckets(job.getId()).size(), lessThanOrEqualTo(24));
136+
133137
Set<String> modelPlotTerms = modelPlotTerms(job.getId(), "by_field_value");
134138
assertThat(modelPlotTerms, containsInAnyOrder("user_2", "user_3"));
135139
}

0 commit comments

Comments
 (0)