Browse Source

Fix flaky testNodeShutdownWithUnassignedShards (#94781)

This test can occasionally fail if the index is moved to nodeB (as a result of
a rebalance after starting second node) and do not need to be migrated in
response to the putNodeShutdown request.
Ievgen Degtiarenko 2 years ago
parent
commit
8a5de70303

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

@@ -414,7 +414,14 @@ public class NodeShutdownShardsIT extends ESIntegTestCase {
         final String nodeA = internalCluster().startNode();
         final String nodeAId = getNodeId(nodeA);
 
-        createIndex("index", 1, 0);
+        createIndex(
+            "index",
+            Settings.builder()
+                .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
+                .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
+                .put("index.routing.allocation.include._name", nodeA)
+                .build()
+        );
 
         ensureYellow("index");