use of org.opensearch.snapshots.mockstore.MockRepository in project OpenSearch by opensearch-project.
the class SharedClusterSnapshotRestoreIT method testIndexLatestFailuresIgnored.
public void testIndexLatestFailuresIgnored() throws Exception {
final String repoName = "test-repo";
final Path repoPath = randomRepoPath();
createRepository(repoName, "mock", repoPath);
final MockRepository repository = (MockRepository) internalCluster().getCurrentMasterNodeInstance(RepositoriesService.class).repository(repoName);
repository.setFailOnIndexLatest(true);
createFullSnapshot(repoName, "snapshot-1");
repository.setFailOnIndexLatest(false);
createFullSnapshot(repoName, "snapshot-2");
final long repoGenInIndexLatest = Numbers.bytesToLong(new BytesRef(Files.readAllBytes(repoPath.resolve(BlobStoreRepository.INDEX_LATEST_BLOB))));
assertEquals(getRepositoryData(repoName).getGenId(), repoGenInIndexLatest);
createRepository(repoName, "fs", Settings.builder().put("location", repoPath).put(BlobStoreRepository.SUPPORT_URL_REPO.getKey(), false));
createFullSnapshot(repoName, "snapshot-3");
final long repoGenInIndexLatest2 = Numbers.bytesToLong(new BytesRef(Files.readAllBytes(repoPath.resolve(BlobStoreRepository.INDEX_LATEST_BLOB))));
assertEquals("index.latest should not have been written to", repoGenInIndexLatest, repoGenInIndexLatest2);
createRepository(repoName, "fs", repoPath);
createFullSnapshot(repoName, "snapshot-4");
final long repoGenInIndexLatest3 = Numbers.bytesToLong(new BytesRef(Files.readAllBytes(repoPath.resolve(BlobStoreRepository.INDEX_LATEST_BLOB))));
assertEquals(getRepositoryData(repoName).getGenId(), repoGenInIndexLatest3);
}
Aggregations