Skip to content

Commit

Permalink
Add unit tests to Filebeat in Pipeline as example (#9778)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruflin authored Dec 27, 2018
1 parent 494d5ac commit 54875d0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,38 @@ pipeline {
}
}
}
stage('Test') {
failFast true
parallel {
/**
Run unit tests and report junit results.
*/
stage('Filebeat') {
agent { label 'linux && immutable' }
options { skipDefaultCheckout() }
environment {
PATH = "${env.PATH}:${env.WORKSPACE}/bin"
HOME = "${env.WORKSPACE}"
GOPATH = "${env.WORKSPACE}"
}
steps {
withEnvWrapper() {
unstash 'source'
dir("${BASE_DIR}"){
sh './filebeat/scripts/jenkins/unit-test.sh'
}
}
}
post {
always {
junit(allowEmptyResults: true,
keepLongStdio: true,
testResults: "${BASE_DIR}/build/junit-*.xml")
}
}
}
}
}
}
post {
success {
Expand Down
8 changes: 8 additions & 0 deletions filebeat/scripts/jenkins/unit-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -exuo pipefail

source ./dev-tools/common.bash

jenkins_setup

mage GoUnitTest || echo -e "\033[31;49mTests FAILED\033[0m"

0 comments on commit 54875d0

Please sign in to comment.