Skip to content

Commit

Permalink
Fix FullClusterRestartIT.testHistoryUUIDIsAdded (#38098)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tlrx authored Feb 1, 2019
1 parent 6c5a738 commit 0e6a7c2
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
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;

Expand Down Expand Up @@ -970,10 +971,14 @@ public void testHistoryUUIDIsAdded() throws Exception {
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");
Expand Down

0 comments on commit 0e6a7c2

Please sign in to comment.