Skip to content

Commit

Permalink
switch to using Checksum in new SBOM tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sophie Wigmore authored and ryanmoran committed Sep 20, 2022
1 parent b5e27ef commit bc31d56
Showing 1 changed file with 53 additions and 53 deletions.
106 changes: 53 additions & 53 deletions sbom/sbom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down Expand Up @@ -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())

Expand Down Expand Up @@ -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())

Expand Down Expand Up @@ -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())

Expand Down Expand Up @@ -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())

Expand Down

0 comments on commit bc31d56

Please sign in to comment.