From 6fc0047f23dc4971ec14caf8bacb65b3f57b5254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenzo=20Dematt=C3=A9?= Date: Wed, 7 Aug 2024 17:50:12 +0200 Subject: [PATCH] do not execute preallocate tests on encrypted storage (#111627) --- .../elasticsearch/nativeaccess/PreallocateTests.java | 11 ++++++++--- muted-tests.yml | 3 --- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libs/native/src/test/java/org/elasticsearch/nativeaccess/PreallocateTests.java b/libs/native/src/test/java/org/elasticsearch/nativeaccess/PreallocateTests.java index 82e014643b72..a95f4df6aef6 100644 --- a/libs/native/src/test/java/org/elasticsearch/nativeaccess/PreallocateTests.java +++ b/libs/native/src/test/java/org/elasticsearch/nativeaccess/PreallocateTests.java @@ -9,6 +9,7 @@ package org.elasticsearch.nativeaccess; import org.elasticsearch.test.ESTestCase; +import org.junit.Before; import java.io.IOException; import java.nio.file.Path; @@ -17,8 +18,14 @@ import java.util.OptionalLong; import static org.hamcrest.Matchers.equalTo; public class PreallocateTests extends ESTestCase { - public void testPreallocate() throws IOException { + + @Before + public void setup() { assumeFalse("no preallocate on windows", System.getProperty("os.name").startsWith("Windows")); + assumeFalse("preallocate not supported on encrypted block devices", "encryption-at-rest".equals(System.getenv("BUILDKITE_LABEL"))); + } + + public void testPreallocate() throws IOException { Path file = createTempFile(); long size = 1024 * 1024; // 1 MB var nativeAccess = NativeAccess.instance(); @@ -29,7 +36,6 @@ public class PreallocateTests extends ESTestCase { } public void testPreallocateNonExistingFile() { - assumeFalse("no preallocate on windows", System.getProperty("os.name").startsWith("Windows")); Path file = createTempDir().resolve("intermediate-dir").resolve("test-preallocate"); long size = 1024 * 1024; // 1 MB var nativeAccess = NativeAccess.instance(); @@ -40,7 +46,6 @@ public class PreallocateTests extends ESTestCase { } public void testPreallocateNonExistingDirectory() { - assumeFalse("no preallocate on windows", System.getProperty("os.name").startsWith("Windows")); Path file = createTempDir().resolve("intermediate-dir").resolve("test-preallocate"); long size = 1024 * 1024; // 1 MB var nativeAccess = NativeAccess.instance(); diff --git a/muted-tests.yml b/muted-tests.yml index f447b918a678..e05da61c1d44 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -74,9 +74,6 @@ tests: - class: org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheFileTests method: testCacheFileCreatedAsSparseFile issue: https://github.com/elastic/elasticsearch/issues/110801 -- class: org.elasticsearch.nativeaccess.PreallocateTests - method: testPreallocate - issue: https://github.com/elastic/elasticsearch/issues/110948 - class: org.elasticsearch.nativeaccess.VectorSystemPropertyTests method: testSystemPropertyDisabled issue: https://github.com/elastic/elasticsearch/issues/110949