Skip to content

Commit

Permalink
fixed subscription delete test when 404
Browse files Browse the repository at this point in the history
If we get a 404 when we try to delete then it was already done at
some point, so we count it as successful
  • Loading branch information
jkasten2 committed Feb 22, 2024
1 parent 3faf8e2 commit 900d76a
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,9 @@ class SubscriptionOperationExecutorTests : FunSpec({
coVerify(exactly = 1) { mockSubscriptionBackendService.deleteSubscription(appId, remoteSubscriptionId) }
}

test("delete subscription fails without retry when there is a backend error") {
// If we get a 404 then the subscription has already been deleted,
// so we count it as successful
test("delete subscription is successful if there is a 404") {
// Given
val mockSubscriptionBackendService = mockk<ISubscriptionBackendService>()
coEvery { mockSubscriptionBackendService.deleteSubscription(any(), any()) } throws BackendException(404)
Expand All @@ -566,7 +568,7 @@ class SubscriptionOperationExecutorTests : FunSpec({
val response = subscriptionOperationExecutor.execute(operations)

// Then
response.result shouldBe ExecutionResult.FAIL_NORETRY
response.result shouldBe ExecutionResult.SUCCESS
coVerify(exactly = 1) { mockSubscriptionBackendService.deleteSubscription(appId, remoteSubscriptionId) }
}
})

0 comments on commit 900d76a

Please sign in to comment.