-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dumbledore <mathenge@healthcloud.co.ke>
- Loading branch information
1 parent
20e7b4c
commit e1ba8bc
Showing
2 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
echo "Quality Gate: checking test coverage is above threshold ..." | ||
echo "Threshold : ${TESTCOVERAGE_THRESHOLD} %" | ||
totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'` | ||
echo "Current test coverage : $totalCoverage %" | ||
if (( $(echo "$totalCoverage ${TESTCOVERAGE_THRESHOLD}" | awk '{print ($1 >= $2)}') )); then | ||
echo "OK" | ||
else | ||
echo "Current test coverage is below threshold. Please add more unit tests or adjust threshold to a lower value." | ||
echo "Failed" | ||
exit 1 | ||
fi |