Skip to content

Commit

Permalink
test: use local logger instance in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcombuechen committed Mar 4, 2024
1 parent 6bf7ae4 commit 2cc7b35
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/ecosystems/enrich_cyclonedx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import (
"github.com/snyk/parlay/lib/sbom"
)

var logger = zerolog.Nop()

func TestEnrichSBOM_CycloneDX(t *testing.T) {
httpmock.Activate()
defer httpmock.DeactivateAndReset()
Expand Down Expand Up @@ -67,6 +65,7 @@ func TestEnrichSBOM_CycloneDX(t *testing.T) {
},
}
doc := &sbom.SBOMDocument{BOM: bom}
logger := zerolog.Nop()

EnrichSBOM(doc, &logger)

Expand Down Expand Up @@ -114,6 +113,7 @@ func TestEnrichSBOM_CycloneDX_NestedComps(t *testing.T) {
},
}
doc := &sbom.SBOMDocument{BOM: bom}
logger := zerolog.Nop()

EnrichSBOM(doc, &logger)

Expand Down Expand Up @@ -146,6 +146,7 @@ func TestEnrichSBOMWithoutLicense(t *testing.T) {
},
}
doc := &sbom.SBOMDocument{BOM: bom}
logger := zerolog.Nop()

EnrichSBOM(doc, &logger)

Expand Down Expand Up @@ -191,6 +192,7 @@ func TestEnrichLicense(t *testing.T) {
func TestEnrichBlankSBOM(t *testing.T) {
bom := new(cdx.BOM)
doc := &sbom.SBOMDocument{BOM: bom}
logger := zerolog.Nop()

EnrichSBOM(doc, &logger)

Expand Down
2 changes: 2 additions & 0 deletions lib/ecosystems/enrich_spdx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"testing"

"github.com/jarcoal/httpmock"
"github.com/rs/zerolog"
"github.com/spdx/tools-golang/spdx/v2/common"
"github.com/spdx/tools-golang/spdx/v2/v2_3"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -60,6 +61,7 @@ func TestEnrichSBOM_SPDX(t *testing.T) {
},
}
doc := &sbom.SBOMDocument{BOM: bom}
logger := zerolog.Nop()

EnrichSBOM(doc, &logger)

Expand Down
6 changes: 4 additions & 2 deletions lib/snyk/enrich_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import (
"github.com/snyk/parlay/lib/sbom"
)

var logger = zerolog.Nop()

func TestEnrichSBOM_CycloneDXWithVulnerabilities(t *testing.T) {
teardown := setupTestEnv(t)
defer teardown()
Expand All @@ -30,6 +28,7 @@ func TestEnrichSBOM_CycloneDXWithVulnerabilities(t *testing.T) {
},
}
doc := &sbom.SBOMDocument{BOM: bom}
logger := zerolog.Nop()

EnrichSBOM(doc, &logger)

Expand Down Expand Up @@ -63,6 +62,7 @@ func TestEnrichSBOM_CycloneDXWithVulnerabilities_NestedComponents(t *testing.T)
},
}
doc := &sbom.SBOMDocument{BOM: bom}
logger := zerolog.Nop()

EnrichSBOM(doc, &logger)

Expand All @@ -85,6 +85,7 @@ func TestEnrichSBOM_CycloneDXWithoutVulnerabilities(t *testing.T) {
},
}
doc := &sbom.SBOMDocument{BOM: bom}
logger := zerolog.Nop()

EnrichSBOM(doc, &logger)

Expand Down Expand Up @@ -112,6 +113,7 @@ func TestEnrichSBOM_SPDXWithVulnerabilities(t *testing.T) {
},
}
doc := &sbom.SBOMDocument{BOM: bom}
logger := zerolog.Nop()

EnrichSBOM(doc, &logger)

Expand Down

0 comments on commit 2cc7b35

Please sign in to comment.