Dump cluster state if ensureGreen timed out in QA tests (#40133)
When the method ensureGreen in QA tests is timed out, it does not provide enough info for us to investigate why the testing index is not green yet. With this change, we will dump the cluster state if ensureGreen timed out. Relates #32027
This commit is contained in:
parent
d720a64b9e
commit
9ba0bdf528
|
@ -808,7 +808,20 @@ public abstract class ESRestTestCase extends ESTestCase {
|
|||
request.addParameter("wait_for_no_relocating_shards", "true");
|
||||
request.addParameter("timeout", "70s");
|
||||
request.addParameter("level", "shards");
|
||||
client().performRequest(request);
|
||||
try {
|
||||
client().performRequest(request);
|
||||
} catch (ResponseException e) {
|
||||
if (e.getResponse().getStatusLine().getStatusCode() == HttpStatus.SC_REQUEST_TIMEOUT) {
|
||||
try {
|
||||
final Response clusterStateResponse = client().performRequest(new Request("GET", "/_cluster/state"));
|
||||
fail("timed out waiting for green state for index [" + index + "] " +
|
||||
"cluster state [" + EntityUtils.toString(clusterStateResponse.getEntity()) + "]");
|
||||
} catch (Exception inner) {
|
||||
e.addSuppressed(inner);
|
||||
}
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue