Skip to content

Commit

Permalink
Updated the testcases to reuse existing getSnapshotStatus() method
Browse files Browse the repository at this point in the history
Signed-off-by: aggarwalShivani <[email protected]>
  • Loading branch information
aggarwalShivani committed Apr 12, 2024
1 parent db064b3 commit ab01a69
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- [Bug] Check phase name before SearchRequestOperationsListener onPhaseStart ([#12035](https://github.com/opensearch-project/OpenSearch/pull/12035))
- Fix Span operation names generated from RestActions ([#12005](https://github.com/opensearch-project/OpenSearch/pull/12005))
- Fix error in RemoteSegmentStoreDirectory when debug logging is enabled ([#12328](https://github.com/opensearch-project/OpenSearch/pull/12328))
- Fix snapshot _status API to return correct status for partial snapshots ([#12812](https://github.com/opensearch-project/OpenSearch/pull/12812))

### Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,9 @@ public void testStatusApiConsistency() {
assertThat(snapshotInfo.state(), equalTo(SnapshotState.SUCCESS));
assertThat(snapshotInfo.version(), equalTo(Version.CURRENT));

final List<SnapshotStatus> snapshotStatus = clusterAdmin().snapshotsStatus(
new SnapshotsStatusRequest("test-repo", new String[] { "test-snap" })
).actionGet().getSnapshots();
assertThat(snapshotStatus.size(), equalTo(1));
final SnapshotStatus snStatus = snapshotStatus.get(0);
assertEquals(snStatus.getStats().getStartTime(), snapshotInfo.startTime());
assertEquals(snStatus.getStats().getTime(), snapshotInfo.endTime() - snapshotInfo.startTime());
final SnapshotStatus snapshotStatus = getSnapshotStatus("test-repo", "test-snap");
assertEquals(snapshotStatus.getStats().getStartTime(), snapshotInfo.startTime());
assertEquals(snapshotStatus.getStats().getTime(), snapshotInfo.endTime() - snapshotInfo.startTime());
}

public void testStatusAPICallForShallowCopySnapshot() {
Expand Down Expand Up @@ -369,11 +365,8 @@ public void testSnapshotStatusOnPartialSnapshot() throws Exception {
logger.info("--> stopping data node before creating snapshot");
stopNode(dataNode);
startFullSnapshot(repoName, snapshotName, true).get();
final List<SnapshotStatus> snapshotStatus = clusterAdmin().snapshotsStatus(
new SnapshotsStatusRequest(repoName, new String[] { snapshotName })
).actionGet().getSnapshots();
assertThat(snapshotStatus.size(), equalTo(1));
assertEquals(SnapshotsInProgress.State.PARTIAL, snapshotStatus.get(0).getState());
final SnapshotStatus snapshotStatus = getSnapshotStatus(repoName, snapshotName);
assertEquals(SnapshotsInProgress.State.PARTIAL, snapshotStatus.getState());
}

public void testStatusAPICallInProgressShallowSnapshot() throws Exception {
Expand Down

0 comments on commit ab01a69

Please sign in to comment.