Fix FullClusterRestartIT.testHistoryUUIDIsAdded (#38098)
This test failed once because the index wasn't fully ready (ie, engine opened). This commit changes the test so that it waits for the index to be green before checking the history UUID. Closes #34452
This commit is contained in:
parent
6c5a7387af
commit
0e6a7c20a1
|
@ -68,6 +68,7 @@ import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER
|
|||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.hamcrest.Matchers.startsWith;
|
||||
|
||||
|
@ -970,10 +971,14 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
|||
createIndex.setJsonEntity(Strings.toString(mappingsAndSettings));
|
||||
client().performRequest(createIndex);
|
||||
} else {
|
||||
ensureGreenLongWait(index);
|
||||
|
||||
Request statsRequest = new Request("GET", index + "/_stats");
|
||||
statsRequest.addParameter("level", "shards");
|
||||
Response response = client().performRequest(statsRequest);
|
||||
List<Object> shardStats = ObjectPath.createFromResponse(response).evaluate("indices." + index + ".shards.0");
|
||||
assertThat(shardStats, notNullValue());
|
||||
assertThat("Expected stats for 2 shards", shardStats, hasSize(2));
|
||||
String globalHistoryUUID = null;
|
||||
for (Object shard : shardStats) {
|
||||
final String nodeId = ObjectPath.evaluate(shard, "routing.node");
|
||||
|
|
Loading…
Reference in New Issue