diff --git a/.gitignore b/.gitignore index eda72798274..1a8a5cc989e 100644 --- a/.gitignore +++ b/.gitignore @@ -26,7 +26,7 @@ results.json # Output of the go coverage tool, specifically when used with LiteIDE. *.coverprofile* -unit-coverage.out +**/unit-coverage.out e2e-coverage.out diff --git a/Makefile b/Makefile index 02fb2528ca9..c979047641a 100644 --- a/Makefile +++ b/Makefile @@ -288,7 +288,7 @@ unit-test: ## Runs unit test without e2e SKIP_GINKGO=1 go test -race -covermode=atomic -coverprofile=unit-coverage.out `go list ./...` unit-test-attestor: ## Runs unit tests on scorecard-attestor - cd attestor; SKIP_GINKGO=1 go test -covermode=atomic -coverprofile=unit-coverage-attestor.out `go list ./...`; cd ..; + cd attestor; SKIP_GINKGO=1 go test -covermode=atomic -coverprofile=unit-coverage.out `go list ./...`; cd ..; $(GINKGO): install @@ -300,10 +300,10 @@ endif e2e-pat: ## Runs e2e tests. Requires GITHUB_AUTH_TOKEN env var to be set to GitHub personal access token e2e-pat: build-scorecard check-env | $(GINKGO) # Run e2e tests. GITHUB_AUTH_TOKEN with personal access token must be exported to run this - TOKEN_TYPE="PAT" $(GINKGO) --race -p -v -cover -coverprofile=e2e-coverage.out ./... + TOKEN_TYPE="PAT" $(GINKGO) --race -p -v -cover -coverprofile=e2e-coverage.out --keep-separate-coverprofiles ./... e2e-gh-token: ## Runs e2e tests. Requires GITHUB_AUTH_TOKEN env var to be set to default GITHUB_TOKEN e2e-gh-token: build-scorecard check-env | $(GINKGO) # Run e2e tests. GITHUB_AUTH_TOKEN set to secrets.GITHUB_TOKEN must be used to run this. - TOKEN_TYPE="GITHUB_TOKEN" $(GINKGO) --race -p -v -cover -coverprofile=e2e-coverage.out ./... + TOKEN_TYPE="GITHUB_TOKEN" $(GINKGO) --race -p -v -cover -coverprofile=e2e-coverage.out --keep-separate-coverprofiles ./... ############################################################################### diff --git a/attestor/attestation_policy_test.go b/attestor/attestation_policy_test.go index 3f6e0d3ff46..598b59e3dce 100644 --- a/attestor/attestation_policy_test.go +++ b/attestor/attestation_policy_test.go @@ -36,8 +36,6 @@ func (a AttestationPolicy) ToJSON() string { func TestCheckPreventBinaryArtifacts(t *testing.T) { t.Parallel() - dl := scut.TestDetailLogger{} - tests := []struct { name string raw *checker.RawResults @@ -107,6 +105,7 @@ func TestCheckPreventBinaryArtifacts(t *testing.T) { tt := &tests[i] t.Run(tt.name, func(t *testing.T) { t.Parallel() + dl := scut.TestDetailLogger{} actual, err := CheckPreventBinaryArtifacts(tt.allowedBinaryArtifacts, tt.raw, &dl) if !errors.Is(err, tt.err) {