Skip to content

Commit

Permalink
set higher disk watermark thresholds
Browse files Browse the repository at this point in the history
  • Loading branch information
Mpdreamz committed Oct 16, 2023
1 parent 63b658d commit 938ac06
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,7 +27,8 @@ public sealed class ElasticsearchTestFixture : IAsyncLifetime
public ElasticsearchTestFixture(IMessageSink sink)
{
_sink = sink;
Container = new ElasticsearchBuilder().Build();
Container = new ElasticsearchBuilder()
.Build();
}


Expand All @@ -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<StringResponse>(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()
Expand Down

0 comments on commit 938ac06

Please sign in to comment.