Integration tests using the Jenkins CLI
431
This example is based on the job-dsl project.
The integration tests ensure that Jenkins is running properly, they run some jobs and verify the console output.
.
├── src/integration/groovy # Integration tests
│ ├── com.ticketfly.jenkins.common.JenkinsCLIWrapper # Wrapper for the Jenkins CLI
│ ├── com.ticketfly.jenkins.spec.JenkinsSpec # Base Specification
│ ├── com.ticketfly.jenkins.spec.global.JenkinsInstanceSpec # Test Jenkins configuration
│ ├── com.ticketfly.jenkins.spec.job.RunJobSpec # Test Jenkins jobs
└── build.gradle # define integration tasks
./gradlew runIntegration Build the docker image, start Jenkins, run integration tests, stop Jenkins.
./gradlew integration Run integration tests. (Jenkins has to be started)
./gradlew integration -Dintegration.single=JenkinsInstanceSpec Run a single spec.
curl -sSL "http://localhost:8080/pluginManager/api/xml?depth=1&xpath=/*/*/shortName|/*/*/version&wrapper=plugins" | perl -pe 's/.*?<shortName>([\w-]+).*?<version>([^<]+)()(<\/\w+>)+/\1 \2\n/g'|sed 's/ /:/' | sort List plugin versions on running Jenkins.
They are many things that can go wrong when making some changes on the Jenkins docker image:
init.groovy.d can be easy to break and hard to test. In this example, the startup script sets the markup formatter to be HTML. An integration verifies this, the test is called check configured markup is HTML.Hosted at ticketfly/jenkins-example-integration-tests
Content type
Image
Digest
Size
196.5 MB
Last updated
about 9 years ago
docker pull ticketfly/jenkins-example-integration-tests