File tree 3 files changed +12
-15
lines changed
test/framework/src/main/java/org/elasticsearch/test/rest
downgrade-to-basic-license/src/test/java/org/elasticsearch/xpack/ccr
src/main/java/org/elasticsearch/xpack/ccr
3 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -950,18 +950,14 @@ protected static void ensureHealth(Consumer<Request> requestConsumer) throws IOE
950
950
}
951
951
952
952
protected static void ensureHealth (String index , Consumer <Request > requestConsumer ) throws IOException {
953
- ensureHealth (client (), index , requestConsumer );
954
- }
955
-
956
- protected static void ensureHealth (RestClient client , String index , Consumer <Request > requestConsumer ) throws IOException {
957
953
Request request = new Request ("GET" , "/_cluster/health" + (index .isBlank () ? "" : "/" + index ));
958
954
requestConsumer .accept (request );
959
955
try {
960
- client .performRequest (request );
956
+ client () .performRequest (request );
961
957
} catch (ResponseException e ) {
962
958
if (e .getResponse ().getStatusLine ().getStatusCode () == HttpStatus .SC_REQUEST_TIMEOUT ) {
963
959
try {
964
- final Response clusterStateResponse = client .performRequest (new Request ("GET" , "/_cluster/state?pretty" ));
960
+ final Response clusterStateResponse = client () .performRequest (new Request ("GET" , "/_cluster/state?pretty" ));
965
961
fail ("timed out waiting for green state for index [" + index + "] " +
966
962
"cluster state [" + EntityUtils .toString (clusterStateResponse .getEntity ()) + "]" );
967
963
} catch (Exception inner ) {
Original file line number Diff line number Diff line change 19
19
import java .io .IOException ;
20
20
import java .nio .file .Path ;
21
21
import java .util .Map ;
22
- import java .util .concurrent .TimeUnit ;
23
22
import java .util .stream .Stream ;
24
23
25
24
import static org .elasticsearch .common .xcontent .ObjectPath .eval ;
@@ -49,7 +48,7 @@ public void testDowngradeRemoteClusterToBasic() throws Exception {
49
48
assertBusy (() -> {
50
49
ensureYellow (index1 );
51
50
verifyDocuments (index1 , 5 , "filtered_field:true" );
52
- }, 60 , TimeUnit . SECONDS );
51
+ });
53
52
54
53
String index2 = "logs-20190102" ;
55
54
try (RestClient leaderClient = buildLeaderClient ()) {
@@ -89,7 +88,7 @@ public void testDowngradeRemoteClusterToBasic() throws Exception {
89
88
}
90
89
});
91
90
}
92
- }, 60 , TimeUnit . SECONDS );
91
+ });
93
92
94
93
// Manually following index2 also does not work after the downgrade:
95
94
Exception e = expectThrows (ResponseException .class , () -> followIndex ("leader_cluster" , index2 ));
Original file line number Diff line number Diff line change @@ -215,12 +215,14 @@ protected static void ensureYellow(final String index) throws IOException {
215
215
}
216
216
217
217
protected static void ensureYellow (final String index , final RestClient client ) throws IOException {
218
- ensureHealth (client , index , request -> {
219
- request .addParameter ("wait_for_status" , "yellow" );
220
- request .addParameter ("wait_for_no_relocating_shards" , "true" );
221
- request .addParameter ("timeout" , "5s" );
222
- request .addParameter ("level" , "shards" );
223
- });
218
+ final Request request = new Request ("GET" , "/_cluster/health/" + index );
219
+ request .addParameter ("wait_for_status" , "yellow" );
220
+ request .addParameter ("wait_for_active_shards" , "1" );
221
+ request .addParameter ("wait_for_no_relocating_shards" , "true" );
222
+ request .addParameter ("wait_for_no_initializing_shards" , "true" );
223
+ request .addParameter ("timeout" , "5s" );
224
+ request .addParameter ("level" , "shards" );
225
+ client .performRequest (request );
224
226
}
225
227
226
228
protected int countCcrNodeTasks () throws IOException {
You can’t perform that action at this time.
0 commit comments