-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch to using Checksum in new SBOM tests
- Loading branch information
Showing
1 changed file
with
53 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,17 +88,17 @@ func testSBOM(t *testing.T, context spec.G, it spec.S) { | |
context("GenerateFromDependency", func() { | ||
it("generates a SBOM from a dependency for latest schema versions", func() { | ||
bom, err := sbom.GenerateFromDependency(postal.Dependency{ | ||
CPE: "cpe:2.3:a:golang:go:1.16.9:*:*:*:*:*:*:*", | ||
ID: "go", | ||
Licenses: []string{"BSD-3-Clause"}, | ||
Name: "Go", | ||
PURL: "pkg:generic/[email protected]?checksum=0a1cc7fd7bd20448f71ebed64d846138850d5099b18cf5cc10a4fc45160d8c3d&download_url=https://dl.google.com/go/go1.16.9.src.tar.gz", | ||
SHA256: "ca9ef23a5db944b116102b87c1ae9344b27e011dae7157d2f1e501abd39e9829", | ||
Source: "https://dl.google.com/go/go1.16.9.src.tar.gz", | ||
SourceSHA256: "0a1cc7fd7bd20448f71ebed64d846138850d5099b18cf5cc10a4fc45160d8c3d", | ||
Stacks: []string{"io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny"}, | ||
URI: "https://deps.paketo.io/go/go_go1.16.9_linux_x64_bionic_ca9ef23a.tgz", | ||
Version: "1.16.9", | ||
CPE: "cpe:2.3:a:golang:go:1.16.9:*:*:*:*:*:*:*", | ||
ID: "go", | ||
Licenses: []string{"BSD-3-Clause"}, | ||
Name: "Go", | ||
PURL: "pkg:generic/[email protected]?checksum=0a1cc7fd7bd20448f71ebed64d846138850d5099b18cf5cc10a4fc45160d8c3d&download_url=https://dl.google.com/go/go1.16.9.src.tar.gz", | ||
Checksum: "sha256:ca9ef23a5db944b116102b87c1ae9344b27e011dae7157d2f1e501abd39e9829", | ||
Source: "https://dl.google.com/go/go1.16.9.src.tar.gz", | ||
SourceChecksum: "sha256:0a1cc7fd7bd20448f71ebed64d846138850d5099b18cf5cc10a4fc45160d8c3d", | ||
Stacks: []string{"io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny"}, | ||
URI: "https://deps.paketo.io/go/go_go1.16.9_linux_x64_bionic_ca9ef23a.tgz", | ||
Version: "1.16.9", | ||
}, "some-path") | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
|
@@ -192,17 +192,17 @@ func testSBOM(t *testing.T, context spec.G, it spec.S) { | |
|
||
it("generates a SBOM from a dependency as syft2 JSON", func() { | ||
bom, err := sbom.GenerateFromDependency(postal.Dependency{ | ||
CPE: "cpe:2.3:a:golang:go:1.16.9:*:*:*:*:*:*:*", | ||
ID: "go", | ||
Licenses: []string{"BSD-3-Clause"}, | ||
Name: "Go", | ||
PURL: "pkg:generic/[email protected]?checksum=0a1cc7fd7bd20448f71ebed64d846138850d5099b18cf5cc10a4fc45160d8c3d&download_url=https://dl.google.com/go/go1.16.9.src.tar.gz", | ||
SHA256: "ca9ef23a5db944b116102b87c1ae9344b27e011dae7157d2f1e501abd39e9829", | ||
Source: "https://dl.google.com/go/go1.16.9.src.tar.gz", | ||
SourceSHA256: "0a1cc7fd7bd20448f71ebed64d846138850d5099b18cf5cc10a4fc45160d8c3d", | ||
Stacks: []string{"io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny"}, | ||
URI: "https://deps.paketo.io/go/go_go1.16.9_linux_x64_bionic_ca9ef23a.tgz", | ||
Version: "1.16.9", | ||
CPE: "cpe:2.3:a:golang:go:1.16.9:*:*:*:*:*:*:*", | ||
ID: "go", | ||
Licenses: []string{"BSD-3-Clause"}, | ||
Name: "Go", | ||
PURL: "pkg:generic/[email protected]?checksum=0a1cc7fd7bd20448f71ebed64d846138850d5099b18cf5cc10a4fc45160d8c3d&download_url=https://dl.google.com/go/go1.16.9.src.tar.gz", | ||
Checksum: "sha256:ca9ef23a5db944b116102b87c1ae9344b27e011dae7157d2f1e501abd39e9829", | ||
Source: "https://dl.google.com/go/go1.16.9.src.tar.gz", | ||
SourceChecksum: "sha256:0a1cc7fd7bd20448f71ebed64d846138850d5099b18cf5cc10a4fc45160d8c3d", | ||
Stacks: []string{"io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny"}, | ||
URI: "https://deps.paketo.io/go/go_go1.16.9_linux_x64_bionic_ca9ef23a.tgz", | ||
Version: "1.16.9", | ||
}, "some-path") | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
|
@@ -238,17 +238,17 @@ func testSBOM(t *testing.T, context spec.G, it spec.S) { | |
|
||
it("generates a SBOM from a dependency in CycloneDX 1.4 JSON", func() { | ||
bom, err := sbom.GenerateFromDependency(postal.Dependency{ | ||
CPE: "cpe:2.3:a:golang:go:1.16.9:*:*:*:*:*:*:*", | ||
ID: "go", | ||
Licenses: []string{"BSD-3-Clause"}, | ||
Name: "Go", | ||
PURL: "pkg:generic/[email protected]?checksum=0a1cc7fd7bd20448f71ebed64d846138850d5099b18cf5cc10a4fc45160d8c3d&download_url=https://dl.google.com/go/go1.16.9.src.tar.gz", | ||
SHA256: "ca9ef23a5db944b116102b87c1ae9344b27e011dae7157d2f1e501abd39e9829", | ||
Source: "https://dl.google.com/go/go1.16.9.src.tar.gz", | ||
SourceSHA256: "0a1cc7fd7bd20448f71ebed64d846138850d5099b18cf5cc10a4fc45160d8c3d", | ||
Stacks: []string{"io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny"}, | ||
URI: "https://deps.paketo.io/go/go_go1.16.9_linux_x64_bionic_ca9ef23a.tgz", | ||
Version: "1.16.9", | ||
CPE: "cpe:2.3:a:golang:go:1.16.9:*:*:*:*:*:*:*", | ||
ID: "go", | ||
Licenses: []string{"BSD-3-Clause"}, | ||
Name: "Go", | ||
PURL: "pkg:generic/[email protected]?checksum=0a1cc7fd7bd20448f71ebed64d846138850d5099b18cf5cc10a4fc45160d8c3d&download_url=https://dl.google.com/go/go1.16.9.src.tar.gz", | ||
Checksum: "sha256:ca9ef23a5db944b116102b87c1ae9344b27e011dae7157d2f1e501abd39e9829", | ||
Source: "https://dl.google.com/go/go1.16.9.src.tar.gz", | ||
SourceChecksum: "sha256:0a1cc7fd7bd20448f71ebed64d846138850d5099b18cf5cc10a4fc45160d8c3d", | ||
Stacks: []string{"io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny"}, | ||
URI: "https://deps.paketo.io/go/go_go1.16.9_linux_x64_bionic_ca9ef23a.tgz", | ||
Version: "1.16.9", | ||
}, "some-path") | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
|
@@ -287,15 +287,15 @@ func testSBOM(t *testing.T, context spec.G, it spec.S) { | |
context("when the input dependency does not have a CPE or a PURL", func() { | ||
it("succeeds in generating an SBOM without CPEs", func() { | ||
bom, err := sbom.GenerateFromDependency(postal.Dependency{ | ||
ID: "go", | ||
Licenses: []string{"BSD-3-Clause"}, | ||
Name: "Go", | ||
SHA256: "ca9ef23a5db944b116102b87c1ae9344b27e011dae7157d2f1e501abd39e9829", | ||
Source: "https://dl.google.com/go/go1.16.9.src.tar.gz", | ||
SourceSHA256: "0a1cc7fd7bd20448f71ebed64d846138850d5099b18cf5cc10a4fc45160d8c3d", | ||
Stacks: []string{"io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny"}, | ||
URI: "https://deps.paketo.io/go/go_go1.16.9_linux_x64_bionic_ca9ef23a.tgz", | ||
Version: "1.16.9", | ||
ID: "go", | ||
Licenses: []string{"BSD-3-Clause"}, | ||
Name: "Go", | ||
Checksum: "sha256:ca9ef23a5db944b116102b87c1ae9344b27e011dae7157d2f1e501abd39e9829", | ||
Source: "https://dl.google.com/go/go1.16.9.src.tar.gz", | ||
SourceChecksum: "sha256:0a1cc7fd7bd20448f71ebed64d846138850d5099b18cf5cc10a4fc45160d8c3d", | ||
Stacks: []string{"io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny"}, | ||
URI: "https://deps.paketo.io/go/go_go1.16.9_linux_x64_bionic_ca9ef23a.tgz", | ||
Version: "1.16.9", | ||
}, "some-path") | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
|
@@ -382,17 +382,17 @@ func testSBOM(t *testing.T, context spec.G, it spec.S) { | |
context("when the input dependency has CPEs and CPE", func() { | ||
it("uses CPEs, not CPE", func() { | ||
bom, err := sbom.GenerateFromDependency(postal.Dependency{ | ||
CPE: "cpe:2.3:a:golang:go:1.16.9:*:*:*:*:*:*:*", | ||
CPEs: []string{"cpe:2.3:a:some:other:cpe:*:*:*:*:*:*:*", "cpe:2.3:a:another:cpe:to:include:*:*:*:*:*:*"}, | ||
ID: "go", | ||
Licenses: []string{"BSD-3-Clause"}, | ||
Name: "Go", | ||
SHA256: "ca9ef23a5db944b116102b87c1ae9344b27e011dae7157d2f1e501abd39e9829", | ||
Source: "https://dl.google.com/go/go1.16.9.src.tar.gz", | ||
SourceSHA256: "0a1cc7fd7bd20448f71ebed64d846138850d5099b18cf5cc10a4fc45160d8c3d", | ||
Stacks: []string{"io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny"}, | ||
URI: "https://deps.paketo.io/go/go_go1.16.9_linux_x64_bionic_ca9ef23a.tgz", | ||
Version: "1.16.9", | ||
CPE: "cpe:2.3:a:golang:go:1.16.9:*:*:*:*:*:*:*", | ||
CPEs: []string{"cpe:2.3:a:some:other:cpe:*:*:*:*:*:*:*", "cpe:2.3:a:another:cpe:to:include:*:*:*:*:*:*"}, | ||
ID: "go", | ||
Licenses: []string{"BSD-3-Clause"}, | ||
Name: "Go", | ||
Checksum: "sha256:ca9ef23a5db944b116102b87c1ae9344b27e011dae7157d2f1e501abd39e9829", | ||
Source: "https://dl.google.com/go/go1.16.9.src.tar.gz", | ||
SourceChecksum: "sha256:0a1cc7fd7bd20448f71ebed64d846138850d5099b18cf5cc10a4fc45160d8c3d", | ||
Stacks: []string{"io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny"}, | ||
URI: "https://deps.paketo.io/go/go_go1.16.9_linux_x64_bionic_ca9ef23a.tgz", | ||
Version: "1.16.9", | ||
}, "some-path") | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
|