|
1 | 1 | package _tests_test |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "fmt" |
4 | 5 | . "github.com/onsi/ginkgo" |
5 | | - // . "github.com/onsi/gomega" |
| 6 | + . "github.com/onsi/gomega" |
6 | 7 | ) |
7 | 8 |
|
8 | 9 | var _ = Describe("Releases", func() { |
| 10 | + appName := getRandAppName() |
| 11 | + Context("with no app", func() { |
| 12 | + It("can create an app", func() { |
| 13 | + output, err := execute("deis apps:create %s --no-remote", appName) |
| 14 | + Expect(err).NotTo(HaveOccurred()) |
| 15 | + Expect(output).To(ContainSubstring(fmt.Sprintf("Creating Application... done, created %s", appName))) |
| 16 | + }) |
| 17 | + It("can deploy the app", func() { |
| 18 | + output, err := execute("deis pull deis/example-go -a %s", appName) |
| 19 | + Expect(err).NotTo(HaveOccurred()) |
| 20 | + Expect(output).To(ContainSubstring("Creating build... done")) |
| 21 | + }) |
| 22 | + }) |
| 23 | + |
9 | 24 | Context("with a deployed app", func() { |
| 25 | + It("can list releases", func() { |
| 26 | + output, err := execute("deis releases:list -a %s", appName) |
| 27 | + Expect(err).NotTo(HaveOccurred()) |
| 28 | + Expect(output).To(SatisfyAll( |
| 29 | + HavePrefix("=== %s Releases", appName), |
| 30 | + MatchRegexp(`v1\t.*\t%s created initial release`, testUser), |
| 31 | + MatchRegexp(`v2\t.*\t%s deployed \w+`, testUser)), |
| 32 | + ) |
| 33 | + }) |
| 34 | + |
| 35 | + It("can rollback to a previous release", func() { |
| 36 | + output, err := execute("deis releases:rollback v1 -a %s", appName) |
| 37 | + Expect(err).NotTo(HaveOccurred()) |
| 38 | + Expect(output).To(SatisfyAll( |
| 39 | + HavePrefix("Rolling back to"), |
| 40 | + ContainSubstring("...done"), |
| 41 | + )) |
| 42 | + }) |
10 | 43 |
|
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 | | - // }) |
| 44 | + It("can get info on releases", func() { |
| 45 | + output, err := execute("deis releases:info v1 -a %s", appName) |
| 46 | + Expect(err).NotTo(HaveOccurred()) |
| 47 | + Expect(output).To(SatisfyAll( |
| 48 | + HavePrefix("=== %s Release v1", appName), |
| 49 | + MatchRegexp(`config:\s+[\w-]+`), |
| 50 | + MatchRegexp(`owner:\s+%s`, testUser), |
| 51 | + MatchRegexp(`summary:\s+%s \w+`, testUser), |
| 52 | + // the below updated date has to match a string like 2015-12-22T21:20:31UTC |
| 53 | + MatchRegexp(`updated:\s+[0-9]+-[0-9]+-[A-Z0-9]+:[0-9]+:[A-Z0-9:-]+`, appName), |
| 54 | + MatchRegexp(`uuid:\s+[\w-]+`))) |
| 55 | + }) |
40 | 56 | }) |
41 | 57 | }) |
0 commit comments