Skip to content

Commit

Permalink
remove hardcoded bp name from test
Browse files Browse the repository at this point in the history
and add missing directory cleanup
  • Loading branch information
Frankie Gallina-Jones authored and ForestEckhardt committed Mar 4, 2022
1 parent f6eab20 commit e2ca5f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
11 changes: 4 additions & 7 deletions integration/default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func testDefault(t *testing.T, context spec.G, it spec.S) {
Expect(docker.Volume.Remove.Execute(occam.CacheVolumeNames(name))).To(Succeed())
Expect(docker.Image.Remove.Execute(image.ID)).To(Succeed())
Expect(os.RemoveAll(source)).To(Succeed())
Expect(os.RemoveAll(sbomDir)).To(Succeed())
})

it("builds successfully", func() {
Expand Down Expand Up @@ -114,15 +115,11 @@ func testDefault(t *testing.T, context spec.G, it spec.S) {
Expect(filepath.Join(sbomDir, "sbom", "launch", strings.ReplaceAll(settings.Buildpack.ID, "/", "_"), "targets", "sbom.syft.json")).To(BeARegularFile())

// check an SBOM file to make sure it is generated for the right directory
contents, err := os.ReadFile(filepath.Join(sbomDir, "sbom", "launch", strings.ReplaceAll(settings.Buildpack.ID, "/", "_"), "targets", "sbom.cdx.json"))
contents, err := os.ReadFile(filepath.Join(sbomDir, "sbom", "launch", strings.ReplaceAll(settings.Buildpack.ID, "/", "_"), "targets", "sbom.syft.json"))
Expect(err).NotTo(HaveOccurred())
Expect(string(contents)).To(ContainLines(
` "component": {`,
` "bom-ref": "8f840e865ce168d",`,
` "type": "file",`,
` "name": "/layers/paketo-buildpacks_go-build/targets/bin",`,
` "version": ""`,
` }`,
` "type": "directory",`,
fmt.Sprintf(` "target": "/layers/%s/targets/bin"`, strings.ReplaceAll(settings.Buildpack.ID, "/", "_")),
))
})
})
Expand Down
1 change: 1 addition & 0 deletions integration/targets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func testTargets(t *testing.T, context spec.G, it spec.S) {
Expect(docker.Volume.Remove.Execute(occam.CacheVolumeNames(name))).To(Succeed())
Expect(docker.Image.Remove.Execute(image.ID)).To(Succeed())
Expect(os.RemoveAll(source)).To(Succeed())
Expect(os.RemoveAll(sbomDir)).To(Succeed())
})

it("builds successfully and includes SBOM with modules for built binaries", func() {
Expand Down

0 comments on commit e2ca5f2

Please sign in to comment.