Files
query-orchestration/scripts/tests.yml
T
Michael McGuinness 0ebb8a21a1 Merged in bugfix/cleanup (pull request #10)
Clean Up Testing and Linting

* somescriptcleanup

* mostgolangci

* deplatest

* imageversions

* usingscratch

* movedqueuefrtesting

* finishedunittesting

* linting

* taskfilecontext
2025-01-10 11:12:03 +00:00

58 lines
1.2 KiB
YAML

---
# https://taskfile.dev
version: '3'
includes:
docker:
taskfile: docker.yml
internal: true
vars:
COVERAGE_FILE: "{{.OUT_DIR}}/coverage.out"
tasks:
mocks:
cmds:
- mockery
unit:
vars:
INTERNAL: "./internal/..."
API: "./api/..."
cmds:
- |
go test {{.INTERNAL}} {{.API}} \
-coverpkg={{.INTERNAL}},{{.API}} -coverprofile={{.COVERAGE_FILE}}
unit:coverage:
deps:
- unit
vars:
TMP_FILE: "{{.OUT_DIR}}/coverage.tmp"
cmds:
- go tool cover -func={{.COVERAGE_FILE}} > {{.TMP_FILE}}
- cat {{.TMP_FILE}}
- |
COVERAGE=$(grep total: {{.TMP_FILE}} \
| awk '{print $3}' | sed 's/%//' | bc)
echo ""
echo "Coverage Threshold: {{.COVERAGE_THRESHOLD}}%"
echo "Total Coverage: $COVERAGE%"
if (( $(echo "$COVERAGE < {{.COVERAGE_THRESHOLD}}" | bc -l) )); then
echo "Total Coverage below Coverage Threshold"
exit 1
fi
silent: true
integration:
deps:
- docker:build
cmds:
- task test:integration:nobuild
integration:nocache:
deps:
- docker:build
cmds:
- go test -count=1 -v test/...
integration:nobuild:
cmds:
- go test -v test/...