@@ -2,40 +2,57 @@ package _tests_test
22
33import (
44 . "github.com/onsi/ginkgo"
5- // . "github.com/onsi/gomega"
5+ . "github.com/onsi/gomega"
6+ "github.com/onsi/gomega/gbytes"
7+ "github.com/onsi/gomega/gexec"
68)
79
810var _ = Describe ("Releases" , func () {
11+ appName := getRandAppName ()
12+ Context ("with no app" , func () {
13+ It ("can create an app" , func () {
14+ sess , err := start ("deis apps: create %s --no-remote" , appName )
15+ Expect (err ).To (BeNil ())
16+ Eventually (sess ).Should (gexec .Exit (0 ))
17+ Eventually (sess ).Should (gbytes .Say ("Creating Application... done, created %s" , appName ))
18+ })
19+ It ("can deploy the app" , func () {
20+ sess , err := start ("deis pull deis/example-go -a %s" , appName )
21+ Expect (err ).To (BeNil ())
22+ Eventually (sess ).Should (gexec .Exit (0 ))
23+ Eventually (sess ).Should (gbytes .Say ("Creating build... done" ))
24+ })
25+ })
26+
927 Context ("with a deployed app" , func () {
28+ It ("can list releases" , func () {
29+ sess , err := start ("deis releases:list -a %s" , appName )
30+ Expect (err ).To (BeNil ())
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 ))
35+ })
36+
37+ It ("can rollback to a previous release" , func () {
38+ sess , err := start ("deis releases:rollback v1 -a %s" , appName )
39+ Expect (err ).To (BeNil ())
40+ Eventually (sess ).Should (gexec .Exit (0 ))
41+ Eventually (sess ).Should (gbytes .Say ("Rolling back to" ))
42+ Eventually (sess ).Should (gbytes .Say ("...done" ))
43+ })
1044
11- // XIt("can list releases", func() {
12- // output, err := execute("deis releases:list --app=%s", appName)
13- // Expect(err).NotTo(HaveOccurred())
14- // Expect(output).To(SatisfyAll(
15- // HavePrefix("=== %s Releases", appName),
16- // MatchRegexp(`v1\t.*\t%s created initial release`, username),
17- // MatchRegexp(`v2\t.*\t%s deployed \w+`, username)))
18- // })
19- //
20- // XIt("can rollback to a previous release", func() {
21- // output, err := execute("deis releases:rollback v2 --app=%s", appName)
22- // Expect(err).NotTo(HaveOccurred())
23- //
24- // Expect
25- // regexp := `asdf`
26- // Expect(output)
27- // })
28- //
29- // XIt("can get info on releases", func() {
30- // output, err := execute("deis releases:info %s --app=%s", version, appName)
31- // Expect(err).NotTo(HaveOccurred())
32- // Expect(output).To(SatisfyAll(
33- // HavePrefix("=== %s Release v2", appName),
34- // MatchRegexp(`build:\s+[\w-]+`),
35- // MatchRegexp(`config:\s+[\w-]+`),
36- // MatchRegexp(`owner:\s+%s`, username),
37- // MatchRegexp(`summary:\s+%s deployed \w+`, username),
38- // MatchRegexp(`uuid:\s+[\w-]+`)))
39- // })
45+ It ("can get info on releases" , func () {
46+ sess , err := start ("deis releases:info v1 -a %s" , appName )
47+ Expect (err ).To (BeNil ())
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-]+` ))
56+ })
4057 })
4158})
0 commit comments