Skip to content

Commit

Permalink
Remove changes for non-flaky tests (#11071)
Browse files Browse the repository at this point in the history
Signed-off-by: Ticheng Lin <ticheng@amazon.com>
  • Loading branch information
ticheng-aws committed Nov 3, 2023
1 parent 3ce73bf commit f09a93a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,12 @@ protected Settings featureFlagSettings() {
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.CONCURRENT_SEGMENT_SEARCH, "true").build();
}

public void testSimpleMultiSearch() throws Exception {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/11064",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
public void testSimpleMultiSearch() {
createIndex("test");
ensureGreen();
client().prepareIndex("test").setId("1").setSource("field", "xxx").get();
client().prepareIndex("test").setId("2").setSource("field", "yyy").get();
refresh();
indexRandomForConcurrentSearch("test");
MultiSearchResponse response = client().prepareMultiSearch()
.add(client().prepareSearch("test").setQuery(QueryBuilders.termQuery("field", "xxx")))
.add(client().prepareSearch("test").setQuery(QueryBuilders.termQuery("field", "yyy")))
Expand All @@ -99,18 +94,13 @@ public void testSimpleMultiSearch() throws Exception {
assertFirstHit(response.getResponses()[1].getResponse(), hasId("2"));
}

public void testSimpleMultiSearchMoreRequests() throws Exception {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/11064",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
public void testSimpleMultiSearchMoreRequests() {
createIndex("test");
int numDocs = randomIntBetween(0, 16);
for (int i = 0; i < numDocs; i++) {
client().prepareIndex("test").setId(Integer.toString(i)).setSource("{}", MediaTypeRegistry.JSON).get();
}
refresh();
indexRandomForConcurrentSearch("test");

int numSearchRequests = randomIntBetween(1, 64);
MultiSearchRequest request = new MultiSearchRequest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ protected Settings featureFlagSettings() {
}

public void testSimpleNested() throws Exception {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/11065",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
assertAcked(prepareCreate("test").setMapping("nested1", "type=nested"));
ensureGreen();

Expand Down Expand Up @@ -136,7 +132,6 @@ public void testSimpleNested() throws Exception {
refresh();
// check the numDocs
assertDocumentCount("test", 3);
indexRandomForConcurrentSearch("test");

searchResponse = client().prepareSearch("test").setQuery(termQuery("n_field1", "n_value1_1")).get();
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L));
Expand Down Expand Up @@ -505,10 +500,6 @@ public void testExplain() throws Exception {
}

public void testSimpleNestedSorting() throws Exception {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/11065",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
assertAcked(
prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).put("index.refresh_interval", -1))
.setMapping(
Expand Down Expand Up @@ -578,7 +569,6 @@ public void testSimpleNestedSorting() throws Exception {
)
.get();
refresh();
indexRandomForConcurrentSearch("test");

SearchResponse searchResponse = client().prepareSearch("test")
.setQuery(QueryBuilders.matchAllQuery())
Expand Down Expand Up @@ -608,10 +598,6 @@ public void testSimpleNestedSorting() throws Exception {
}

public void testSimpleNestedSortingWithNestedFilterMissing() throws Exception {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/11065",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
assertAcked(
prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).put("index.refresh_interval", -1))
.setMapping(
Expand Down Expand Up @@ -672,7 +658,6 @@ public void testSimpleNestedSortingWithNestedFilterMissing() throws Exception {
.get();
// Doc with missing nested docs if nested filter is used
refresh();
indexRandomForConcurrentSearch("test");
client().prepareIndex("test")
.setId("3")
.setSource(
Expand All @@ -692,7 +677,6 @@ public void testSimpleNestedSortingWithNestedFilterMissing() throws Exception {
)
.get();
refresh();
indexRandomForConcurrentSearch("test");

SearchRequestBuilder searchRequestBuilder = client().prepareSearch("test")
.setQuery(QueryBuilders.matchAllQuery())
Expand Down Expand Up @@ -745,10 +729,6 @@ public void testSimpleNestedSortingWithNestedFilterMissing() throws Exception {
}

public void testNestedSortWithMultiLevelFiltering() throws Exception {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/11065",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
assertAcked(
prepareCreate("test").setMapping(
"{\n"
Expand Down Expand Up @@ -885,7 +865,6 @@ public void testNestedSortWithMultiLevelFiltering() throws Exception {
)
.get();
refresh();
indexRandomForConcurrentSearch("test");

// access id = 1, read, max value, asc, should use grault and quxx
SearchResponse searchResponse = client().prepareSearch()
Expand Down Expand Up @@ -1084,10 +1063,6 @@ public void testLeakingSortValues() throws Exception {
}

public void testSortNestedWithNestedFilter() throws Exception {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/11065",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
assertAcked(
prepareCreate("test").setMapping(
XContentFactory.jsonBuilder()
Expand Down Expand Up @@ -1248,7 +1223,6 @@ public void testSortNestedWithNestedFilter() throws Exception {
.get();
refresh();

indexRandomForConcurrentSearch("test");
// Without nested filter
SearchResponse searchResponse = client().prepareSearch()
.setQuery(matchAllQuery())
Expand Down Expand Up @@ -1486,10 +1460,6 @@ public void testSortNestedWithNestedFilter() throws Exception {

// Issue #9305
public void testNestedSortingWithNestedFilterAsFilter() throws Exception {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/11065",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
assertAcked(
prepareCreate("test").setMapping(
jsonBuilder().startObject()
Expand Down Expand Up @@ -1632,7 +1602,6 @@ public void testNestedSortingWithNestedFilterAsFilter() throws Exception {
.get();
assertTrue(indexResponse2.getShardInfo().getSuccessful() > 0);
refresh();
indexRandomForConcurrentSearch("test");

SearchResponse searchResponse = client().prepareSearch("test")
.addSort(SortBuilders.fieldSort("users.first").setNestedPath("users").order(SortOrder.ASC))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,12 @@ public void testNoPreferenceRandom() throws Exception {
assertThat(firstNodeId, not(equalTo(secondNodeId)));
}

public void testSimplePreference() throws Exception {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/11066",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
public void testSimplePreference() {
client().admin().indices().prepareCreate("test").setSettings("{\"number_of_replicas\": 1}", MediaTypeRegistry.JSON).get();
ensureGreen();

client().prepareIndex("test").setSource("field1", "value1").get();
refresh();
indexRandomForConcurrentSearch("test");

SearchResponse searchResponse = client().prepareSearch().setQuery(matchAllQuery()).get();
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
Expand Down Expand Up @@ -269,17 +264,14 @@ private void assertSearchOnRandomNodes(SearchRequestBuilder request) {
assertThat(hitNodes.size(), greaterThan(1));
}

public void testCustomPreferenceUnaffectedByOtherShardMovements() throws Exception {
public void testCustomPreferenceUnaffectedByOtherShardMovements() {

/*
* Custom preferences can be used to encourage searches to go to a consistent set of shard copies, meaning that other copies' data
* is rarely touched and can be dropped from the filesystem cache. This works best if the set of shards searched doesn't change
* unnecessarily, so this test verifies a consistent routing even as other shards are created/relocated/removed.
*/
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/11066",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);

assertAcked(
prepareCreate("test").setSettings(
Settings.builder()
Expand All @@ -291,7 +283,6 @@ public void testCustomPreferenceUnaffectedByOtherShardMovements() throws Excepti
ensureGreen();
client().prepareIndex("test").setSource("field1", "value1").get();
refresh();
indexRandomForConcurrentSearch("test");

final String customPreference = randomAlphaOfLength(10);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,15 +433,10 @@ public void testSimpleQueryStringUsesFieldAnalyzer() throws Exception {
}

public void testSimpleQueryStringOnIndexMetaField() throws Exception {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/11067",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
client().prepareIndex("test").setId("1").setSource("foo", 123, "bar", "abc").get();
client().prepareIndex("test").setId("2").setSource("foo", 234, "bar", "bcd").get();

refresh();
indexRandomForConcurrentSearch("test");

SearchResponse searchResponse = client().prepareSearch().setQuery(simpleQueryStringQuery("test").field("_index")).get();
assertHitCount(searchResponse, 2L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,6 @@ public Settings indexSettings() {
}

public void testCustomScriptBinaryField() throws Exception {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/11070",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
final byte[] randomBytesDoc1 = getRandomBytes(15);
final byte[] randomBytesDoc2 = getRandomBytes(16);

Expand All @@ -165,7 +161,6 @@ public void testCustomScriptBinaryField() throws Exception {
.get();
flush();
refresh();
indexRandomForConcurrentSearch("my-index");

SearchResponse response = client().prepareSearch()
.setQuery(
Expand Down Expand Up @@ -202,10 +197,6 @@ private XContentBuilder createMappingSource(String fieldType) throws IOException
}

public void testCustomScriptBoost() throws Exception {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/11070",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
createIndex("test");
client().prepareIndex("test")
.setId("1")
Expand All @@ -222,7 +213,6 @@ public void testCustomScriptBoost() throws Exception {
.setSource(jsonBuilder().startObject().field("test", "value beck").field("num1", 3.0f).endObject())
.get();
refresh();
indexRandomForConcurrentSearch("test");

logger.info("running doc['num1'].value > 1");
SearchResponse response = client().prepareSearch()
Expand Down Expand Up @@ -270,18 +260,13 @@ public void testCustomScriptBoost() throws Exception {
}

public void testDisallowExpensiveQueries() {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/11070",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
try {
assertAcked(prepareCreate("test-index").setMapping("num1", "type=double"));
int docCount = 10;
for (int i = 1; i <= docCount; i++) {
client().prepareIndex("test-index").setId("" + i).setSource("num1", i).get();
}
refresh();
indexRandomForConcurrentSearch("test-index");

// Execute with search.allow_expensive_queries = null => default value = false => success
Script script = new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "doc['num1'].value > 1", Collections.emptyMap());
Expand All @@ -308,8 +293,6 @@ public void testDisallowExpensiveQueries() {
assertAcked(client().admin().cluster().updateSettings(updateSettingsRequest).actionGet());
resp = client().prepareSearch("test-index").setQuery(scriptQuery(script)).get();
assertNoFailures(resp);
} catch (InterruptedException e) {
throw new RuntimeException(e);
} finally {
ClusterUpdateSettingsRequest updateSettingsRequest = new ClusterUpdateSettingsRequest();
updateSettingsRequest.persistentSettings(Settings.builder().put("search.allow_expensive_queries", (String) null));
Expand Down

0 comments on commit f09a93a

Please sign in to comment.