Skip to content

Commit a680400

Browse files
Add recovery from snapshot to tests (#76535)
Randomly add to use a snapshot for recovery to searchable snapshot and snapshot tests to verify that recover from snapshot does not break other features (those should not care about the flag). Relates #76237
1 parent f115524 commit a680400

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

test/framework/src/main/java/org/elasticsearch/snapshots/AbstractSnapshotIntegTestCase.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,9 @@ public static Settings.Builder randomRepositorySettings() {
333333
if (rarely()) {
334334
settings.put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES);
335335
}
336+
if (randomBoolean()) {
337+
settings.put(BlobStoreRepository.USE_FOR_PEER_RECOVERY_SETTING.getKey(), randomBoolean());
338+
}
336339
return settings;
337340
}
338341

x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/BaseSearchableSnapshotsIntegTestCase.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.elasticsearch.indices.IndicesService;
3939
import org.elasticsearch.indices.recovery.RecoveryState;
4040
import org.elasticsearch.plugins.Plugin;
41+
import org.elasticsearch.repositories.blobstore.BlobStoreRepository;
4142
import org.elasticsearch.snapshots.AbstractSnapshotIntegTestCase;
4243
import org.elasticsearch.threadpool.ThreadPool;
4344
import org.elasticsearch.xpack.core.XPackSettings;
@@ -141,6 +142,15 @@ public void waitForBlobCacheFillsToComplete() {
141142
}
142143
}
143144

145+
@Override
146+
protected void createRepository(String repoName, String type, Settings.Builder settings, boolean verify) {
147+
// add use for peer recovery setting randomly to verify that these features work together.
148+
Settings.Builder newSettings = randomBoolean()
149+
? settings
150+
: Settings.builder().put(BlobStoreRepository.USE_FOR_PEER_RECOVERY_SETTING.getKey(), true).put(settings.build());
151+
super.createRepository(repoName, type, newSettings, verify);
152+
}
153+
144154
protected String mountSnapshot(String repositoryName, String snapshotName, String indexName, Settings restoredIndexSettings)
145155
throws Exception {
146156
final String restoredIndexName = randomBoolean() ? indexName : randomAlphaOfLength(10).toLowerCase(Locale.ROOT);

0 commit comments

Comments
 (0)