|
40 | 40 | import org.opensearch.action.admin.cluster.snapshots.status.SnapshotIndexShardStatus;
|
41 | 41 | import org.opensearch.action.admin.cluster.snapshots.status.SnapshotStats;
|
42 | 42 | import org.opensearch.action.admin.cluster.snapshots.status.SnapshotStatus;
|
43 |
| -import org.opensearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest; |
44 | 43 | import org.opensearch.action.admin.cluster.snapshots.status.SnapshotsStatusResponse;
|
45 | 44 | import org.opensearch.client.Client;
|
46 | 45 | import org.opensearch.cluster.SnapshotsInProgress;
|
@@ -101,13 +100,9 @@ public void testStatusApiConsistency() {
|
101 | 100 | assertThat(snapshotInfo.state(), equalTo(SnapshotState.SUCCESS));
|
102 | 101 | assertThat(snapshotInfo.version(), equalTo(Version.CURRENT));
|
103 | 102 |
|
104 |
| - final List<SnapshotStatus> snapshotStatus = clusterAdmin().snapshotsStatus( |
105 |
| - new SnapshotsStatusRequest("test-repo", new String[] { "test-snap" }) |
106 |
| - ).actionGet().getSnapshots(); |
107 |
| - assertThat(snapshotStatus.size(), equalTo(1)); |
108 |
| - final SnapshotStatus snStatus = snapshotStatus.get(0); |
109 |
| - assertEquals(snStatus.getStats().getStartTime(), snapshotInfo.startTime()); |
110 |
| - assertEquals(snStatus.getStats().getTime(), snapshotInfo.endTime() - snapshotInfo.startTime()); |
| 103 | + final SnapshotStatus snapshotStatus = getSnapshotStatus("test-repo", "test-snap"); |
| 104 | + assertEquals(snapshotStatus.getStats().getStartTime(), snapshotInfo.startTime()); |
| 105 | + assertEquals(snapshotStatus.getStats().getTime(), snapshotInfo.endTime() - snapshotInfo.startTime()); |
111 | 106 | }
|
112 | 107 |
|
113 | 108 | public void testStatusAPICallForShallowCopySnapshot() {
|
@@ -357,6 +352,22 @@ public void testSnapshotStatusOnFailedSnapshot() throws Exception {
|
357 | 352 | assertEquals(SnapshotsInProgress.State.FAILED, snapshotsStatusResponse.getSnapshots().get(0).getState());
|
358 | 353 | }
|
359 | 354 |
|
| 355 | + public void testSnapshotStatusOnPartialSnapshot() throws Exception { |
| 356 | + final String dataNode = internalCluster().startDataOnlyNode(); |
| 357 | + final String repoName = "test-repo"; |
| 358 | + final String snapshotName = "test-snap"; |
| 359 | + final String indexName = "test-idx"; |
| 360 | + createRepository(repoName, "fs"); |
| 361 | + // create an index with a single shard on the data node, that will be stopped |
| 362 | + createIndex(indexName, singleShardOneNode(dataNode)); |
| 363 | + index(indexName, "_doc", "some_doc_id", "foo", "bar"); |
| 364 | + logger.info("--> stopping data node before creating snapshot"); |
| 365 | + stopNode(dataNode); |
| 366 | + startFullSnapshot(repoName, snapshotName, true).get(); |
| 367 | + final SnapshotStatus snapshotStatus = getSnapshotStatus(repoName, snapshotName); |
| 368 | + assertEquals(SnapshotsInProgress.State.PARTIAL, snapshotStatus.getState()); |
| 369 | + } |
| 370 | + |
360 | 371 | public void testStatusAPICallInProgressShallowSnapshot() throws Exception {
|
361 | 372 | internalCluster().startClusterManagerOnlyNode();
|
362 | 373 | internalCluster().startDataOnlyNode();
|
|
0 commit comments