Skip to content

Commit 5ef5208

Browse files
committed
Revert to using cf logs for app output check
For tests that expect the app to fail, using app.Stdout.String() doesn't have the desired effect. To get the full logs, use 'cf logs --recent'.
1 parent 6b20a06 commit 5ef5208

2 files changed

Lines changed: 18 additions & 12 deletions

File tree

src/python/integration/deploy_a_python_app_test.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package integration_test
22

33
import (
4+
"os/exec"
45
"path/filepath"
56
"regexp"
67
"strconv"
7-
"time"
88

99
"github.com/blang/semver"
1010
"github.com/cloudfoundry/libbuildpack"
@@ -37,11 +37,14 @@ var _ = Describe("CF Python Buildpack", func() {
3737
It("displays a nice error messages and gracefully fails", func() {
3838
Expect(app.Push()).ToNot(Succeed())
3939

40-
Eventually(app.Stdout.String(), 60*time.Second).Should(ContainSubstring("-----> Python Buildpack version"))
41-
Expect(app.ConfirmBuildpack(buildpackVersion)).To(Succeed())
40+
logs := exec.Command("cf", "logs", "--recent", app.Name)
41+
out, err := logs.CombinedOutput()
42+
Expect(err).ToNot(HaveOccurred())
43+
44+
Expect(out).To(ContainSubstring("-----> Python Buildpack version " + buildpackVersion))
4245

43-
Eventually(app.Stdout.String()).Should(ContainSubstring("Could not install python: no match found for 99.99.99"))
44-
Eventually(app.Stdout.String()).ShouldNot(ContainSubstring("-----> Installing python"))
46+
Expect(out).To(ContainSubstring("Could not install python: no match found for 99.99.99"))
47+
Expect(out).ToNot(ContainSubstring("-----> Installing python"))
4548
})
4649
})
4750

src/python/integration/override_yml_test.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package integration_test
22

33
import (
4-
"time"
4+
"os/exec"
55

66
"github.com/cloudfoundry/libbuildpack/cutlass"
77

@@ -43,12 +43,15 @@ var _ = Describe("override yml", func() {
4343
It("Forces python from override buildpack", func() {
4444
Expect(app.Push()).ToNot(Succeed())
4545

46-
Eventually(app.Stdout.String(), 60*time.Second).Should(ContainSubstring("-----> OverrideYML Buildpack"))
47-
Eventually(app.Stdout.String(), 60*time.Second).Should(ContainSubstring("-----> Python Buildpack version"))
48-
Expect(app.ConfirmBuildpack(buildpackVersion)).To(Succeed())
46+
logs := exec.Command("cf", "logs", "--recent", app.Name)
47+
out, err := logs.CombinedOutput()
48+
Expect(err).ToNot(HaveOccurred())
4949

50-
Eventually(app.Stdout.String()).Should(ContainSubstring("-----> Installing python"))
51-
Eventually(app.Stdout.String()).Should(MatchRegexp("Copy .*/python.tgz"))
52-
Eventually(app.Stdout.String()).Should(ContainSubstring("Could not install python: dependency sha256 mismatch: expected sha256 062d906c87839d03b243e2821e10653c89b4c92878bfe2bf995dec231e117bfc, actual sha256 b56b58ac21f9f42d032e1e4b8bf8b8823e69af5411caa15aee2b140bc756962f"))
50+
Expect(out).To(ContainSubstring("-----> OverrideYML Buildpack"))
51+
Expect(out).To(ContainSubstring("-----> Python Buildpack version "+buildpackVersion))
52+
53+
Expect(out).To(ContainSubstring("-----> Installing python"))
54+
Expect(out).To(MatchRegexp("Copy .*/python.tgz"))
55+
Expect(out).To(ContainSubstring("Could not install python: dependency sha256 mismatch: expected sha256 062d906c87839d03b243e2821e10653c89b4c92878bfe2bf995dec231e117bfc, actual sha256 b56b58ac21f9f42d032e1e4b8bf8b8823e69af5411caa15aee2b140bc756962f"))
5356
})
5457
})

0 commit comments

Comments
 (0)