1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-03-03 15:02:35 +02:00

fix(spinnaker): fix MissingPropertyException (#1543)

* add test case

* fix issue
This commit is contained in:
Christopher Fenner 2020-05-14 17:45:02 +02:00 committed by GitHub
parent f9be21900e
commit 0ce6473a98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -48,7 +48,6 @@ class SpinnakerTriggerPipelineTest extends BasePiperTest {
Map credentialFileNames = [
'spinnaker-client-certificate': 'clientCert.file',
'spinnaker-client-key': 'clientKey.file'
]
helper.registerAllowedMethod('withCredentials', [List, Closure], { l, c ->
@ -182,7 +181,8 @@ class SpinnakerTriggerPipelineTest extends BasePiperTest {
nullScript.commonPipelineEnvironment.configuration = [
general: [
spinnakerGateUrl: 'https://spinnakerTest.url',
spinnakerApplication: 'spinnakerTestApp'
spinnakerApplication: 'spinnakerTestApp',
verbose: true
],
stages: [
testStage: [
@ -193,10 +193,14 @@ class SpinnakerTriggerPipelineTest extends BasePiperTest {
]
shellRule.setReturnValue('curl -X GET https://spinnakerTest.url/testRef --silent --cert $clientCertificate --key $clientKey', '{"status": "FAILED"}')
shellRule.setReturnValue('curl -X GET https://spinnakerTest.url/testRef --verbose --cert $clientCertificate --key $clientKey', '{"status": "FAILED"}')
exception.expect(hudson.AbortException)
exception.expectMessage('Spinnaker pipeline failed with FAILED')
stepRule.step.spinnakerTriggerPipeline(
script: nullScript,
)
try {
stepRule.step.spinnakerTriggerPipeline(script: nullScript)
} finally {
assertThat(logginRule.log, containsString('Full Spinnaker response = '))
}
}
}

View File

@ -165,7 +165,7 @@ void call(Map parameters = [:]) {
}
if (pipelineStatusResponseObj.status != 'SUCCEEDED') {
if (config.verbose) {
echo "[${STEP_NAME}] Full Spinnaker response = ${new JsonUtils().groovyObjectToPrettyJsonString(pipelineStatusResponse)}"
echo "[${STEP_NAME}] Full Spinnaker response = ${new JsonUtils().groovyObjectToPrettyJsonString(pipelineStatusResponseObj)}"
}
error "[${STEP_NAME}] Spinnaker pipeline failed with ${pipelineStatusResponseObj.status}"
}