Skip to content

Commit 2c24ac7

Browse files
authored
Set watermarks in single-node test cases
We set the watermarks to low values in other test cases to prevent test failures on nodes with low disk space (if the disk space is too low, the test will fail anyway but we should not prematurely fail). This commit sets the watermarks in the single-node test cases to avoid test failures in such situations. Relates elastic#28134
1 parent 36729d1 commit 2c24ac7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/framework/src/main/java/org/elasticsearch/test/ESSingleNodeTestCase.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.elasticsearch.cluster.health.ClusterHealthStatus;
3030
import org.elasticsearch.cluster.metadata.IndexMetaData;
3131
import org.elasticsearch.cluster.metadata.MetaData;
32+
import org.elasticsearch.cluster.routing.allocation.DiskThresholdSettings;
3233
import org.elasticsearch.common.Priority;
3334
import org.elasticsearch.common.network.NetworkModule;
3435
import org.elasticsearch.common.settings.Settings;
@@ -176,6 +177,10 @@ private Node newNode() {
176177
.put("transport.type", getTestTransportType())
177178
.put(Node.NODE_DATA_SETTING.getKey(), true)
178179
.put(NodeEnvironment.NODE_ID_SEED_SETTING.getKey(), random().nextLong())
180+
// default the watermarks low values to prevent tests from failing on nodes without enough disk space
181+
.put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "1b")
182+
.put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), "1b")
183+
.put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_DISK_FLOOD_STAGE_WATERMARK_SETTING.getKey(), "1b")
179184
.put(nodeSettings()) // allow test cases to provide their own settings or override these
180185
.build();
181186
Collection<Class<? extends Plugin>> plugins = getPlugins();

0 commit comments

Comments
 (0)