diff --git a/.github/workflows/spinifex.yml b/.github/workflows/spinifex.yml index fc928bafa..36e80be44 100644 --- a/.github/workflows/spinifex.yml +++ b/.github/workflows/spinifex.yml @@ -123,7 +123,7 @@ jobs: env: SPINIFEX_REQUIRE_CONFORMANCE_TOOLS: "1" VIPERBLOCK_NBDKIT_PLUGIN: ${{ github.workspace }}/viperblock/lib/nbdkit-viperblock-plugin.so - run: make -C spinifex test-cover + run: make -C spinifex test-cover GOTESTFLAGS=-count=1 - name: Run Action Tests run: make -C spinifex test-actions @@ -295,7 +295,7 @@ jobs: run: go work init ./spinifex ./viperblock ./predastore ./northstar ./bluebottle - name: Run Tests with Race Detector - run: make -C spinifex test-race + run: make -C spinifex test-race GOTESTFLAGS=-count=1 lint_and_security: name: Lint and Security diff --git a/Makefile b/Makefile index af392b77a..edfc1f79a 100644 --- a/Makefile +++ b/Makefile @@ -222,17 +222,22 @@ test: @echo -e "\n....Running tests for $(GO_PROJECT_NAME)...." LOG_IGNORE=1 go test -timeout 180s ./spinifex/... ./cmd/... ./internal/... +# Empty locally, where reusing a cached result between runs is the point. +# CI passes -count=1 so a green run means the suite executed against that commit +# rather than replaying results the persisted build cache carried over. +GOTESTFLAGS ?= + # Run unit tests with coverage profile COVERPROFILE ?= coverage.out test-cover: @echo -e "\n....Running tests with coverage for $(GO_PROJECT_NAME)...." - $(_Q)LOG_IGNORE=1 go test -timeout 180s -coverprofile=$(COVERPROFILE) -covermode=atomic ./spinifex/... ./cmd/... ./internal/... $(_COVQ) + $(_Q)LOG_IGNORE=1 go test $(GOTESTFLAGS) -timeout 180s -coverprofile=$(COVERPROFILE) -covermode=atomic ./spinifex/... ./cmd/... ./internal/... $(_COVQ) @scripts/check-coverage.sh $(COVERPROFILE) $(QUIET) # Run unit tests with race detector test-race: @echo -e "\n....Running tests with race detector for $(GO_PROJECT_NAME)...." - $(_Q)LOG_IGNORE=1 go test -race -timeout 300s ./spinifex/... ./cmd/... ./internal/... $(_RACEQ) + $(_Q)LOG_IGNORE=1 go test $(GOTESTFLAGS) -race -timeout 300s ./spinifex/... ./cmd/... ./internal/... $(_RACEQ) # Unit tests for in-repo GitHub Actions (e.g. .github/actions/e2e-analyze). # Kept out of `test-cover` so coverage % isn't diluted by CI-only tooling.