Skip to content

Commit

Permalink
Node shutdown test integration test (elastic#114582)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
idegtiarenko authored Oct 14, 2024
1 parent c4118c6 commit 8c31d80
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,32 @@ public void testAutoExpandDuringReplace() throws Exception {
assertIndexSetting("index", "index.number_of_replicas", "1");
}

public void testAutoExpandDuringShutdown() throws Exception {

var node1 = internalCluster().startNode();
var node2 = internalCluster().startNode();

createIndex("index", indexSettings(1, 0).put("index.auto_expand_replicas", randomFrom("0-all", "0-1")).build());
indexRandomData("index");

ensureGreen("index");
assertIndexSetting("index", "index.number_of_replicas", "1");

var nodeNameToShutdown = randomFrom(node1, node2);
var nodeIdToShutdown = getNodeId(nodeNameToShutdown);

putNodeShutdown(nodeIdToShutdown, SingleNodeShutdownMetadata.Type.REMOVE, null);

ensureGreen("index");
assertIndexSetting("index", "index.number_of_replicas", "0");

assertBusy(() -> assertNodeShutdownStatus(nodeIdToShutdown, COMPLETE));
internalCluster().stopNode(nodeIdToShutdown);

ensureGreen("index");
assertIndexSetting("index", "index.number_of_replicas", "0");
}

public void testNodeShutdownWithUnassignedShards() throws Exception {
final String nodeA = internalCluster().startNode();
final String nodeAId = getNodeId(nodeA);
Expand Down

0 comments on commit 8c31d80

Please sign in to comment.