Skip to content

Commit cca719f

Browse files
Decouple CpsDoesNotUseSkipUnavailableIT's reliance on explicit skip_unavailable (#136194)
`skip_unavailable` will soon be unsettable in CPS environment. Any attempts to set it will result in an error. These changes are incompatible with this test since we explicitly set `skip_unavailable=false` here. To unblock the said changes, this test is being modified to move away from any explicit configuration or mentions of `skip_unavailable`.
1 parent 3c01daf commit cca719f

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

server/src/internalClusterTest/java/org/elasticsearch/search/ccs/CpsDoesNotUseSkipUnavailableIT.java

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import java.util.Collection;
2626
import java.util.List;
27-
import java.util.Map;
2827
import java.util.concurrent.ExecutionException;
2928

3029
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
@@ -61,12 +60,6 @@ protected Settings nodeSettings() {
6160
return Settings.builder().put(super.nodeSettings()).put("serverless.cross_project.enabled", "true").build();
6261
}
6362

64-
@Override
65-
protected Map<String, Boolean> skipUnavailableForRemoteClusters() {
66-
// Setting skip_unavailable=false results in a fatal error when the linked cluster is not available.
67-
return Map.of(LINKED_CLUSTER_1, false);
68-
}
69-
7063
public void testCpsShouldNotUseSkipUnavailable() throws Exception {
7164
// Add some dummy data to prove we are communicating fine with the remote.
7265
assertAcked(client(LINKED_CLUSTER_1).admin().indices().prepareCreate("test-index"));
@@ -80,11 +73,7 @@ public void testCpsShouldNotUseSkipUnavailable() throws Exception {
8073
throw new AssertionError(e);
8174
}
8275

83-
/*
84-
* Under normal circumstances, we should get a fatal error for when skip_unavailable=false for a linked cluster
85-
* and that cluster is targeted in a search op. However, in CPS environment, setting allow_partial_search_results=true
86-
* should not result in a fatal error.
87-
*/
76+
// 1. We first execute a search request with partial results allowed and shouldn't observe any top-level errors.
8877
{
8978
var searchRequest = getSearchRequest(true);
9079
searchRequest.setCcsMinimizeRoundtrips(randomBoolean());
@@ -108,11 +97,7 @@ public void testCpsShouldNotUseSkipUnavailable() throws Exception {
10897
});
10998
}
11099

111-
/*
112-
* Previously, we did not get a fatal error even when skip_unavailable=false for the linked cluster.
113-
* Now, we disable partial results and expect a fatal error. This proves that in CPS environment,
114-
* search uses allow_partial_search_results and not skip_unavailable.
115-
*/
100+
// 2. We now execute a search request with partial results disallowed and should observe a top-level error.
116101
{
117102
var searchRequest = getSearchRequest(false);
118103
searchRequest.setCcsMinimizeRoundtrips(randomBoolean());
@@ -123,6 +108,12 @@ public void testCpsShouldNotUseSkipUnavailable() throws Exception {
123108
Matchers.anyOf(Matchers.instanceOf(RemoteTransportException.class), Matchers.instanceOf(ConnectTransportException.class))
124109
);
125110
}
111+
112+
/*
113+
* We usually get a top-level error when skip_unavailable is false. However, irrespective of that setting in this test, we now
114+
* observe a top-level error when partial results are disallowed. This proves that skip_unavailable's scope has now shifted to
115+
* allow_partial_search_results in CPS environment.
116+
*/
126117
}
127118

128119
private SearchRequest getSearchRequest(boolean allowPartialResults) {

0 commit comments

Comments
 (0)