From 016e8760f0b44e816bae541a822d5d2fbb8f3021 Mon Sep 17 00:00:00 2001 From: Daniel Mitterdorfer Date: Mon, 16 Jul 2018 10:40:36 +0200 Subject: [PATCH] Turn off real-mem breaker in single node tests With this commit we disable the real-memory circuit breaker in tests that inherit from `ESSingleNodeTestCase`. As this breaker is based on real memory usage over which we have no (full) control in tests and their purpose is also not to test the circuit breaker, we use the deterministic circuit breaker implementation that only accounts for explicitly reserved memory. Closes #32047 Relates #32071 --- .../java/org/elasticsearch/test/ESSingleNodeTestCase.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/framework/src/main/java/org/elasticsearch/test/ESSingleNodeTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/ESSingleNodeTestCase.java index a1b8f44a923..9633f56dea9 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/ESSingleNodeTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/ESSingleNodeTestCase.java @@ -42,6 +42,7 @@ import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexService; import org.elasticsearch.indices.IndicesService; +import org.elasticsearch.indices.breaker.HierarchyCircuitBreakerService; import org.elasticsearch.node.MockNode; import org.elasticsearch.node.Node; import org.elasticsearch.node.NodeValidationException; @@ -184,6 +185,9 @@ public abstract class ESSingleNodeTestCase extends ESTestCase { .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "1b") .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), "1b") .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_DISK_FLOOD_STAGE_WATERMARK_SETTING.getKey(), "1b") + // turning on the real memory circuit breaker leads to spurious test failures. As have no full control over heap usage, we + // turn it off for these tests. + .put(HierarchyCircuitBreakerService.USE_REAL_MEMORY_USAGE_SETTING.getKey(), false) .put(nodeSettings()) // allow test cases to provide their own settings or override these .build(); Collection> plugins = getPlugins();