Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Integration Tests + fixes for JENKINS-56312 and JENKINS-57320 #140

Merged
merged 8 commits into from May 3, 2019
71 changes: 69 additions & 2 deletions Jenkinsfile
Expand Up @@ -50,6 +50,73 @@ for (int i = 0; i < platforms.size(); ++i) {
}
}
}

/* Execute our platforms in parallel */
parallel(branches)

// Integration testing, using a locally built Docker image
def itBranches = [:]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is definitely some level of copy paste below. I think we'll want to factor this out at some point.

But I didn't want to spend too much making this generic yet (like having a way to simply provide the command the pass, the expected result, etc.). I'd rather first have this merged as-is, once green, and we iterate on growing the test coverage and will refactor in followups.



itBranches['buildtriggerbadge:2.10 tests success on JDK11'] = {
node('docker') {
checkout scm

// should we build the image only once and somehow export and stash/unstash it then?
// not sure this would be that quicker
stage('Build Docker Image') {
sh 'make docker'
}

stage('Download Jenkins 2.164.1') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2.164.2?

sh '''
curl -sL http://mirrors.jenkins.io/war-stable/2.164.1/jenkins.war --output jenkins.war
echo "65543f5632ee54344f3351b34b305702df12393b3196a95c3771ddb3819b220b jenkins.war" | sha256sum --check
'''
}

stage("Run known successful case(s)") {
sh '''docker run --rm \
-v $(pwd)/jenkins.war:/pct/jenkins.war:ro \
-v $(pwd)/out:/pct/out -e JDK_VERSION=11 \
-e ARTIFACT_ID=buildtriggerbadge -e VERSION=buildtriggerbadge-2.10 \
jenkins/pct
'''
archiveArtifacts artifacts: "out/**"

sh 'cat out/pct-report.html | grep "Tests : Success"'
}
}
}

itBranches['buildtriggerbadge:2.10 tests success on JDK8'] = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to prevent copy-paste ?

node('docker') {
checkout scm

// should we build the image only once and somehow export and stash/unstash it then?
// not sure this would be that quicker
stage('Build Docker Image') {
sh 'make docker'
}

stage('Download Jenkins 2.164.1') {
sh '''
curl -sL http://mirrors.jenkins.io/war-stable/2.164.1/jenkins.war --output jenkins.war
echo "65543f5632ee54344f3351b34b305702df12393b3196a95c3771ddb3819b220b jenkins.war" | sha256sum --check
'''
}

stage("Run known successful case(s)") {
sh '''docker run --rm \
-v $(pwd)/jenkins.war:/pct/jenkins.war:ro \
-v $(pwd)/out:/pct/out -e JDK_VERSION=8 \
-e ARTIFACT_ID=buildtriggerbadge -e VERSION=buildtriggerbadge-2.10 \
jenkins/pct
'''
archiveArtifacts artifacts: "out/**"

sh 'cat out/pct-report.html | grep "Tests : Success"'
}
}
}

itBranches.failFast = false
parallel itBranches