From 938ac06a88505463e07fd235231bc4857ea9f0c3 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Mon, 16 Oct 2023 14:24:19 +0200 Subject: [PATCH] set higher disk watermark thresholds --- .../ElasticsearchTestFixture.cs | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/test/instrumentations/Elastic.Clients.Elasticsearch.Tests/ElasticsearchTestFixture.cs b/test/instrumentations/Elastic.Clients.Elasticsearch.Tests/ElasticsearchTestFixture.cs index bcd7ec172..d8c3e6b9d 100644 --- a/test/instrumentations/Elastic.Clients.Elasticsearch.Tests/ElasticsearchTestFixture.cs +++ b/test/instrumentations/Elastic.Clients.Elasticsearch.Tests/ElasticsearchTestFixture.cs @@ -12,6 +12,7 @@ using Xunit; using Xunit.Abstractions; using Xunit.Sdk; +using HttpMethod = Elastic.Transport.HttpMethod; using ILogger = Microsoft.Extensions.Logging.ILogger; namespace Elastic.Clients.Elasticsearch.Tests; @@ -26,7 +27,8 @@ public sealed class ElasticsearchTestFixture : IAsyncLifetime public ElasticsearchTestFixture(IMessageSink sink) { _sink = sink; - Container = new ElasticsearchBuilder().Build(); + Container = new ElasticsearchBuilder() + .Build(); } @@ -45,6 +47,24 @@ public async Task InitializeAsync() Client = new ElasticsearchClient(settings); if (Client == null) throw new Exception("`new ElasticsearchClient(settings)` returned `null`"); + + //Increase Elasticsearch high disk watermarks, Github Actions container typically has around + //~7GB free (8%) of the available space. + var response = await Client.Transport.RequestAsync(HttpMethod.PUT, "_cluster/settings", PostData.String(@"{ + ""persistent"": { + ""cluster.routing.allocation.disk.watermark.low"": ""90%"", + ""cluster.routing.allocation.disk.watermark.low.max_headroom"": ""100GB"", + ""cluster.routing.allocation.disk.watermark.high"": ""98%"", + ""cluster.routing.allocation.disk.watermark.high.max_headroom"": ""2GB"", + ""cluster.routing.allocation.disk.watermark.flood_stage"": ""99%"", + ""cluster.routing.allocation.disk.watermark.flood_stage.max_headroom"": ""1GB"", + ""cluster.routing.allocation.disk.watermark.flood_stage.frozen"": ""99%"", + ""cluster.routing.allocation.disk.watermark.flood_stage.frozen.max_headroom"": ""1GB"" + } + }")); + + if (!response.ApiCallDetails.HasSuccessfulStatusCode) + throw new Exception(response.ToString()); } async Task IAsyncLifetime.DisposeAsync()