Skip to content

Commit

Permalink
test(pipelines): Improve failed pipeline tests (spinnaker#1943)
Browse files Browse the repository at this point in the history
Update the tests to enforce that failure to parse a pipeline
leads to an entry being added to the execution history.
  • Loading branch information
ezimanyi authored and lwander committed Feb 5, 2018
1 parent 3ec39f2 commit 475af18
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -626,11 +626,11 @@ class OperationsControllerSpec extends Specification {
]
]
def response = Mock(HttpServletResponse)
Execution startedPipeline = null
executionLauncher.fail(*_) >> { ExecutionType type, String json, Throwable t ->
startedPipeline = mapper.readValue(json, Execution)
startedPipeline.id = UUID.randomUUID().toString()
startedPipeline
Execution failedPipeline = null
1 * executionLauncher.fail(*_) >> { ExecutionType type, String json, Throwable t ->
failedPipeline = mapper.readValue(json, Execution)
failedPipeline.id = UUID.randomUUID().toString()
failedPipeline
}

when:
Expand All @@ -639,7 +639,6 @@ class OperationsControllerSpec extends Specification {
then:
thrown(ValidationException)
0 * executionLauncher.start(*_)

}

def "should log and re-throw missing artifact error"() {
Expand All @@ -651,11 +650,11 @@ class OperationsControllerSpec extends Specification {
artifactResolver.resolveArtifacts(*_) >> { Map pipeline ->
throw new IllegalStateException(format("Unmatched expected artifact could not be resolved."))
}
Execution startedPipeline = null
executionLauncher.fail(*_) >> { ExecutionType type, String json, Throwable t ->
startedPipeline = mapper.readValue(json, Execution)
startedPipeline.id = UUID.randomUUID().toString()
startedPipeline
Execution failedPipeline = null
1 * executionLauncher.fail(*_) >> { ExecutionType type, String json, Throwable t ->
failedPipeline = mapper.readValue(json, Execution)
failedPipeline.id = UUID.randomUUID().toString()
failedPipeline
}

when:
Expand All @@ -664,7 +663,6 @@ class OperationsControllerSpec extends Specification {
then:
thrown(IllegalStateException)
0 * executionLauncher.start(*_)

}

def "should return empty list if webhook stage is not enabled"() {
Expand Down

0 comments on commit 475af18

Please sign in to comment.