Search in sources :

Example 36 with PutRepositoryResponse

use of org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse in project elasticsearch by elastic.

the class IndicesOptionsIntegrationIT method testSpecifiedIndexUnavailableSnapshotRestore.

public void testSpecifiedIndexUnavailableSnapshotRestore() throws Exception {
    createIndex("test1");
    ensureGreen("test1");
    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();
    verify(snapshot("snap2", "test1", "test2"), true);
    verify(restore("snap1", "test1", "test2"), true);
    IndicesOptions options = IndicesOptions.strictExpandOpen();
    verify(snapshot("snap2", "test1", "test2").setIndicesOptions(options), true);
    verify(restore("snap1", "test1", "test2").setIndicesOptions(options), true);
    options = IndicesOptions.lenientExpandOpen();
    verify(snapshot("snap2", "test1", "test2").setIndicesOptions(options), false);
    verify(restore("snap2", "test1", "test2").setIndicesOptions(options), false);
    options = IndicesOptions.strictExpandOpen();
    createIndex("test2");
    //TODO: temporary work-around for #5531
    ensureGreen("test2");
    waitForRelocation();
    verify(snapshot("snap3", "test1", "test2").setIndicesOptions(options), false);
    verify(restore("snap3", "test1", "test2").setIndicesOptions(options), false);
}
Also used : PutRepositoryResponse(org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse) IndicesOptions(org.elasticsearch.action.support.IndicesOptions)

Aggregations

PutRepositoryResponse (org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse)36 Client (org.elasticsearch.client.Client)23 ClusterAdminClient (org.elasticsearch.client.ClusterAdminClient)14 CreateSnapshotResponse (org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse)12 RestoreSnapshotResponse (org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse)8 Settings (org.elasticsearch.common.settings.Settings)8 Path (java.nio.file.Path)7 ClusterState (org.elasticsearch.cluster.ClusterState)7 Matchers.containsString (org.hamcrest.Matchers.containsString)7 NodeClient (org.elasticsearch.client.node.NodeClient)4 ArrayList (java.util.ArrayList)3 SnapshotMissingException (org.elasticsearch.snapshots.SnapshotMissingException)3 File (java.io.File)2 IOException (java.io.IOException)2 List (java.util.List)2 GetSnapshotsResponse (org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse)2 SnapshotStatus (org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotStatus)2 SnapshotsStatusResponse (org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusResponse)2 IndicesOptions (org.elasticsearch.action.support.IndicesOptions)2 MetaData (org.elasticsearch.cluster.metadata.MetaData)2