Skip to content

Commit e0b32cf

Browse files
committed
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
1 parent 9e8c576 commit e0b32cf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import static org.hamcrest.Matchers.containsString;
5858
import static org.hamcrest.Matchers.equalTo;
5959
import static org.hamcrest.Matchers.greaterThan;
60+
import static org.hamcrest.Matchers.hasSize;
6061
import static org.hamcrest.Matchers.notNullValue;
6162

6263
/**
@@ -934,10 +935,14 @@ public void testHistoryUUIDIsAdded() throws Exception {
934935
createIndex.setJsonEntity(Strings.toString(mappingsAndSettings));
935936
client().performRequest(createIndex);
936937
} else {
938+
ensureGreenLongWait(index);
939+
937940
Request statsRequest = new Request("GET", index + "/_stats");
938941
statsRequest.addParameter("level", "shards");
939942
Response response = client().performRequest(statsRequest);
940943
List<Object> shardStats = ObjectPath.createFromResponse(response).evaluate("indices." + index + ".shards.0");
944+
assertThat(shardStats, notNullValue());
945+
assertThat("Expected stats for 2 shards", shardStats, hasSize(2));
941946
String globalHistoryUUID = null;
942947
for (Object shard : shardStats) {
943948
final String nodeId = ObjectPath.evaluate(shard, "routing.node");

0 commit comments

Comments
 (0)