Skip to content

Commit 3ecb991

Browse files
authored
Run HeapAttackIT with no replicas (#124226)
1 parent c72d00f commit 3ecb991

File tree

1 file changed

+6
-0
lines changed
  • test/external-modules/esql-heap-attack/src/javaRestTest/java/org/elasticsearch/xpack/esql/heap_attack

1 file changed

+6
-0
lines changed

test/external-modules/esql-heap-attack/src/javaRestTest/java/org/elasticsearch/xpack/esql/heap_attack/HeapAttackIT.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import org.elasticsearch.client.ResponseException;
2020
import org.elasticsearch.client.RestClient;
2121
import org.elasticsearch.client.WarningsHandler;
22+
import org.elasticsearch.cluster.metadata.IndexMetadata;
23+
import org.elasticsearch.cluster.routing.allocation.ExistingShardsAllocator;
2224
import org.elasticsearch.common.CheckedSupplier;
2325
import org.elasticsearch.common.Strings;
2426
import org.elasticsearch.common.breaker.CircuitBreakingException;
@@ -973,6 +975,10 @@ private void initIndex(String name, String bulk) throws IOException {
973975
if (indexExists(name) == false) {
974976
// not strictly required, but this can help isolate failure from bulk indexing.
975977
createIndex(name);
978+
var settings = (Map<?, ?>) ((Map<?, ?>) getIndexSettings(name).get(name)).get("settings");
979+
if (settings.containsKey(ExistingShardsAllocator.EXISTING_SHARDS_ALLOCATOR_SETTING.getKey()) == false) {
980+
updateIndexSettings(name, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0));
981+
}
976982
}
977983
if (hasText(bulk)) {
978984
bulk(name, bulk);

0 commit comments

Comments
 (0)