Skip to content

Commit 4450d29

Browse files
committed
ref(releases_test.go): use gexec
instead of execute
1 parent aaa7a15 commit 4450d29

1 file changed

Lines changed: 26 additions & 24 deletions

File tree

_tests/releases_test.go

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,56 @@ package _tests_test
33
import (
44
. "github.com/onsi/ginkgo"
55
. "github.com/onsi/gomega"
6+
"github.com/onsi/gomega/gbytes"
7+
"github.com/onsi/gomega/gexec"
68
)
79

810
var _ = Describe("Releases", func() {
911
appName := getRandAppName()
1012
Context("with no app", func() {
1113
It("can create an app", func() {
12-
output, err := execute("deis apps:create %s --no-remote", appName)
14+
sess, err := start("deis apps: create %s --no-remote", appName)
1315
Expect(err).To(BeNil())
14-
Expect(output).Should(HavePrefix("Creating Application... done, created %s", appName))
16+
Eventually(sess).Should(gexec.Exit(0))
17+
Eventually(sess).Should(gbytes.Say("Creating Application... done, created %s", appName))
1518
})
1619
It("can deploy the app", func() {
17-
output, err := execute("deis pull deis/example-go -a %s", appName)
20+
sess, err := start("deis pull deis/example-go -a %s", appName)
1821
Expect(err).To(BeNil())
19-
Expect(output).To(ContainSubstring("Creating build... done"))
22+
Eventually(sess).Should(gexec.Exit(0))
23+
Eventually(sess).Should(gbytes.Say("Creating build... done"))
2024
})
2125
})
2226

2327
Context("with a deployed app", func() {
2428
It("can list releases", func() {
25-
output, err := execute("deis releases:list -a %s", appName)
29+
sess, err := start("deis releases:list -a %s", appName)
2630
Expect(err).To(BeNil())
27-
Expect(output).To(SatisfyAll(
28-
HavePrefix("=== %s Releases", appName),
29-
MatchRegexp(`v1\t.*\t%s created initial release`, testUser),
30-
MatchRegexp(`v2\t.*\t%s deployed \w+`, testUser)),
31-
)
31+
Eventually(sess).Should(gexec.Exit(0))
32+
Eventually(sess).Should(gbytes.Say("=== %s Releases", appName))
33+
Eventually(sess).Should(gbytes.Say(`v1\t.*\t%s created initial release`, testUser))
34+
Eventually(sess).Should(gbytes.Say(`v2\t.*\t%s deployed \w+`, testUser))
3235
})
3336

3437
It("can rollback to a previous release", func() {
35-
output, err := execute("deis releases:rollback v1 -a %s", appName)
38+
sess, err := start("deis releases:rollback v1 -a %s", appName)
3639
Expect(err).To(BeNil())
37-
Expect(output).To(SatisfyAll(
38-
HavePrefix("Rolling back to"),
39-
ContainSubstring("...done"),
40-
))
40+
Eventually(sess).Should(gexec.Exit(0))
41+
Eventually(sess).Should(gbytes.Say("Rolling back to"))
42+
Eventually(sess).Should(gbytes.Say("...done"))
4143
})
4244

4345
It("can get info on releases", func() {
44-
output, err := execute("deis releases:info v1 -a %s", appName)
46+
sess, err := start("deis releases:info v1 -a %s", appName)
4547
Expect(err).To(BeNil())
46-
Expect(output).To(SatisfyAll(
47-
HavePrefix("=== %s Release v1", appName),
48-
MatchRegexp(`config:\s+[\w-]+`),
49-
MatchRegexp(`owner:\s+%s`, testUser),
50-
MatchRegexp(`summary:\s+%s \w+`, testUser),
51-
// the below updated date has to match a string like 2015-12-22T21:20:31UTC
52-
MatchRegexp(`updated:\s+[0-9]+-[0-9]+-[A-Z0-9]+:[0-9]+:[A-Z0-9:-]+`, appName),
53-
MatchRegexp(`uuid:\s+[\w-]+`)))
48+
Eventually(sess).Should(gexec.Exit(0))
49+
Eventually(sess).Should(gbytes.Say("=== %s Release v1", appName))
50+
Eventually(sess).Should(gbytes.Say(`config:\s+[\w-]+`))
51+
Eventually(sess).Should(gbytes.Say(`owner:\s+%s`, testUser))
52+
Eventually(sess).Should(gbytes.Say(`summary:\s+%s \w+`, testUser))
53+
// the below updated date has to match a string like 2015-12-22T21:20:31UTC
54+
Eventually(sess).Should(gbytes.Say(`updated:\s+[0-9]+-[0-9]+-[A-Z0-9]+:[0-9]+:[A-Z0-9:-]+`, appName))
55+
Eventually(sess).Should(gbytes.Say(`uuid:\s+[\w-]+`))
5456
})
5557
})
5658
})

0 commit comments

Comments
 (0)