test: move all ginkgo opts to Makefile

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
Steffen Vogel
2022-08-25 23:37:47 +02:00
parent 1c197802ec
commit 0a61f41700
2 changed files with 13 additions and 11 deletions

View File

@@ -135,11 +135,11 @@ jobs:
- name: Run tests
if: ${{ matrix.target_arch == matrix.host_arch && matrix.target_os == matrix.host_os }}
run: make tests GINKGO_EXTRA_OPTS=--procs=2 GINKGO_PKG=./pkg/...
run: make tests
- name: Run tests requiring root privileges
- name: Run integration tests
if: ${{ matrix.target_arch == matrix.host_arch && matrix.target_os == matrix.host_os && matrix.host_os == 'linux' }}
run: sudo --preserve-env env "PATH=$PATH" make tests GINKGO_PKG=./test/...
run: sudo --preserve-env env "PATH=$PATH" make tests-integration
- name: Upload logs an packet captures as artifacts
if: ${{ always() && matrix.target_arch == matrix.host_arch && matrix.target_os == matrix.host_os && matrix.host_os == 'linux' }}

View File

@@ -14,19 +14,16 @@ ifeq ($(GOOS),linux)
PKGS += ./test/...
endif
GINKGO_PKG ?= ./...
GINKGO_OPTS += --compilers=2 \
GINKGO_OPTS = --compilers=2 \
--keep-going \
--timeout=15m \
--trace \
--cover \
--coverpkg=./... \
--coverprofile=coverprofile.out \
--keep-separate-coverprofiles \
--output-dir=./test/logs \
--randomize-all \
--randomize-suites \
$(GINKGO_EXTRA_OPTS) $(GINKGO_PKG) -- $(GINKGO_TEST_OPTS)
$(GINKGO_EXTRA_OPTS)
all: wice
@@ -35,12 +32,16 @@ wice:
go build -o $@ -ldflags="$(LDFLAGS)" ./cmd/wice
tests:
ginkgo run $(GINKGO_OPTS)
ginkgo run $(GINKGO_OPTS) --procs=2 --coverprofile=coverprofile.out ./pkg/...
tests-integration:
mkdir -p test/logs
ginkgo run $(GINKGO_OPTS) --output-dir=./test/logs --coverprofile=coverprofile_integration.out ./test
coverprofile_merged.out: $(shell find . -name "*.out" -type f)
gocov-merger -o $@ $^
lcov_merged.info: coverprofile_merged.out
lcov.info: coverprofile_merged.out
gcov2lcov > $@ < $^
coverage: lcov.info
@@ -65,6 +66,7 @@ install-deps:
go install github.com/jandelgado/gcov2lcov@latest
clean:
rm -f *.out wice lcov.info
find . -name "*.out" -exec rm {} \;
rm -rf wice lcov.info test/logs/
.PHONY: all wice tests tests-watch coverage clean vet staticcheck install-deps