Pass or fail gatling-gerrit-test based on gatling results
Checks gatling reports after simulation executions, and turn
build-status to FAILURE if some tests failed.
Bug: Issue 14457
Change-Id: I5ad3891f9bc0ef06f6cbb103c69b3dd6f0b3d731
diff --git a/jenkins/gatling-test-pipeline.groovy b/jenkins/gatling-test-pipeline.groovy
index faa09c3..07f1e58 100644
--- a/jenkins/gatling-test-pipeline.groovy
+++ b/jenkins/gatling-test-pipeline.groovy
@@ -186,6 +186,19 @@
}
}
}
+ stage('Check tests results') {
+ steps {
+ script {
+ def failed_tests = sh(
+ returnStdout: true,
+ script: "for i in `find ${WORKSPACE} -name \"global_stats.json\"`; do cat \$i | jq '.numberOfRequests.ko'| grep -v '0' || true; done;"
+ )
+ if (failed_tests.trim()) {
+ error("Setting build as failed because some gatling tests were not OK")
+ }
+ }
+ }
+ }
}
post {
cleanup {