Skip to content

Commit 9dad82e

Browse files
authored
TEST: Skip assertSeqNos for closed shards (#33130)
If a shard was closed, we return null for SeqNoStats. Therefore the assertion assertSeqNos will hit NPE when it verifies a closed shard. This commit skips closed shards in assertSeqNos and enables this assertion in AbstractDisruptionTestCase.
1 parent 739a8d3 commit 9dad82e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

server/src/test/java/org/elasticsearch/discovery/AbstractDisruptionTestCase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public void setDisruptionScheme(ServiceDisruptionScheme scheme) {
109109
protected void beforeIndexDeletion() throws Exception {
110110
if (disableBeforeIndexDeletion == false) {
111111
super.beforeIndexDeletion();
112+
assertSeqNos();
112113
}
113114
}
114115

test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,6 +2349,9 @@ protected void assertSeqNos() throws Exception {
23492349
final ObjectLongMap<String> globalCheckpoints = indexShard.getInSyncGlobalCheckpoints();
23502350
for (ShardStats shardStats : indexShardStats) {
23512351
final SeqNoStats seqNoStats = shardStats.getSeqNoStats();
2352+
if (seqNoStats == null) {
2353+
continue; // this shard was closed
2354+
}
23522355
assertThat(shardStats.getShardRouting() + " local checkpoint mismatch",
23532356
seqNoStats.getLocalCheckpoint(), equalTo(primarySeqNoStats.getLocalCheckpoint()));
23542357
assertThat(shardStats.getShardRouting() + " global checkpoint mismatch",

0 commit comments

Comments
 (0)