diff --git a/integration/init_test.go b/integration/init_test.go index 341af7b..ffd83eb 100644 --- a/integration/init_test.go +++ b/integration/init_test.go @@ -25,13 +25,13 @@ func TestIntegration(t *testing.T) { Expect := NewWithT(t).Expect root, err := dagger.FindBPRoot() - Expect(err).ToNot(HaveOccurred()) + Expect(err).NotTo(HaveOccurred()) buildpack, err = dagger.PackageBuildpack(root) Expect(err).NotTo(HaveOccurred()) nginxBuildpack, err = dagger.GetLatestCommunityBuildpack("paketo-buildpacks", "nginx") - Expect(err).ToNot(HaveOccurred()) + Expect(err).NotTo(HaveOccurred()) // HACK: we need to fix dagger and the package.sh scripts so that this isn't required buildpack = fmt.Sprintf("%s.tgz", buildpack) @@ -43,9 +43,9 @@ func TestIntegration(t *testing.T) { SetDefaultEventuallyTimeout(5 * time.Second) - suite := spec.New("Integration", spec.Report(report.Terminal{})) - suite("Nginx", testNginx, spec.Parallel()) - suite("Logging", testLogging, spec.Parallel()) + suite := spec.New("Integration", spec.Report(report.Terminal{}), spec.Parallel()) + suite("Nginx", testNginx) + suite("Logging", testLogging) suite.Run(t) } diff --git a/integration/logging_test.go b/integration/logging_test.go index 3ce6b22..2d732b8 100644 --- a/integration/logging_test.go +++ b/integration/logging_test.go @@ -2,6 +2,7 @@ package integration import ( "fmt" + "os" "path/filepath" "testing" @@ -27,7 +28,9 @@ func testLogging(t *testing.T, when spec.G, it spec.S) { when("when the buildpack is run with pack build", func() { var ( image occam.Image - name string + + name string + source string ) it.Before(func() { @@ -39,19 +42,23 @@ func testLogging(t *testing.T, when spec.G, it spec.S) { it.After(func() { Expect(docker.Image.Remove.Execute(image.ID)).To(Succeed()) Expect(docker.Volume.Remove.Execute(occam.CacheVolumeNames(name))).To(Succeed()) + Expect(os.RemoveAll(source)).To(Succeed()) }) it("logs useful information for the user", func() { var err error + source, err = occam.Source(filepath.Join("testdata", "nginx_helloworld")) + Expect(err).NotTo(HaveOccurred()) + var logs fmt.Stringer image, logs, err = pack.WithNoColor().Build. WithNoPull(). WithBuildpacks(nginxBuildpack, buildpack). - Execute(name, filepath.Join("testdata", "nginx_helloworld")) - Expect(err).ToNot(HaveOccurred(), logs.String) + Execute(name, source) + Expect(err).NotTo(HaveOccurred(), logs.String) buildpackVersion, err := GetGitVersion() - Expect(err).ToNot(HaveOccurred()) + Expect(err).NotTo(HaveOccurred()) Expect(logs).To(ContainLines( fmt.Sprintf("Staticfile Buildpack %s", buildpackVersion), diff --git a/integration/nginx_test.go b/integration/nginx_test.go index 0a92b86..1d3245d 100644 --- a/integration/nginx_test.go +++ b/integration/nginx_test.go @@ -4,6 +4,7 @@ import ( "fmt" "io/ioutil" "net/http" + "os" "path/filepath" "testing" @@ -32,7 +33,9 @@ func testNginx(t *testing.T, context spec.G, it spec.S) { var ( image occam.Image container occam.Container - name string + + name string + source string ) it.Before(func() { @@ -45,16 +48,20 @@ func testNginx(t *testing.T, context spec.G, it spec.S) { Expect(docker.Container.Remove.Execute(container.ID)).To(Succeed()) Expect(docker.Image.Remove.Execute(image.ID)).To(Succeed()) Expect(docker.Volume.Remove.Execute(occam.CacheVolumeNames(name))).To(Succeed()) + Expect(os.RemoveAll(source)).To(Succeed()) }) it("creates nginx.conf file", func() { var err error + source, err = occam.Source(filepath.Join("testdata", "nginx_helloworld")) + Expect(err).NotTo(HaveOccurred()) + var logs fmt.Stringer image, logs, err = pack.WithNoColor().Build. WithNoPull(). WithBuildpacks(nginxBuildpack, buildpack). - Execute(name, filepath.Join("testdata", "nginx_helloworld")) - Expect(err).ToNot(HaveOccurred(), logs.String) + Execute(name, source) + Expect(err).NotTo(HaveOccurred(), logs.String) container, err = docker.Container.Run.Execute(image.ID) Expect(err).NotTo(HaveOccurred()) @@ -64,13 +71,13 @@ func testNginx(t *testing.T, context spec.G, it spec.S) { response, err := http.Get(fmt.Sprintf("http://localhost:%s", container.HostPort())) Expect(err).NotTo(HaveOccurred()) defer response.Body.Close() + Expect(response.StatusCode).To(Equal(http.StatusOK)) content, err := ioutil.ReadAll(response.Body) Expect(err).NotTo(HaveOccurred()) Expect(string(content)).To(ContainSubstring("helloworld")) - }) }) }