Merge pull request #39724 from thaJeztah/integration_junit

Jenkinsfile: create junit.xml for integration tests
This commit is contained in:
Tibor Vass 2019-09-11 15:04:08 -07:00 committed by GitHub
commit 234b951483
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 7 deletions

38
Jenkinsfile vendored
View file

@ -22,6 +22,7 @@ pipeline {
DOCKER_GRAPHDRIVER = 'overlay2'
APT_MIRROR = 'cdn-fastly.deb.debian.org'
CHECK_CONFIG_COMMIT = '78405559cfe5987174aa2cb6463b9b2c1b917255'
TESTDEBUG = '0'
TIMEOUT = '120m'
}
stages {
@ -319,6 +320,11 @@ pipeline {
exit $c
'''
}
post {
always {
junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
}
}
}
}
@ -339,7 +345,7 @@ pipeline {
bundleName=amd64
echo "Creating ${bundleName}-bundles.tar.gz"
# exclude overlay2 directories
find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*.log' -o -name '*.prof' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*-report.json' -o -name '*.log' -o -name '*.prof' -o -name '*-report.xml' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
'''
archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
@ -408,6 +414,7 @@ pipeline {
-e DOCKER_EXPERIMENTAL \
-e DOCKER_GITCOMMIT=${GIT_COMMIT} \
-e DOCKER_GRAPHDRIVER \
-e TESTDEBUG \
-e TEST_SKIP_INTEGRATION_CLI \
-e TIMEOUT \
docker:${GIT_COMMIT} \
@ -416,6 +423,11 @@ pipeline {
test-integration
'''
}
post {
always {
junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
}
}
}
}
@ -436,7 +448,7 @@ pipeline {
bundleName=s390x-integration
echo "Creating ${bundleName}-bundles.tar.gz"
# exclude overlay2 directories
find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*.log' -o -name '*.prof' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*-report.json' -o -name '*.log' -o -name '*.prof' -o -name '*-report.xml' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
'''
archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
@ -494,6 +506,11 @@ pipeline {
test-integration
'''
}
post {
always {
junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
}
}
}
}
@ -514,7 +531,7 @@ pipeline {
bundleName=s390x-integration-cli
echo "Creating ${bundleName}-bundles.tar.gz"
# exclude overlay2 directories
find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*.log' -o -name '*.prof' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*-report.json' -o -name '*.log' -o -name '*.prof' -o -name '*-report.xml' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
'''
archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
@ -581,6 +598,7 @@ pipeline {
-e DOCKER_EXPERIMENTAL \
-e DOCKER_GITCOMMIT=${GIT_COMMIT} \
-e DOCKER_GRAPHDRIVER \
-e TESTDEBUG \
-e TEST_SKIP_INTEGRATION_CLI \
-e TIMEOUT \
docker:${GIT_COMMIT} \
@ -589,6 +607,11 @@ pipeline {
test-integration
'''
}
post {
always {
junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
}
}
}
}
@ -609,7 +632,7 @@ pipeline {
bundleName=ppc64le-integration
echo "Creating ${bundleName}-bundles.tar.gz"
# exclude overlay2 directories
find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*.log' -o -name '*.prof' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*-report.json' -o -name '*.log' -o -name '*.prof' -o -name '*-report.xml' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
'''
archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
@ -665,6 +688,11 @@ pipeline {
test-integration
'''
}
post {
always {
junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
}
}
}
}
@ -685,7 +713,7 @@ pipeline {
bundleName=ppc64le-integration-cli
echo "Creating ${bundleName}-bundles.tar.gz"
# exclude overlay2 directories
find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*.log' -o -name '*.prof' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*-report.json' -o -name '*.log' -o -name '*.prof' -o -name '*-report.xml' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
'''
archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true

View file

@ -59,9 +59,27 @@ run_test_integration_suites() {
for dir in ${integration_api_dirs}; do
if ! (
cd "$dir"
echo "Running $PWD flags=${flags}"
# Create a useful package name based on the tests's $dir. We need to take
# into account that "$dir" can be either an absolute (/go/src/github.com/docker/docker/integration/foo)
# or relative (./integration/foo) path. To account for both, first we strip
# the absolute path, then remove any leading periods and slashes.
pkgname="${dir}"
pkgname="${pkgname#*${GOPATH}/src/${DOCKER_PKG}}"
pkgname="${pkgname#*.}"
pkgname="${pkgname#*\/}"
# Finally, we use periods as separator (instead of slashes) to be more
# in line with Java package names (which is what junit.xml was designed for)
pkgname="$(go env GOARCH).${pkgname//\//.}"
echo "Running $PWD (${pkgname}) flags=${flags}"
[ -n "$TESTDEBUG" ] && set -x
# shellcheck disable=SC2086
test_env ./test.main ${flags}
test_env gotestsum \
--format=standard-verbose \
--jsonfile="${ABS_DEST}/${pkgname//./-}-go-test-report.json" \
--junitfile="${ABS_DEST}/${pkgname//./-}-junit-report.xml" \
--raw-command \
-- go tool test2json -p "${pkgname}" -t ./test.main ${flags}
); then exit 1; fi
done
}