Skip to content

Commit 4bd2acb

Browse files
author
Shubh Sahu
committed
Modifying IT to restore snapshot
Signed-off-by: Shubh Sahu <[email protected]>
1 parent 3947531 commit 4bd2acb

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteStoreIT.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ public void testCloseIndexWithNoOpSyncAndFlushForAsyncTranslog() throws Interrup
10841084

10851085
public void testSuccessfulShallowV1SnapshotPostIndexClose() throws Exception {
10861086
internalCluster().startClusterManagerOnlyNode();
1087-
internalCluster().startDataOnlyNodes(1);
1087+
String dataNode = internalCluster().startDataOnlyNodes(1).get(0);
10881088
createIndex(INDEX_NAME, remoteStoreIndexSettings(0, 10000L, -1));
10891089
ensureGreen(INDEX_NAME);
10901090

@@ -1143,5 +1143,17 @@ public void testSuccessfulShallowV1SnapshotPostIndexClose() throws Exception {
11431143
assertEquals(SnapshotState.SUCCESS, snapshotInfo2.state());
11441144
assertTrue(snapshotInfo2.successfulShards() > 0);
11451145
assertEquals(0, snapshotInfo2.failedShards());
1146+
1147+
// delete the index
1148+
cluster().wipeIndices(INDEX_NAME);
1149+
// try restoring the snapshot
1150+
RestoreSnapshotResponse restoreSnapshotResponse = clusterAdmin().prepareRestoreSnapshot(shallowSnapshotRepoName, snapshot2)
1151+
.setWaitForCompletion(true)
1152+
.execute()
1153+
.actionGet();
1154+
assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0));
1155+
ensureGreen(INDEX_NAME);
1156+
flushAndRefresh(INDEX_NAME);
1157+
assertBusy(() -> { assertHitCount(client(dataNode).prepareSearch(INDEX_NAME).setSize(0).get(), 20); });
11461158
}
11471159
}

0 commit comments

Comments
 (0)