Skip to content

Commit

Permalink
Merge pull request #7 from wntmddus/Snapshot-Name
Browse files Browse the repository at this point in the history
Lint fix
  • Loading branch information
wntmddus authored Feb 4, 2025
2 parents 6da3508 + 1f6d966 commit 918ecc1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,24 +136,24 @@ class AttemptRestoreStepTests : OpenSearchTestCase() {
restoreSnapshotResponse: RestoreSnapshotResponse?,
exception: Exception?,
): ClusterAdminClient = mock {
// Mock getSnapshots call
doAnswer { invocationOnMock ->
val listener = invocationOnMock.getArgument<ActionListener<GetSnapshotsResponse>>(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<ActionListener<GetSnapshotsResponse>>(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<ActionListener<RestoreSnapshotResponse>>(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<ActionListener<RestoreSnapshotResponse>>(1)
when {
exception != null -> listener.onFailure(exception)
restoreSnapshotResponse != null -> listener.onResponse(restoreSnapshotResponse)
else -> listener.onResponse(mock())
}
}.whenever(this.mock).restoreSnapshot(any(), any())
}
}

0 comments on commit 918ecc1

Please sign in to comment.