Skip to content

Commit

Permalink
testing: add tparse to summarize testing (#844)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfridman authored Oct 19, 2024
1 parent e78caf2 commit a02d852
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
echo "Please format Go code by running: go fmt ./..."
exit 1
fi
- name: Install tparse
run: go install github.com/mfridman/tparse@latest
- name: Run tests
run: |
mkdir -p bin
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: "stable"
- name: Install tparse
run: go install github.com/mfridman/tparse@latest
- name: Run full integration tests
run: |
make test-integration
33 changes: 19 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GO_TEST_FLAGS ?= -race -count=1 -v -timeout=5m
GO_TEST_FLAGS ?= -race -count=1 -v -timeout=5m -json

# These are the default values for the test database. They can be overridden
DB_USER ?= dbuser
Expand Down Expand Up @@ -38,19 +38,22 @@ lint: tools
.PHONY: tools
tools:
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
@go install github.com/mfridman/tparse@latest

test-packages:
go test $(GO_TEST_FLAGS) $$(go list ./... | grep -v -e /tests -e /bin -e /cmd -e /examples)
go test $(GO_TEST_FLAGS) $$(go list ./... | grep -v -e /tests -e /bin -e /cmd -e /examples) |\
tparse --follow -sort=elapsed

test-packages-short:
go test -test.short $(GO_TEST_FLAGS) $$(go list ./... | grep -v -e /tests -e /bin -e /cmd -e /examples)
go test -test.short $(GO_TEST_FLAGS) $$(go list ./... | grep -v -e /tests -e /bin -e /cmd -e /examples) |\
tparse --follow -sort=elapsed

coverage-short:
go test ./ -test.short $(GO_TEST_FLAGS) -cover -coverprofile=coverage.out
go test ./ -test.short $(GO_TEST_FLAGS) -cover -coverprofile=coverage.out | tparse --follow -sort=elapsed
go tool cover -html=coverage.out

coverage:
go test ./ $(GO_TEST_FLAGS) -cover -coverprofile=coverage.out
go test ./ $(GO_TEST_FLAGS) -cover -coverprofile=coverage.out | tparse --follow -sort=elapsed
go tool cover -html=coverage.out

#
Expand All @@ -67,31 +70,33 @@ upgrade-integration-deps:
cd ./internal/testing && go get -u ./... && go mod tidy

test-postgres-long: add-gowork test-postgres
go test $(GO_TEST_FLAGS) ./internal/testing/integration -run='(TestPostgresProviderLocking|TestPostgresSessionLocker)'
go test $(GO_TEST_FLAGS) ./internal/testing/integration -run='(TestPostgresProviderLocking|TestPostgresSessionLocker)' |\
tparse --follow -sort=elapsed

test-postgres: add-gowork
go test $(GO_TEST_FLAGS) ./internal/testing/integration -run="^TestPostgres$$"
go test $(GO_TEST_FLAGS) ./internal/testing/integration -run="^TestPostgres$$" | tparse --follow -sort=elapsed

test-clickhouse: add-gowork
go test $(GO_TEST_FLAGS) ./internal/testing/integration -run='(TestClickhouse|TestClickhouseRemote)'
go test $(GO_TEST_FLAGS) ./internal/testing/integration -run='(TestClickhouse|TestClickhouseRemote)' |\
tparse --follow -sort=elapsed

test-mysql: add-gowork
go test $(GO_TEST_FLAGS) ./internal/testing/integration -run='TestMySQL'
go test $(GO_TEST_FLAGS) ./internal/testing/integration -run='TestMySQL' | tparse --follow -sort=elapsed

test-turso: add-gowork
go test $(GO_TEST_FLAGS) ./internal/testing/integration -run='TestTurso'
go test $(GO_TEST_FLAGS) ./internal/testing/integration -run='TestTurso' | tparse --follow -sort=elapsed

test-vertica: add-gowork
go test $(GO_TEST_FLAGS) ./internal/testing/integration -run='TestVertica'
go test $(GO_TEST_FLAGS) ./internal/testing/integration -run='TestVertica' | tparse --follow -sort=elapsed

test-ydb: add-gowork
go test $(GO_TEST_FLAGS) ./internal/testing/integration -run='TestYDB'
go test $(GO_TEST_FLAGS) ./internal/testing/integration -run='TestYDB' | tparse --follow -sort=elapsed

test-starrocks: add-gowork
go test $(GO_TEST_FLAGS) ./internal/testing/integration -run='TestStarrocks'
go test $(GO_TEST_FLAGS) ./internal/testing/integration -run='TestStarrocks' | tparse --follow -sort=elapsed

test-integration: add-gowork
go test $(GO_TEST_FLAGS) ./internal/testing/integration/...
go test $(GO_TEST_FLAGS) ./internal/testing/integration/... | tparse --follow -sort=elapsed

#
# Docker-related targets
Expand Down

0 comments on commit a02d852

Please sign in to comment.