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

Fix random sampler consistency test #107957

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -22,6 +22,7 @@

import static org.elasticsearch.search.aggregations.AggregationBuilders.avg;
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertResponse;
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
import static org.hamcrest.Matchers.equalTo;
Expand Down Expand Up @@ -85,11 +86,13 @@ public void setupSuiteScopeCluster() throws Exception {
ensureSearchable();
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/105839")
public void testRandomSamplerConsistentSeed() {
double[] sampleMonotonicValue = new double[1];
double[] sampleNumericValue = new double[1];
long[] sampledDocCount = new long[1];
// Force merge to ensure segment consistency as any segment merging can change which particular documents
// are sampled
assertNoFailures(indicesAdmin().prepareForceMerge("idx").setMaxNumSegments(1).get());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that idx index is setup and indexed once for all tests in this module. Is this correct? If so, I have 2 questions:

  • Is it being force-merged to 1 segment having any influence on other tests?
  • Does it make sense to move force-merge to setupSuiteScopeCluster()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct. I moved the force merge into the setup. That is fine for the other tests as well.

// initialize the values
assertResponse(
prepareSearch("idx").setPreference("shard:0")
Expand Down