From 65a061e33ac6c5417fa129a868fd48837d5e0487 Mon Sep 17 00:00:00 2001 From: Tanguy Leroux Date: Thu, 7 May 2020 10:58:19 +0200 Subject: [PATCH] Fix SearchableSnapshotDirectoryTests.testClearCache (#56277) This test sometimes fails when prewarming is enabled because it's possible that some files are cached in background while the test tries to clear the cache. This commit disables prewarming for this test. --- .../index/store/SearchableSnapshotDirectoryTests.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/SearchableSnapshotDirectoryTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/SearchableSnapshotDirectoryTests.java index 5a05b862df1..f3e2ee5b023 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/SearchableSnapshotDirectoryTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/SearchableSnapshotDirectoryTests.java @@ -531,7 +531,9 @@ public class SearchableSnapshotDirectoryTests extends ESTestCase { shardId, Settings.builder() .put(SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), true) - .put(SNAPSHOT_CACHE_PREWARM_ENABLED_SETTING.getKey(), randomBoolean()) + // disable prewarming in this test to prevent files to be concurrently cached + // while the cache is cleared out and while the test verifies it is empty + .put(SNAPSHOT_CACHE_PREWARM_ENABLED_SETTING.getKey(), false) .build(), () -> 0L, cacheService,