Skip to content

Commit

Permalink
chore: use gotestsum for test execution (#2586)
Browse files Browse the repository at this point in the history
  • Loading branch information
atzoum authored Oct 19, 2022
1 parent 71c8a15 commit a194b0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,8 @@ jobs:
check-latest: true
cache: true

- uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: go version
- run: go mod download # Not required, used to segregate module download vs test times
- run: (cd /tmp && go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo@latest)
- run: ginkgo version
- env:
TEST_KAFKA_CONFLUENT_CLOUD_HOST: ${{ secrets.TEST_KAFKA_CONFLUENT_CLOUD_HOST }}
TEST_KAFKA_CONFLUENT_CLOUD_KEY: ${{ secrets.TEST_KAFKA_CONFLUENT_CLOUD_KEY }}
Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.PHONY: help default build run run-mt test test-run test-teardown mocks

GO=go
GINKGO=ginkgo
LDFLAGS?=-s -w
TESTFILE=_testok

Expand All @@ -10,11 +9,16 @@ default: build
mocks: install-tools ## Generate all mocks
$(GO) generate ./...

test: test-run test-teardown
test: install-tools test-run test-teardown

test-run: ## Run all unit tests
ifeq ($(filter 1,$(debug) $(RUNNER_DEBUG)),)
$(eval TEST_CMD = SLOW=0 gotestsum --format pkgname-and-test-fails --)
$(eval TEST_OPTIONS = -p=1 -v -failfast -shuffle=on -coverprofile=profile.out -covermode=atomic -vet=all --timeout=15m)
else
$(eval TEST_CMD = SLOW=0 go test)
$(eval TEST_OPTIONS = -p=1 -v -failfast -shuffle=on -coverprofile=profile.out -covermode=atomic -vet=all --timeout=15m)
endif
ifdef package
$(TEST_CMD) $(TEST_OPTIONS) $(package) && touch $(TESTFILE) || true
else
Expand Down Expand Up @@ -64,6 +68,7 @@ install-tools:
go install mvdan.cc/gofumpt@latest
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
go install gotest.tools/[email protected]

.PHONY: lint
lint: fmt ## Run linters on all go files
Expand Down

0 comments on commit a194b0c

Please sign in to comment.