Skip to content

Commit

Permalink
fix(test/clouddriver): Mock http error using SpinnakerHttpException i…
Browse files Browse the repository at this point in the history
…n WaitForCloudFormationCompletionTaskSpec (#4717)

With the introduction of the commit: 84a7106 , the expected behaviour of all OortService APIs is to throw SpinnakerHttpException when any http error has occurred.

Here in this test the response of the API : https://github.com/spinnaker/orca/blob/a1b32d7398eb9b1ff610d7f3afd980b51f6cf7b1/orca-clouddriver/src/main/java/com/netflix/spinnaker/orca/clouddriver/OortService.java#L182 is mocked up with RetrofitError which makes the test irrelvant.

Wrapping the RetrofitError in SpinnakerHttpException to make it in compliance with the retrofit configuration.

Co-authored-by: Pranav-b-7 <[email protected]>
  • Loading branch information
Pranav-b-7 and Pranav-b-7 committed Apr 29, 2024
1 parent a1b32d7 commit bc76db0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ class WaitForCloudFormationCompletionTaskSpec extends Specification {
'kato.tasks': [[resultObjects: [[stackId: 'stackId']]]]
]
def stage = new StageExecutionImpl(pipeline, 'test', 'test', context)
def error500 = RetrofitError.httpError("url", new Response("url", 500, "reason", [], null), null, null)
def error500 = new SpinnakerHttpException(RetrofitError.httpError("url", new Response("url", 500, "reason", [], null), null, null))
when:
def result = waitForCloudFormationCompletionTask.execute(stage)
then:
1 * oortService.getCloudFormationStack('stackId') >> { throw error500 }
RuntimeException ex = thrown()
ex.message == "500 reason"
ex.message == "Status: 500, URL: url, Message: reason"
result == null
}
Expand Down

0 comments on commit bc76db0

Please sign in to comment.