Skip to content

Commit

Permalink
Revert "Refactors CrossClusterSearchTests to fix flaky behavior" (ope…
Browse files Browse the repository at this point in the history
…nsearch-project#3552)

Reverts opensearch-project#3526 as the exit criteria was not
satisfied.
  • Loading branch information
DarshitChanpura authored Oct 17, 2023
1 parent ece5e55 commit 904a966
Showing 1 changed file with 26 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Arrays;

import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;
Expand Down Expand Up @@ -246,17 +245,18 @@ public void shouldSearchForDocumentOnBothClustersWhenIndexOnBothClusterArePointe
SearchRequest searchRequest = SearchRequestFactory.searchAll(REMOTE_SONG_INDEX, SONG_INDEX_NAME);
searchRequest.setCcsMinimizeRoundtrips(ccsMinimizeRoundtrips);

List<Pair<String, String>> documentIdsList = Arrays.asList(
Pair.of(SONG_INDEX_NAME, SONG_ID_1R),
Pair.of(SONG_INDEX_NAME, SONG_ID_2L),
Pair.of(SONG_INDEX_NAME, SONG_ID_6R)
);

SearchResponse response = restHighLevelClient.search(searchRequest, DEFAULT);

assertThat(response, isSuccessfulSearchResponse());
assertThat(response, numberOfTotalHitsIsEqualTo(3));
assertThat(response, searchHitsContainDocumentsInAnyOrder(documentIdsList));
assertThat(
response,
searchHitsContainDocumentsInAnyOrder(
Pair.of(SONG_INDEX_NAME, SONG_ID_1R),
Pair.of(SONG_INDEX_NAME, SONG_ID_2L),
Pair.of(SONG_INDEX_NAME, SONG_ID_6R)
)
);
}
}

Expand Down Expand Up @@ -286,18 +286,19 @@ public void shouldSearchViaAllAliasOnRemoteCluster_positive() throws IOException
try (RestHighLevelClient restHighLevelClient = cluster.getRestHighLevelClient(ADMIN_USER)) {
SearchRequest searchRequest = searchAll(REMOTE_CLUSTER_NAME + ":_all");

List<Pair<String, String>> documentIdsList = Arrays.asList(
Pair.of(SONG_INDEX_NAME, SONG_ID_1R),
Pair.of(SONG_INDEX_NAME, SONG_ID_6R),
Pair.of(PROHIBITED_SONG_INDEX_NAME, SONG_ID_3R),
Pair.of(LIMITED_USER_INDEX_NAME, SONG_ID_5R)
);

SearchResponse response = restHighLevelClient.search(searchRequest, DEFAULT);

assertThat(response, isSuccessfulSearchResponse());
assertThat(response, numberOfTotalHitsIsEqualTo(4));
assertThat(response, searchHitsContainDocumentsInAnyOrder(documentIdsList));
assertThat(
response,
searchHitsContainDocumentsInAnyOrder(
Pair.of(SONG_INDEX_NAME, SONG_ID_1R),
Pair.of(SONG_INDEX_NAME, SONG_ID_6R),
Pair.of(PROHIBITED_SONG_INDEX_NAME, SONG_ID_3R),
Pair.of(LIMITED_USER_INDEX_NAME, SONG_ID_5R)
)
);
}
}

Expand All @@ -315,18 +316,19 @@ public void shouldSearchAllIndexOnRemoteClusterWhenStarIsUsedAsIndexName_positiv
try (RestHighLevelClient restHighLevelClient = cluster.getRestHighLevelClient(ADMIN_USER)) {
SearchRequest searchRequest = searchAll(REMOTE_CLUSTER_NAME + ":*");

List<Pair<String, String>> documentIdsList = Arrays.asList(
Pair.of(SONG_INDEX_NAME, SONG_ID_1R),
Pair.of(SONG_INDEX_NAME, SONG_ID_6R),
Pair.of(PROHIBITED_SONG_INDEX_NAME, SONG_ID_3R),
Pair.of(LIMITED_USER_INDEX_NAME, SONG_ID_5R)
);

SearchResponse response = restHighLevelClient.search(searchRequest, DEFAULT);

assertThat(response, isSuccessfulSearchResponse());
assertThat(response, numberOfTotalHitsIsEqualTo(4));
assertThat(response, searchHitsContainDocumentsInAnyOrder(documentIdsList));
assertThat(
response,
searchHitsContainDocumentsInAnyOrder(
Pair.of(SONG_INDEX_NAME, SONG_ID_1R),
Pair.of(SONG_INDEX_NAME, SONG_ID_6R),
Pair.of(PROHIBITED_SONG_INDEX_NAME, SONG_ID_3R),
Pair.of(LIMITED_USER_INDEX_NAME, SONG_ID_5R)
)
);
}
}

Expand Down

0 comments on commit 904a966

Please sign in to comment.