use of org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse in project elasticsearch by elastic.
the class AzureSnapshotRestoreTests method checkContainerName.
/**
* Create repository with wrong or correct container name
* @param container Container name we want to create
* @param correct Is this container name correct
*/
private void checkContainerName(final String container, final boolean correct) throws Exception {
logger.info("--> creating azure repository with container name [{}]", container);
// It could happen that we just removed from a previous test the same container so
// we can not create it yet.
assertBusy(() -> {
try {
PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo").setType("azure").setSettings(Settings.builder().put(Repository.CONTAINER_SETTING.getKey(), container).put(Repository.BASE_PATH_SETTING.getKey(), getRepositoryPath()).put(Repository.CHUNK_SIZE_SETTING.getKey(), randomIntBetween(1000, 10000), ByteSizeUnit.BYTES)).get();
client().admin().cluster().prepareDeleteRepository("test-repo").get();
try {
logger.info("--> remove container [{}]", container);
cleanRepositoryFiles(container);
} catch (StorageException | URISyntaxException e) {
// We can ignore that as we just try to clean after the test
}
assertTrue(putRepositoryResponse.isAcknowledged() == correct);
} catch (RepositoryVerificationException e) {
if (correct) {
logger.debug(" -> container is being removed. Let's wait a bit...");
fail();
}
}
}, 5, TimeUnit.MINUTES);
}
use of org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse in project elasticsearch by elastic.
the class IndicesOptionsIntegrationIT method testWildcardBehaviourSnapshotRestore.
public void testWildcardBehaviourSnapshotRestore() throws Exception {
createIndex("foobar");
ensureGreen("foobar");
waitForRelocation();
PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("dummy-repo").setType("fs").setSettings(Settings.builder().put("location", randomRepoPath())).get();
assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));
client().admin().cluster().prepareCreateSnapshot("dummy-repo", "snap1").setWaitForCompletion(true).get();
IndicesOptions options = IndicesOptions.fromOptions(false, false, true, false);
verify(snapshot("snap2", "foo*", "bar*").setIndicesOptions(options), true);
verify(restore("snap1", "foo*", "bar*").setIndicesOptions(options), true);
options = IndicesOptions.strictExpandOpen();
verify(snapshot("snap2", "foo*", "bar*").setIndicesOptions(options), false);
verify(restore("snap2", "foo*", "bar*").setIndicesOptions(options), false);
assertAcked(prepareCreate("barbaz"));
//TODO: temporary work-around for #5531
ensureGreen("barbaz");
waitForRelocation();
options = IndicesOptions.fromOptions(false, false, true, false);
verify(snapshot("snap3", "foo*", "bar*").setIndicesOptions(options), false);
verify(restore("snap3", "foo*", "bar*").setIndicesOptions(options), false);
options = IndicesOptions.fromOptions(false, false, true, false);
verify(snapshot("snap4", "foo*", "baz*").setIndicesOptions(options), true);
verify(restore("snap3", "foo*", "baz*").setIndicesOptions(options), true);
}
use of org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse in project elasticsearch by elastic.
the class BlobStoreRepositoryTests method setupRepo.
private BlobStoreRepository setupRepo() {
final Client client = client();
final Path location = ESIntegTestCase.randomRepoPath(node().settings());
final String repositoryName = "test-repo";
PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository(repositoryName).setType("fs").setSettings(Settings.builder().put(node().settings()).put("location", location)).get();
assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));
final RepositoriesService repositoriesService = getInstanceFromNode(RepositoriesService.class);
@SuppressWarnings("unchecked") final BlobStoreRepository repository = (BlobStoreRepository) repositoriesService.repository(repositoryName);
return repository;
}
use of org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse in project crate by crate.
the class SysSnapshotsTest method createRepository.
private void createRepository(String name) {
PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository(name).setType("fs").setSettings(Settings.settingsBuilder().put("location", new File(TEMP_FOLDER.getRoot(), "backup").getAbsolutePath()).put("chunk_size", "5k").put("compress", false)).get();
assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));
}
use of org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse in project crate by crate.
the class SysRepositoriesServiceTest method createRepository.
private void createRepository(String name) {
PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository(name).setType("fs").setSettings(Settings.settingsBuilder().put("location", new File(TEMP_FOLDER.getRoot(), "backup").getAbsolutePath()).put("chunk_size", "5k").put("compress", false)).get();
assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));
repositories.add(name);
}
Aggregations