Files
query-orchestration/scripts/tests.yml
T

51 lines
1.2 KiB
YAML
Raw Normal View History

2025-01-10 11:12:03 +00:00
---
2024-12-19 11:38:57 +00:00
# https://taskfile.dev
version: '3'
vars:
2025-01-10 11:12:03 +00:00
COVERAGE_FILE: "{{.OUT_DIR}}/coverage.out"
2024-12-19 11:38:57 +00:00
tasks:
2025-01-10 11:12:03 +00:00
mocks:
cmds:
- mockery
2024-12-19 11:38:57 +00:00
unit:
2025-01-07 16:30:45 +00:00
vars:
2025-01-10 11:12:03 +00:00
INTERNAL: "./internal/..."
API: "./api/..."
2024-12-19 11:38:57 +00:00
cmds:
2025-01-10 11:12:03 +00:00
- |
go test {{.INTERNAL}} {{.API}} \
-coverpkg={{.INTERNAL}},{{.API}} -coverprofile={{.COVERAGE_FILE}}
2024-12-19 11:38:57 +00:00
unit:coverage:
deps:
- unit
vars:
2025-01-10 11:12:03 +00:00
TMP_FILE: "{{.OUT_DIR}}/coverage.tmp"
2024-12-19 11:38:57 +00:00
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}}
- |
2025-01-10 11:12:03 +00:00
COVERAGE=$(grep total: {{.TMP_FILE}} \
| awk '{print $3}' | sed 's/%//' | bc)
2024-12-19 11:38:57 +00:00
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:
2025-01-10 12:58:14 +00:00
- task docker:build
2025-01-07 16:30:45 +00:00
- task test:integration:nobuild
2024-12-19 11:38:57 +00:00
integration:nocache:
cmds:
2025-01-10 12:58:14 +00:00
- task docker:build
- go test -count=1 -v ./test/...
2025-01-07 16:30:45 +00:00
integration:nobuild:
cmds:
2025-01-10 12:58:14 +00:00
- go test -v ./test/...