Fix SearchableSnapshotsBlobStoreCacheIntegTests.testBlobStoreCache (#78616)

This test often fails on CI because it does not wait for the data 
node that hosts the .snapshot-blob-cache primary shard to 
process the cluster state update and triggers the clean up.

Closes #78512
This commit is contained in:
Tanguy Leroux 2021-10-07 12:07:22 +02:00 committed by GitHub
parent 67e310e989
commit 9e271001bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -58,6 +58,7 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.concurrent.TimeUnit;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
@ -327,8 +328,9 @@ public class SearchableSnapshotsBlobStoreCacheIntegTests extends BaseFrozenSearc
logger.info("--> verifying number of documents in index [{}]", restoredAgainIndex); logger.info("--> verifying number of documents in index [{}]", restoredAgainIndex);
assertHitCount(client().prepareSearch(restoredAgainIndex).setSize(0).setTrackTotalHits(true).get(), numberOfDocs); assertHitCount(client().prepareSearch(restoredAgainIndex).setSize(0).setTrackTotalHits(true).get(), numberOfDocs);
logger.info("--> deleting indices, maintenance service should clean up snapshot blob cache index"); logger.info("--> deleting indices, maintenance service should clean up [{}] docs in system index", numberOfCachedBlobs);
assertAcked(client().admin().indices().prepareDelete("restored-*")); assertAcked(client().admin().indices().prepareDelete("restored-*"));
assertBusy(() -> { assertBusy(() -> {
refreshSystemIndex(); refreshSystemIndex();
assertHitCount( assertHitCount(
@ -338,7 +340,7 @@ public class SearchableSnapshotsBlobStoreCacheIntegTests extends BaseFrozenSearc
.get(), .get(),
0L 0L
); );
}); }, 30L, TimeUnit.SECONDS);
} }
private void checkNoBlobStoreAccess() { private void checkNoBlobStoreAccess() {