Skip to content
Closed
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
18 changes: 15 additions & 3 deletions taskfiles/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@ tasks:
- ut
vars:
TIMEOUT: '{{if .CI}}5m{{else}}1m{{end}}'
preconditions:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

- sh: command -v {{.TOOLS_BIN_DIR}}/gotestfmt
msg: "gotestfmt is not installed. Run 'task tools:install-gotestfmt' first."
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
preconditions:
- sh: command -v {{.TOOLS_BIN_DIR}}/gotestfmt
msg: "gotestfmt is not installed. Run 'task tools:install-gotestfmt' first."
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
Expand All @@ -26,8 +32,11 @@ tasks:
- PKG
vars:
TIMEOUT: '{{if .CI}}15m{{else}}5m{{end}}'
preconditions:
- sh: command -v {{.TOOLS_BIN_DIR}}/gotestfmt
msg: "gotestfmt is not installed. Run 'task tools:install-gotestfmt' first."
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 All @@ -38,6 +47,9 @@ tasks:
vars:
TEMPLATE_FILES:
sh: find internal/impl -type f -name "*tmpl.yaml" | tr '\n' ' '
preconditions:
- sh: command -v {{.TOOLS_BIN_DIR}}/gotestfmt
msg: "gotestfmt is not installed. Run 'task tools:install-gotestfmt' first."
cmds:
- '{{.TARGET_DIR}}/redpanda-connect template lint {{.TEMPLATE_FILES}}'
- '{{.TARGET_DIR}}/redpanda-connect test ./config/test/...'
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]
Loading