Skip to content

Commit

Permalink
fix test coverage check
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofel committed Dec 4, 2024
1 parent a037c1c commit 6474015
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion wasp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test_race:

.PHONY: test_benchspy_race
test_benchspy_race:
go test -v -race -coverprofile cover.out -count 1 `go list ./... | grep -v examples | grep benchspy` -run TestBenchSpy
@./scripts/run_benchspy_tests.sh

.PHONY: test_bench
test_bench:
Expand Down
14 changes: 14 additions & 0 deletions wasp/scripts/run_benchspy_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

go test -v -race -coverprofile cover.out -count 1 `go list ./... | grep -v examples | grep benchspy` -run TestBenchSpy
coverage=$(go tool cover -func=cover.out | grep total | awk '{print substr($3, 1, length($3)-1)}')
if [ -z "$coverage" ]; then
echo "Error: Could not determine test coverage";
exit 1
fi

if [[ $(echo "$coverage < 85" | bc -l) -eq 1 ]]; then
echo "Test coverage $coverage% is below minimum 85%"
exit 1
fi
echo "Test coverage: $coverage%"

0 comments on commit 6474015

Please sign in to comment.