Skip to content

Commit

Permalink
integration: use gotestsum to generate junit.xml and go-test-report.json
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Sep 11, 2019
1 parent 871994c commit f3be6b3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
35 changes: 30 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@ pipeline {
exit $c
'''
}
post {
always {
junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
}
}
}
}

Expand All @@ -339,7 +344,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
Expand Down Expand Up @@ -416,6 +421,11 @@ pipeline {
test-integration
'''
}
post {
always {
junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
}
}
}
}

Expand All @@ -436,7 +446,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
Expand Down Expand Up @@ -494,6 +504,11 @@ pipeline {
test-integration
'''
}
post {
always {
junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
}
}
}
}

Expand All @@ -514,7 +529,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
Expand Down Expand Up @@ -589,6 +604,11 @@ pipeline {
test-integration
'''
}
post {
always {
junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
}
}
}
}

Expand All @@ -609,7 +629,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
Expand Down Expand Up @@ -665,6 +685,11 @@ pipeline {
test-integration
'''
}
post {
always {
junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
}
}
}
}

Expand All @@ -685,7 +710,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
Expand Down
8 changes: 7 additions & 1 deletion hack/make/.integration-test-helpers
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,14 @@ run_test_integration_suites() {
if ! (
cd "$dir"
echo "Running $PWD flags=${flags}"
[ -n "$TESTDEBUG" ] && set -x
# shellcheck disable=SC2086
test_env ./test.main ${flags}
test_env gotestsum \
--format=standard-verbose \
--jsonfile="${ABS_DEST}/$(basename "$dir")-go-test-report.json" \
--junitfile="${ABS_DEST}/$(basename "$dir")-junit-report.xml" \
--raw-command \
-- go tool test2json ./test.main ${flags}
); then exit 1; fi
done
}
Expand Down

0 comments on commit f3be6b3

Please sign in to comment.