Skip to content

Commit 84f4f39

Browse files
authored
Filter on node id in AllocationIdIT (#48623)
Makes the assertions more targeted. Relates #48529
1 parent 87bf0bc commit 84f4f39

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

server/src/test/java/org/elasticsearch/cluster/routing/AllocationIdIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,10 @@ private IndexSettings getIndexSettings(String indexName, String nodeName) {
208208

209209
private String historyUUID(String node, String indexName) {
210210
final ShardStats[] shards = client(node).admin().indices().prepareStats(indexName).clear().get().getShards();
211+
final String nodeId = client(node).admin().cluster().prepareState().get().getState().nodes().resolveNode(node).getId();
211212
assertThat(shards.length, greaterThan(0));
212213
final Set<String> historyUUIDs = Arrays.stream(shards)
214+
.filter(shard -> shard.getShardRouting().currentNodeId().equals(nodeId))
213215
.map(shard -> shard.getCommitStats().getUserData().get(Engine.HISTORY_UUID_KEY))
214216
.collect(Collectors.toSet());
215217
assertThat(historyUUIDs, hasSize(1));

0 commit comments

Comments
 (0)