Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions taskfiles/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,35 @@ tasks:
desc: Run unit tests
aliases:
- ut
deps:
- :tools:install-gotestfmt
vars:
TIMEOUT: '{{if .CI}}5m{{else}}1m{{end}}'
cmds:
- go test {{.GO_FLAGS}} -timeout {{.TIMEOUT}} -shuffle=on {{if .CI}}{{else}}-v{{end}} ./...
- go test {{.GO_FLAGS}} -json -timeout {{.TIMEOUT}} -shuffle=on {{if .CI}}{{else}}-v{{end}} ./... 2>&1 | tee /tmp/gotest.log | {{.TOOLS_BIN_DIR}}/gotestfmt

unit-race:
desc: Run unit tests with race detection
aliases:
- ut-race
deps:
- :tools:install-gotestfmt
cmds:
- go test {{.GO_FLAGS}} -timeout 3m -shuffle=on -race {{if .CI}}{{else}}-v{{end}} ./...
- go test {{.GO_FLAGS}} -json -timeout 3m -shuffle=on -race {{if .CI}}{{else}}-v{{end}} ./... 2>&1 | tee /tmp/gotest.log | {{.TOOLS_BIN_DIR}}/gotestfmt

integration-package:
desc: Run integration tests for package PKG
aliases:
- it
deps:
- :tools:install-gotestfmt
requires:
vars:
- PKG
vars:
TIMEOUT: '{{if .CI}}15m{{else}}5m{{end}}'
cmds:
- go test {{.GO_FLAGS}} -run "^Test.*Integration" -timeout {{.TIMEOUT}} {{if .CI}}{{else}}-v{{end}} {{.PKG}}
- go test {{.GO_FLAGS}} -json -run "^Test.*Integration" -timeout {{.TIMEOUT}} {{if .CI}}{{else}}-v{{end}} {{.PKG}} 2>&1 | tee /tmp/gotest.log | {{.TOOLS_BIN_DIR}}/gotestfmt

template:
desc: Run template tests
Expand Down
10 changes: 9 additions & 1 deletion taskfiles/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ tasks:
deps:
- install-golangci-lint
- install-govulncheck
- install-gotestfmt

install-golangci-lint:
desc: Install golangci-lint
Expand All @@ -27,4 +28,11 @@ tasks:
run: always
silent: true
cmds:
- GOBIN={{.GOBIN}} go install golang.org/x/vuln/cmd/govulncheck@latest
- GOBIN={{.GOBIN}} go install golang.org/x/vuln/cmd/govulncheck@latest

install-gotestfmt:
desc: Install gotestfmt
run: always
silent: true
cmds:
- GOBIN={{.GOBIN}} go install github.com/gotesttools/gotestfmt/v2/cmd/[email protected]