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

Add indexRandomForConcurrentSearch method to tests: #11118

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
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 @@ -169,7 +169,7 @@ private Settings.Builder settingsBuilder() {
return Settings.builder().put(indexSettings());
}

public void testFieldDataStats() {
public void testFieldDataStats() throws InterruptedException {
assertAcked(
client().admin()
.indices()
Expand All @@ -182,6 +182,7 @@ public void testFieldDataStats() {
client().prepareIndex("test").setId("1").setSource("field", "value1", "field2", "value1").execute().actionGet();
client().prepareIndex("test").setId("2").setSource("field", "value2", "field2", "value2").execute().actionGet();
client().admin().indices().prepareRefresh().execute().actionGet();
indexRandomForConcurrentSearch("test");

NodesStatsResponse nodesStats = client().admin().cluster().prepareNodesStats("data:true").setIndices(true).execute().actionGet();
assertThat(
Expand Down Expand Up @@ -305,6 +306,7 @@ public void testClearAllCaches() throws Exception {
client().prepareIndex("test").setId("1").setSource("field", "value1").execute().actionGet();
client().prepareIndex("test").setId("2").setSource("field", "value2").execute().actionGet();
client().admin().indices().prepareRefresh().execute().actionGet();
indexRandomForConcurrentSearch("test");

NodesStatsResponse nodesStats = client().admin().cluster().prepareNodesStats("data:true").setIndices(true).execute().actionGet();
assertThat(
Expand Down
jed326 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public void testSimpleTimeout() throws Exception {
client().prepareIndex("test").setId(Integer.toString(i)).setSource("field", "value").get();
}
refresh("test");
indexRandomForConcurrentSearch("test");

SearchResponse searchResponse = client().prepareSearch("test")
.setTimeout(new TimeValue(5, TimeUnit.MILLISECONDS))
Expand All @@ -104,12 +105,11 @@ public void testSimpleTimeout() throws Exception {
}

public void testSimpleDoesNotTimeout() throws Exception {
final int numDocs = 10;
final int numDocs = 9;
jed326 marked this conversation as resolved.
Show resolved Hide resolved
for (int i = 0; i < numDocs; i++) {
client().prepareIndex("test").setId(Integer.toString(i)).setSource("field", "value").get();
client().prepareIndex("test").setId(Integer.toString(i)).setSource("field", "value").setRefreshPolicy(IMMEDIATE).get();
}
refresh("test");

indexRandomForConcurrentSearch("test");
SearchResponse searchResponse = client().prepareSearch("test")
.setTimeout(new TimeValue(10000, TimeUnit.SECONDS))
.setQuery(scriptQuery(new Script(ScriptType.INLINE, "mockscript", SCRIPT_NAME, Collections.emptyMap())))
Expand All @@ -122,7 +122,7 @@ public void testSimpleDoesNotTimeout() throws Exception {

public void testPartialResultsIntolerantTimeout() throws Exception {
client().prepareIndex("test").setId("1").setSource("field", "value").setRefreshPolicy(IMMEDIATE).get();

indexRandomForConcurrentSearch("test");
OpenSearchException ex = expectThrows(
OpenSearchException.class,
() -> client().prepareSearch("test")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public void setupSuiteScopeCluster() throws Exception {
client().prepareIndex("idx").setSource(source.endObject()).get();
}
refresh();
jed326 marked this conversation as resolved.
Show resolved Hide resolved
indexRandomForMultipleSlices("idx");
ensureSearchable();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ public void setupSuiteScopeCluster() throws Exception {
)
);
indexRandom(true, builders);
indexRandomForMultipleSlices("idx");
ensureSearchable();
}

Expand Down Expand Up @@ -354,6 +355,7 @@ public void testNestedAsSubAggregation() throws Exception {
}

public void testNestNestedAggs() throws Exception {
indexRandomForConcurrentSearch("idx_nested_nested_aggs");
SearchResponse response = client().prepareSearch("idx_nested_nested_aggs")
.addAggregation(
nested("level1", "nested1").subAggregation(
Expand Down Expand Up @@ -607,6 +609,7 @@ public void testNestedSameDocIdProcessedMultipleTime() throws Exception {
)
.get();
refresh();
indexRandomForConcurrentSearch("idx4");

SearchResponse response = client().prepareSearch("idx4")
.addAggregation(
Expand Down Expand Up @@ -782,6 +785,7 @@ public void testFilterAggInsideNestedAgg() throws Exception {
)
.get();
refresh();
indexRandomForConcurrentSearch("classes");

SearchResponse response = client().prepareSearch("classes")
.addAggregation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ public void setupSuiteScopeCluster() throws Exception {
builders.add(client().prepareIndex("new_index").setSource(Collections.emptyMap()));

indexRandom(true, builders);
indexRandomForMultipleSlices("idx", "old_index", "new_index");
jed326 marked this conversation as resolved.
Show resolved Hide resolved
ensureSearchable();
}

Expand Down Expand Up @@ -917,6 +918,7 @@ public void testOverlappingRanges() throws Exception {
}

public void testEmptyAggregation() throws Exception {
indexRandomForConcurrentSearch("empty_bucket_idx");
SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx")
.setQuery(matchAllQuery())
.addAggregation(
Expand Down
Loading