pipelineUnit icon indicating copy to clipboard operation
pipelineUnit copied to clipboard

tests.job.CIPipelineTest > validate shell command[0] FAILED

Open nishwalshetty opened this issue 3 years ago • 1 comments

sorry i am a noob with this frameowrk, any help in identifying the below issue is appreciated!

Unit Test cases fail with below error when three double quotes are used along with sh in Jenkinsfile

problem is when i use three double quotes without which i cannot get the value of groovy variable

Jenkinsfile Stage

stage('duration') { steps{ withCredentials([string(credentialsId: 'GH_TOKEN', variable: 'GH_TOKEN'), usernamePassword(credentialsId: '', passwordVariable: 'dbpassword', usernameVariable: 'dbuser')]) { script { currentBuild.displayName = "$ghprbPullId" sh """ echo ${currentBuild.durationString.replace(' and counting', '')} > duration.txt cat duration.txt """ } } } }

Error from Unit test case

tests.job.CIPipelineTest > validate the pipeline FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:18

tests.job.CIPipelineTest > validate shell command[0] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34

tests.job.CIPipelineTest > validate shell command[1] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34

tests.job.CIPipelineTest > validate shell command[2] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34

tests.job.CIPipelineTest > validate shell command[3] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34

tests.job.CIPipelineTest > validate shell command[4] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34

tests.job.CIPipelineTest > validate shell command[5] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34

tests.job.CIPipelineTest > validate shell command[6] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34

tests.job.CIPipelineTest > validate shell command[7] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34

tests.job.CIPipelineTest > validate shell command[8] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34

tests.job.CIPipelineTest > validate shell command[9] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34

11 tests completed, 11 failed :test FAILED

nishwalshetty avatar Jul 02 '21 04:07 nishwalshetty

@macg33zr can you help ?

nishwalshetty avatar Jul 02 '21 05:07 nishwalshetty