When the Jenkinsfile is renamed and the path in the test is adjusted the test fails
When Jenkinsfile was renamed, e.g. x.jenkins and the path in the test as well, the gradle build fails:
when cloned:
gradle clean build
BUILD SUCCESSFUL in 8s
4 actionable tasks: 4 executed
when Jenkinsfile renamed
gradle clean build
> Task :test
tests.job.JenkinsfileTestSpec > Jenkinsfile should run gradle tests with expected command line validate:null gradle: null FAILED
groovy.util.ResourceException at JenkinsfileTestSpec.groovy:26
Caused by: groovy.util.ResourceException at JenkinsfileTestSpec.groovy:26
Then I thought perhaps there is another jenkins file. This was the case, i.e. ./exampleJobs/parallel/Jenkinsfile and when this was renamed the issue persisted.
Should all Jenkins. entries that reside in the test files be renamed as well?
If you rename the Jenkinsfile at the top level say to something like "Foo.groovy" you will need to look for the lines in the tests like "runScript('Jenkinsfile')" and change to "runScript('Foo.groovy')". Also, for tests that assert the pipeline call stacks to a file using 'testNonRegression', the content of all these call stack files will need updating for lines like 'Jenkinsfile.pipeline(groovy.lang.Closure)' which would become 'Foo.pipeline(groovy.lang.Closure)' (these are the files under 'tests/callstacks'. You don't need to update these call stack files manually though, you can go into the gradle.properties file and set 'pipeline.stack.write=true' then run all the tests and review the changes. Does this answer it?