Files
query-orchestration/scripts/tests.yml
T
Jay Brown 174644b63c Merged in jb/openapi (pull request #22)
add openapi infra

* add openapi infra

Includes generated stubs and all deps

* generatetolocation

* basesetupoffunctionsandclient

* round1controllertests

* passintegrationtests

* cleanupfromfullsuite

* storedjson

* fixjsonyaml

* fixtests


Approved-by: Michael McGuinness
2025-01-15 19:45:51 +00:00

56 lines
1.4 KiB
YAML

---
# https://taskfile.dev
version: '3'
vars:
COVERAGE_FILE: "{{.OUT_DIR}}/coverage.out"
tasks:
mocks:
cmds:
- mockery
unit:
vars:
INTERNAL: "./internal/..."
API: "./api/..."
PKG: "./pkg/..."
cmds:
- mkdir -p {{.OUT_DIR}}
- |
go test {{.INTERNAL}} {{.API}} {{.PKG}} \
-coverpkg={{.INTERNAL}},{{.API}},{{.PKG}} \
-coverprofile={{.COVERAGE_FILE}}
unit:coverage:
deps:
- unit
vars:
TMP_FILE: "{{.OUT_DIR}}/coverage.tmp"
FILTER_COVERAGE_FILE: "{{.OUT_DIR}}/filtered_coverage.out"
cmds:
- grep -v ".gen.go" {{.COVERAGE_FILE}} > {{.FILTER_COVERAGE_FILE}}
- go tool cover -func={{.FILTER_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:
cmds:
- task docker:build
- task test:integration:nobuild
integration:nocache:
cmds:
- task docker:build
- go test -count=1 -v ./test/...
integration:nobuild:
cmds:
- go test -v ./test/...