diff --git a/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/TestHelpers.kt b/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/TestHelpers.kt index 8a214b351..f52481878 100644 --- a/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/TestHelpers.kt +++ b/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/TestHelpers.kt @@ -239,9 +239,7 @@ fun randomTemplateScript( fun randomSnapshotActionConfig(repository: String = "repo", snapshot: String = "sp"): SnapshotAction = SnapshotAction(repository, snapshot, index = 0) -fun randomRestoreActionConfig(repository: String = "repo", snapshot: String = "sp"): ConvertIndexToRemoteAction { - return ConvertIndexToRemoteAction(repository, snapshot, index = 0) -} +fun randomRestoreActionConfig(repository: String = "repo", snapshot: String = "sp"): ConvertIndexToRemoteAction = ConvertIndexToRemoteAction(repository, snapshot, index = 0) /** * Helper functions for creating a random Conditions object diff --git a/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/AttemptRestoreStepTests.kt b/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/AttemptRestoreStepTests.kt index ddb327bc7..2d5b9f00b 100644 --- a/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/AttemptRestoreStepTests.kt +++ b/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/AttemptRestoreStepTests.kt @@ -136,24 +136,24 @@ class AttemptRestoreStepTests : OpenSearchTestCase() { restoreSnapshotResponse: RestoreSnapshotResponse?, exception: Exception?, ): ClusterAdminClient = mock { - // Mock getSnapshots call - doAnswer { invocationOnMock -> - val listener = invocationOnMock.getArgument>(1) - when { - exception != null -> listener.onFailure(exception) - getSnapshotsResponse != null -> listener.onResponse(getSnapshotsResponse) - else -> listener.onResponse(GetSnapshotsResponse(emptyList())) - } - }.whenever(this.mock).getSnapshots(any(), any()) + // Mock getSnapshots call + doAnswer { invocationOnMock -> + val listener = invocationOnMock.getArgument>(1) + when { + exception != null -> listener.onFailure(exception) + getSnapshotsResponse != null -> listener.onResponse(getSnapshotsResponse) + else -> listener.onResponse(GetSnapshotsResponse(emptyList())) + } + }.whenever(this.mock).getSnapshots(any(), any()) - // Mock restoreSnapshot call - doAnswer { invocationOnMock -> - val listener = invocationOnMock.getArgument>(1) - when { - exception != null -> listener.onFailure(exception) - restoreSnapshotResponse != null -> listener.onResponse(restoreSnapshotResponse) - else -> listener.onResponse(mock()) - } - }.whenever(this.mock).restoreSnapshot(any(), any()) - } + // Mock restoreSnapshot call + doAnswer { invocationOnMock -> + val listener = invocationOnMock.getArgument>(1) + when { + exception != null -> listener.onFailure(exception) + restoreSnapshotResponse != null -> listener.onResponse(restoreSnapshotResponse) + else -> listener.onResponse(mock()) + } + }.whenever(this.mock).restoreSnapshot(any(), any()) + } }