Skip to content

Commit 081ea1b

Browse files
idegtiarenkogeorgewallace
authored andcommitted
Node shutdown test integration test (elastic#114582)
This change adds a test case that verifies that the node can be shutdown while hosting an index with 0-1 or 0-all auto-expand configuration.
1 parent 48addb7 commit 081ea1b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

x-pack/plugin/shutdown/src/internalClusterTest/java/org/elasticsearch/xpack/shutdown/NodeShutdownShardsIT.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,32 @@ public void testAutoExpandDuringReplace() throws Exception {
375375
assertIndexSetting("index", "index.number_of_replicas", "1");
376376
}
377377

378+
public void testAutoExpandDuringShutdown() throws Exception {
379+
380+
var node1 = internalCluster().startNode();
381+
var node2 = internalCluster().startNode();
382+
383+
createIndex("index", indexSettings(1, 0).put("index.auto_expand_replicas", randomFrom("0-all", "0-1")).build());
384+
indexRandomData("index");
385+
386+
ensureGreen("index");
387+
assertIndexSetting("index", "index.number_of_replicas", "1");
388+
389+
var nodeNameToShutdown = randomFrom(node1, node2);
390+
var nodeIdToShutdown = getNodeId(nodeNameToShutdown);
391+
392+
putNodeShutdown(nodeIdToShutdown, SingleNodeShutdownMetadata.Type.REMOVE, null);
393+
394+
ensureGreen("index");
395+
assertIndexSetting("index", "index.number_of_replicas", "0");
396+
397+
assertBusy(() -> assertNodeShutdownStatus(nodeIdToShutdown, COMPLETE));
398+
internalCluster().stopNode(nodeIdToShutdown);
399+
400+
ensureGreen("index");
401+
assertIndexSetting("index", "index.number_of_replicas", "0");
402+
}
403+
378404
public void testNodeShutdownWithUnassignedShards() throws Exception {
379405
final String nodeA = internalCluster().startNode();
380406
final String nodeAId = getNodeId(nodeA);

0 commit comments

Comments
 (0)