Files
query-orchestration/scripts/tests.yml
T
Michael McGuinness 7001ca854c Merged in feature/docinitialisation (pull request #41)
Queuing Changes and Cfg Testing

* staarting

* staarting

* startedpush

* note

* save

* mocking

* removederrs

* fixtests

* cleanuperrs

* newenvsetup

* preppingtests

* queue

* mmovetocfgpassunittests

* sortoutconfig

* passinginteg

* deps

* fixtests
2025-02-03 17:30:50 +00:00

63 lines
1.5 KiB
YAML

---
# https://taskfile.dev
version: '3'
vars:
COVERAGE_FILE: "{{.OUT_DIR}}/coverage.out"
INTERNAL: "./internal/..."
API: "./api/..."
PKG: "./pkg/..."
tasks:
mocks:generate:
cmds:
- rm -rf mocks/*
- mockery
unit:short:
deps:
- mocks:generate
cmds:
- go test -short {{.INTERNAL}} {{.API}} {{.PKG}}
unit:nocoverage:
deps:
- mocks:generate
cmds:
- mkdir -p {{.OUT_DIR}}
- |
go test {{.INTERNAL}} {{.API}} {{.PKG}} \
-coverpkg={{.INTERNAL}},{{.API}},{{.PKG}} \
-coverprofile={{.COVERAGE_FILE}}
unit:
deps:
- unit:nocoverage
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 generate
- task docker:build
- task test:integration:nocache
integration:nocache:
cmds:
- go test -count=1 -v ./test/...
integration:nobuild:
cmds:
- go test -v ./test/...