mirror of
https://github.com/ossf/scorecard.git
synced 2024-10-26 10:28:10 +03:00
🌱 Tests: Fix data race failures (#2262)
* Fix data race failures in tests Signed-off-by: Raghav Kaul <raghavkaul@google.com> * Keep coverprofiles for the attestor separate Signed-off-by: Raghav Kaul <raghavkaul@google.com> Signed-off-by: Raghav Kaul <raghavkaul@google.com>
This commit is contained in:
parent
2231d1f722
commit
482a59ec9b
2
.gitignore
vendored
2
.gitignore
vendored
@ -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
|
||||
|
||||
|
||||
|
6
Makefile
6
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 ./...
|
||||
###############################################################################
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user