Skip to content

Commit

Permalink
Break up CI tests into pkg, tempodb, tempodb/wal and others (#2324)
Browse files Browse the repository at this point in the history
* Break up tests into pkg, tempodb and others in CI Job

* fix ci.yaml file

* fix Makefile

* Run tests with -v

* split tempodb/wal out from tempodb

* lower go test timeout

* keep unit-tests-tempodb name short
  • Loading branch information
electron0zero authored Apr 12, 2023
1 parent 60eb00b commit 25a9cae
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 4 deletions.
50 changes: 47 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,53 @@ jobs:
with:
version: v1.51.0

unit-tests-pkg:
name: Test packages - pkg
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.20.x

- name: Check out code
uses: actions/checkout@v3

- name: Test
run: make test-with-cover-pkg

unit-tests-tempodb:
name: Test packages - tempodb
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.20.x

- name: Check out code
uses: actions/checkout@v3

- name: Test
run: make test-with-cover-tempodb

unit-tests-tempodb-wal:
name: Test packages - tempodb/wal
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.20.x

- name: Check out code
uses: actions/checkout@v3

- name: Test
run: make test-with-cover-tempodb-wal

unit-tests:
name: Test packages
unit-tests-others:
name: Test packages - others
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.20
Expand All @@ -62,7 +106,7 @@ jobs:
uses: actions/checkout@v3

- name: Test
run: make test-with-cover
run: make test-with-cover-others

integration-tests:
name: Test integration e2e suite
Expand Down
32 changes: 31 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ ALL_SRC := $(shell find . -name '*.go' \
-not -path './cmd/tempo-serverless/*' \
-type f | sort)

# ALL_SRC but without pkg and tempodb packages
OTHERS_SRC := $(shell find . -name '*.go' \
-not -path './vendor*/*' \
-not -path './integration/*' \
-not -path './cmd/tempo-serverless/*' \
-not -path './pkg*/*' \
-not -path './tempodb*/*' \
-type f | sort)

# All source code and documents. Used in spell check.
ALL_DOC := $(shell find . \( -name "*.md" -o -name "*.yaml" \) \
-type f | sort)
Expand All @@ -34,7 +43,7 @@ ifeq ($(BUILD_DEBUG), 1)
GO_OPT+= -gcflags="all=-N -l"
endif

GOTEST_OPT?= -race -timeout 30m -count=1
GOTEST_OPT?= -race -timeout 20m -count=1 -v
GOTEST_OPT_WITH_COVERAGE = $(GOTEST_OPT) -cover
GOTEST=go test
LINT=golangci-lint
Expand Down Expand Up @@ -83,10 +92,31 @@ test:
benchmark:
$(GOTEST) -bench=. -run=notests $(ALL_PKGS)

# Not used in CI, tests are split in pkg, tempodb, tempodb-wal and others in CI jobs
.PHONY: test-with-cover
test-with-cover: test-serverless
$(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) $(ALL_PKGS)

# tests in pkg
.PHONY: test-with-cover-pkg
test-with-cover-pkg:
$(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) $(shell go list $(sort $(dir $(shell find . -name '*.go' -path './pkg*/*' -type f | sort))))

# tests in tempodb (excluding tempodb/wal)
.PHONY: test-with-cover-tempodb
test-with-cover-tempodb:
$(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) $(shell go list $(sort $(dir $(shell find . -name '*.go' -not -path './tempodb/wal*/*' -path './tempodb*/*' -type f | sort))))

# tests in tempodb/wal
.PHONY: test-with-cover-tempodb-wal
test-with-cover-tempodb-wal:
$(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) $(shell go list $(sort $(dir $(shell find . -name '*.go' -path './tempodb/wal*/*' -type f | sort))))

# all other tests (excluding pkg & tempodb)
.PHONY: test-with-cover-others
test-with-cover-others: test-serverless
$(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) $(shell go list $(sort $(dir $(OTHERS_SRC))))

# runs e2e tests in the top level integration/e2e directory
.PHONY: test-e2e
test-e2e: docker-tempo
Expand Down

0 comments on commit 25a9cae

Please sign in to comment.