Files
query-orchestration/scripts/tests.yml
T

46 lines
1.2 KiB
YAML
Raw Normal View History

2024-12-19 11:38:57 +00:00
# https://taskfile.dev
version: '3'
includes:
docker:
taskfile: docker.yml
internal: true
vars:
2025-01-07 13:06:43 +00:00
COVERAGE_FILE: "{{.CONTEXT}}/{{.OUT_DIR}}/coverage.out"
2024-12-19 11:38:57 +00:00
tasks:
unit:
cmds:
2024-12-24 12:47:40 +00:00
- mkdir -p {{.CONTEXT}}/{{.OUT_DIR}}
2025-01-07 13:06:43 +00:00
- go test {{.CONTEXT}}/test/unit/... -coverpkg={{.CONTEXT}}/internal/...,{{.CONTEXT}}/pkg/... -coverprofile={{.COVERAGE_FILE}}
2024-12-19 11:38:57 +00:00
unit:coverage:
deps:
- unit
vars:
TMP_FILE: "{{.CONTEXT}}/{{.OUT_DIR}}/coverage.tmp"
cmds:
2025-01-07 13:06:43 +00:00
- go tool cover -func={{.COVERAGE_FILE}} > {{.TMP_FILE}}
2024-12-19 11:38:57 +00:00
- 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:
cmds:
- go test -v {{.CONTEXT}}/test/integration/...
integration:nocache:
cmds:
- go test -count=1 -v {{.CONTEXT}}/test/integration/...
integration:build:
deps:
- docker:build
cmds:
- task test:integration