Skip to content

Commit

Permalink
Modifying IT to restore snapshot
Browse files Browse the repository at this point in the history
Signed-off-by: Shubh Sahu <[email protected]>
  • Loading branch information
Shubh Sahu committed Jan 8, 2025
1 parent 3947531 commit 4bd2acb
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ public void testCloseIndexWithNoOpSyncAndFlushForAsyncTranslog() throws Interrup

public void testSuccessfulShallowV1SnapshotPostIndexClose() throws Exception {
internalCluster().startClusterManagerOnlyNode();
internalCluster().startDataOnlyNodes(1);
String dataNode = internalCluster().startDataOnlyNodes(1).get(0);
createIndex(INDEX_NAME, remoteStoreIndexSettings(0, 10000L, -1));
ensureGreen(INDEX_NAME);

Expand Down Expand Up @@ -1143,5 +1143,17 @@ public void testSuccessfulShallowV1SnapshotPostIndexClose() throws Exception {
assertEquals(SnapshotState.SUCCESS, snapshotInfo2.state());
assertTrue(snapshotInfo2.successfulShards() > 0);
assertEquals(0, snapshotInfo2.failedShards());

// delete the index
cluster().wipeIndices(INDEX_NAME);
// try restoring the snapshot
RestoreSnapshotResponse restoreSnapshotResponse = clusterAdmin().prepareRestoreSnapshot(shallowSnapshotRepoName, snapshot2)
.setWaitForCompletion(true)
.execute()
.actionGet();
assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0));
ensureGreen(INDEX_NAME);
flushAndRefresh(INDEX_NAME);
assertBusy(() -> { assertHitCount(client(dataNode).prepareSearch(INDEX_NAME).setSize(0).get(), 20); });
}
}

0 comments on commit 4bd2acb

Please sign in to comment.