Skip to content

Commit

Permalink
Remove integration test in favor of unit test that excerises the same…
Browse files Browse the repository at this point in the history
… code path
  • Loading branch information
ForestEckhardt committed Sep 10, 2024
1 parent a2b2010 commit bee9c4b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 96 deletions.
24 changes: 22 additions & 2 deletions build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ func testBuild(t *testing.T, context spec.G, it spec.S) {
err = os.MkdirAll(filepath.Join(layersDir, "mod-cache"), os.ModePerm)
Expect(err).NotTo(HaveOccurred())

_, err = os.CreateTemp(filepath.Join(layersDir, "mod-cache"), "example")
Expect(err).NotTo(HaveOccurred())
Expect(os.WriteFile(filepath.Join(filepath.Join(layersDir, "mod-cache"), "cache"), nil, os.ModePerm))

now := time.Now()
clock = chronos.NewClock(func() time.Time {
Expand Down Expand Up @@ -177,6 +176,27 @@ func testBuild(t *testing.T, context spec.G, it spec.S) {
})
})

context("when the mod cache layer is empty", func() {
it.Before(func() {
err := os.RemoveAll(filepath.Join(layersDir, "mod-cache", "cache"))
Expect(err).NotTo(HaveOccurred())
})

it("does not include the module cache layer in the build result", func() {
result, err := build(packit.BuildContext{
Layers: packit.Layers{Path: layersDir},
WorkingDir: workingDir,
BuildpackInfo: packit.BuildpackInfo{
Name: "Some Buildpack",
Version: "some-version",
},
})
Expect(err).NotTo(HaveOccurred())

Expect(result.Layers).To(BeEmpty())
})
})

context("failure cases", func() {
context("build process fails to check if it should run", func() {
it.Before(func() {
Expand Down
79 changes: 0 additions & 79 deletions integration/empty_cache_test.go

This file was deleted.

1 change: 0 additions & 1 deletion integration/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ func TestIntegration(t *testing.T) {

suite := spec.New("Integration", spec.Report(report.Terminal{}), spec.Parallel())
suite("Default", testDefault)
suite("EmptyCache", testEmptyCache)
suite("Vendored", testVendored)
suite.Run(t)
}
3 changes: 0 additions & 3 deletions integration/testdata/no_modules/go.mod

This file was deleted.

11 changes: 0 additions & 11 deletions integration/testdata/no_modules/main.go

This file was deleted.

0 comments on commit bee9c4b

Please sign in to comment.