Skip to content
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

[ML][TEST] Fix bucket count assertion in ModelPlotsIT #30717

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@

import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThanOrEqualTo;

public class ModelPlotsIT extends MlNativeAutodetectIntegTestCase {

Expand Down Expand Up @@ -83,7 +85,11 @@ public void testPartitionFieldWithoutTerms() throws Exception {
startDatafeed(datafeedId, 0, System.currentTimeMillis());
waitUntilJobIsClosed(job.getId());

assertThat(getBuckets(job.getId()).size(), equalTo(23));
// As the initial time is random, there's a chance the first record is
// aligned on a bucket start. Thus we check the buckets are in [23, 24]
assertThat(getBuckets(job.getId()).size(), greaterThanOrEqualTo(23));
assertThat(getBuckets(job.getId()).size(), lessThanOrEqualTo(24));

Set<String> modelPlotTerms = modelPlotTerms(job.getId(), "partition_field_value");
assertThat(modelPlotTerms, containsInAnyOrder("user_1", "user_2", "user_3"));
}
Expand All @@ -101,7 +107,11 @@ public void testPartitionFieldWithTerms() throws Exception {
startDatafeed(datafeedId, 0, System.currentTimeMillis());
waitUntilJobIsClosed(job.getId());

assertThat(getBuckets(job.getId()).size(), equalTo(23));
// As the initial time is random, there's a chance the first record is
// aligned on a bucket start. Thus we check the buckets are in [23, 24]
assertThat(getBuckets(job.getId()).size(), greaterThanOrEqualTo(23));
assertThat(getBuckets(job.getId()).size(), lessThanOrEqualTo(24));

Set<String> modelPlotTerms = modelPlotTerms(job.getId(), "partition_field_value");
assertThat(modelPlotTerms, containsInAnyOrder("user_2", "user_3"));
}
Expand Down