File tree 3 files changed +16
-13
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 +16
-13
lines changed Original file line number Diff line number Diff line change @@ -969,14 +969,18 @@ protected static void ensureHealth(Consumer<Request> requestConsumer) throws IOE
969
969
}
970
970
971
971
protected static void ensureHealth (String index , Consumer <Request > requestConsumer ) throws IOException {
972
- Request request = new Request ("GET" , "/_cluster/health" + (index .trim ().isEmpty () ? "" : "/" + index ));
972
+ ensureHealth (client (), index , requestConsumer );
973
+ }
974
+
975
+ protected static void ensureHealth (RestClient client , String index , Consumer <Request > requestConsumer ) throws IOException {
976
+ Request request = new Request ("GET" , "/_cluster/health" + (index .isBlank () ? "" : "/" + index ));
973
977
requestConsumer .accept (request );
974
978
try {
975
- client () .performRequest (request );
979
+ client .performRequest (request );
976
980
} catch (ResponseException e ) {
977
981
if (e .getResponse ().getStatusLine ().getStatusCode () == HttpStatus .SC_REQUEST_TIMEOUT ) {
978
982
try {
979
- final Response clusterStateResponse = client () .performRequest (new Request ("GET" , "/_cluster/state?pretty" ));
983
+ final Response clusterStateResponse = client .performRequest (new Request ("GET" , "/_cluster/state?pretty" ));
980
984
fail ("timed out waiting for green state for index [" + index + "] " +
981
985
"cluster state [" + EntityUtils .toString (clusterStateResponse .getEntity ()) + "]" );
982
986
} 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 ;
22
23
import java .util .stream .Stream ;
23
24
24
25
import static org .elasticsearch .common .xcontent .ObjectPath .eval ;
@@ -48,7 +49,7 @@ public void testDowngradeRemoteClusterToBasic() throws Exception {
48
49
assertBusy (() -> {
49
50
ensureYellow (index1 );
50
51
verifyDocuments (index1 , 5 , "filtered_field:true" );
51
- });
52
+ }, 60 , TimeUnit . SECONDS );
52
53
53
54
String index2 = "logs-20190102" ;
54
55
try (RestClient leaderClient = buildLeaderClient ()) {
@@ -88,7 +89,7 @@ public void testDowngradeRemoteClusterToBasic() throws Exception {
88
89
}
89
90
});
90
91
}
91
- });
92
+ }, 60 , TimeUnit . SECONDS );
92
93
93
94
// Manually following index2 also does not work after the downgrade:
94
95
Exception e = expectThrows (ResponseException .class , () -> followIndex ("leader_cluster" , index2 ));
Original file line number Diff line number Diff line change @@ -215,14 +215,12 @@ 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
- 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 );
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
+ });
226
224
}
227
225
228
226
protected int countCcrNodeTasks () throws IOException {
You can’t perform that action at this time.
0 commit comments