use of org.elasticsearch.repositories.RepositoryVerificationException in project elasticsearch by elastic.
the class AbstractS3SnapshotRestoreTest method testRepositoryInRemoteRegionIsRemote.
/**
* This test verifies that the test configuration is set up in a manner that
* does not make the test {@link #testRepositoryInRemoteRegion()} pointless.
*/
public void testRepositoryInRemoteRegionIsRemote() {
Client client = client();
Settings bucketSettings = internalCluster().getInstance(Settings.class).getByPrefix("repositories.s3.remote-bucket.");
logger.info("--> creating s3 repository with bucket[{}] and path [{}]", bucketSettings.get("bucket"), basePath);
try {
client.admin().cluster().preparePutRepository("test-repo").setType("s3").setSettings(Settings.builder().put(S3Repository.Repository.BASE_PATH_SETTING.getKey(), basePath).put(S3Repository.Repository.BUCKET_SETTING.getKey(), bucketSettings.get("bucket"))).get();
fail("repository verification should have raise an exception!");
} catch (RepositoryVerificationException e) {
}
}
use of org.elasticsearch.repositories.RepositoryVerificationException in project elasticsearch by elastic.
the class RepositoriesIT method testRepositoryVerificationTimeout.
public void testRepositoryVerificationTimeout() throws Exception {
Client client = client();
Settings settings = Settings.builder().put("location", randomRepoPath()).put("random_control_io_exception_rate", 1.0).build();
logger.info("--> creating repository that cannot write any files - should fail");
assertThrows(client.admin().cluster().preparePutRepository("test-repo-1").setType("mock").setSettings(settings), RepositoryVerificationException.class);
logger.info("--> creating repository that cannot write any files, but suppress verification - should be acked");
assertAcked(client.admin().cluster().preparePutRepository("test-repo-1").setType("mock").setSettings(settings).setVerify(false));
logger.info("--> verifying repository");
assertThrows(client.admin().cluster().prepareVerifyRepository("test-repo-1"), RepositoryVerificationException.class);
Path location = randomRepoPath();
logger.info("--> creating repository");
try {
client.admin().cluster().preparePutRepository("test-repo-1").setType("mock").setSettings(Settings.builder().put("location", location).put("localize_location", true)).get();
fail("RepositoryVerificationException wasn't generated");
} catch (RepositoryVerificationException ex) {
assertThat(ex.getMessage(), containsString("is not shared"));
}
}
Aggregations