|
| 1 | +package _tests_test |
| 2 | + |
| 3 | +import ( |
| 4 | + . "github.com/onsi/ginkgo" |
| 5 | + . "github.com/onsi/gomega" |
| 6 | +) |
| 7 | + |
| 8 | +var _ = Describe("Apps", func() { |
| 9 | + Context("with a logged-in user", func() { |
| 10 | + appName := "apps-test" |
| 11 | + |
| 12 | + BeforeEach(func() { |
| 13 | + login(url, testUser, testPassword) |
| 14 | + }) |
| 15 | + |
| 16 | + It("can't get app info", func() { |
| 17 | + output, err := execute("deis info -a %s", appName) |
| 18 | + Expect(err).To(HaveOccurred()) |
| 19 | + Expect(output).To(ContainSubstring("NOT FOUND")) |
| 20 | + }) |
| 21 | + |
| 22 | + It("can't get app logs", func() { |
| 23 | + output, err := execute("deis logs -a %s", appName) |
| 24 | + Expect(err).To(HaveOccurred()) |
| 25 | + Expect(output).To(ContainSubstring("NOT FOUND")) |
| 26 | + }) |
| 27 | + |
| 28 | + // TODO: this currently returns "Error: json: cannot unmarshal object into Go value of type []interface {}" |
| 29 | + XIt("can't run a command in the app environment", func() { |
| 30 | + output, err := execute("deis apps:run echo Hello, 世界") |
| 31 | + Expect(err).To(HaveOccurred()) |
| 32 | + Expect(output).To(ContainSubstring("NOT FOUND")) |
| 33 | + }) |
| 34 | + |
| 35 | + It("can create an app", func() { |
| 36 | + output, err := execute("deis apps:create %s", appName) |
| 37 | + Expect(err).NotTo(HaveOccurred()) |
| 38 | + Expect(output).To(SatisfyAll( |
| 39 | + ContainSubstring("Creating Application... done, created %s", appName), |
| 40 | + ContainSubstring("Git remote deis added"), |
| 41 | + ContainSubstring("remote available at "))) |
| 42 | + output, err = execute("deis apps:destroy --confirm=%s", appName) |
| 43 | + Expect(err).NotTo(HaveOccurred()) |
| 44 | + Expect(output).To(SatisfyAll( |
| 45 | + ContainSubstring("Destroying %s...", appName), |
| 46 | + ContainSubstring("done in "), |
| 47 | + ContainSubstring("Git remote deis removed"))) |
| 48 | + }) |
| 49 | + |
| 50 | + It("can create an app with no git remote", func() { |
| 51 | + output, err := execute("deis apps:create %s --no-remote", appName) |
| 52 | + Expect(err).NotTo(HaveOccurred()) |
| 53 | + Expect(output).To(SatisfyAll( |
| 54 | + ContainSubstring("Creating Application... done, created %s", appName), |
| 55 | + ContainSubstring("remote available at "))) |
| 56 | + Expect(output).NotTo(ContainSubstring("Git remote deis added")) |
| 57 | + output, err = execute("deis apps:destroy --app=%s --confirm=%s", appName, appName) |
| 58 | + Expect(err).NotTo(HaveOccurred()) |
| 59 | + Expect(output).To(SatisfyAll( |
| 60 | + ContainSubstring("Destroying %s...", appName), |
| 61 | + ContainSubstring("done in "))) |
| 62 | + Expect(output).NotTo(ContainSubstring("Git remote deis removed")) |
| 63 | + }) |
| 64 | + |
| 65 | + It("can create an app with a custom buildpack", func() { |
| 66 | + output, err := execute("deis apps:create %s --buildpack https://example.com", appName) |
| 67 | + Expect(err).NotTo(HaveOccurred()) |
| 68 | + Expect(output).To(SatisfyAll( |
| 69 | + ContainSubstring("Creating Application... done, created %s", appName), |
| 70 | + ContainSubstring("Git remote deis added"), |
| 71 | + ContainSubstring("remote available at "))) |
| 72 | + output, err = execute("deis config:list") |
| 73 | + Expect(err).NotTo(HaveOccurred()) |
| 74 | + Expect(output).To(ContainSubstring("BUILDPACK_URL")) |
| 75 | + output, err = execute("deis apps:destroy --app=%s --confirm=%s", appName, appName) |
| 76 | + Expect(err).NotTo(HaveOccurred()) |
| 77 | + Expect(output).To(SatisfyAll( |
| 78 | + ContainSubstring("Destroying %s...", appName), |
| 79 | + ContainSubstring("done in "), |
| 80 | + ContainSubstring("Git remote deis removed"))) |
| 81 | + }) |
| 82 | + }) |
| 83 | + |
| 84 | + // Context("with a deployed app", func() { |
| 85 | + // |
| 86 | + // appName := "apps-test" |
| 87 | + // repository := "https://github.com/deis/example-go.git" |
| 88 | + // |
| 89 | + // TODO: can't have an Expect outside an It clause...need to refactor |
| 90 | + // output, err := execute("git clone %s", repository) |
| 91 | + // Expect(err).NotTo(HaveOccurred()) |
| 92 | + // Expect(output).To(SatisfyAll( |
| 93 | + // ContainSubstring("Cloning into "), |
| 94 | + // ContainSubstring("done."))) |
| 95 | + // // TODO: change directory to cloned app dir |
| 96 | + // output, err = execute("deis apps:create %s", appName) |
| 97 | + // Expect(err).NotTo(HaveOccurred()) |
| 98 | + // Expect(output).To(SatisfyAll( |
| 99 | + // ContainSubstring("Creating Application... done, created %s", appName), |
| 100 | + // ContainSubstring("Git remote deis added"), |
| 101 | + // ContainSubstring("remote available at "))) |
| 102 | + // output, err = execute("git push deis master") |
| 103 | + // Expect(err).NotTo(HaveOccurred()) |
| 104 | + // Expect(output).To(SatisfyAll( |
| 105 | + // ContainSubstring("-----> Launching..."), |
| 106 | + // ContainSubstring("done, %s:v2 deployed to Deis", appName))) |
| 107 | + // |
| 108 | + // It("can't create an existing app", func() { |
| 109 | + // output, err = execute("deis apps:create %s", appName) |
| 110 | + // Expect(err).To(HaveOccurred()) |
| 111 | + // Expect(output).To(ContainSubstring("This field must be unique")) |
| 112 | + // }) |
| 113 | + // |
| 114 | + // It("can get app info", func() { |
| 115 | + // output, err := execute("deis info") |
| 116 | + // Expect(err).NotTo(HaveOccurred()) |
| 117 | + // Expect(output).To(SatisfyAll( |
| 118 | + // HavePrefix("=== %s Application", appName), |
| 119 | + // ContainSubstring("=== %s Processes", appName), |
| 120 | + // ContainSubstring(".1 up (v"), |
| 121 | + // ContainSubstring("=== %s Domains", appName))) |
| 122 | + // }) |
| 123 | + // |
| 124 | + // It("can get app logs", func() { |
| 125 | + // output, err := execute("deis logs") |
| 126 | + // Expect(err).NotTo(HaveOccurred()) |
| 127 | + // Expect(output).To(SatisfyAll( |
| 128 | + // ContainSubstring("%s[deis-controller]: %s created initial release", |
| 129 | + // appName, username), |
| 130 | + // ContainSubstring("%s[deis-controller]: %s deployed", appName, username), |
| 131 | + // ContainSubstring("%s[deis-controller]: %s scaled containers", |
| 132 | + // appName, username))) |
| 133 | + // }) |
| 134 | + // |
| 135 | + // // TODO: how to test "deis open" which spawns a browser? |
| 136 | + // XIt("can open the app's URL", func() { |
| 137 | + // _, err := execute("deis open") |
| 138 | + // Expect(err).NotTo(HaveOccurred()) |
| 139 | + // }) |
| 140 | + // |
| 141 | + // It("can't open a bogus app URL", func() { |
| 142 | + // output, err := execute("deis open -a bogus-appname") |
| 143 | + // Expect(err).To(HaveOccurred()) |
| 144 | + // Expect(output).To(ContainSubstring("404 NOT FOUND")) |
| 145 | + // }) |
| 146 | + // |
| 147 | + // It("can run a command in the app environment", func() { |
| 148 | + // output, err := execute("deis apps:run echo Hello, 世界") |
| 149 | + // Expect(err).NotTo(HaveOccurred()) |
| 150 | + // Expect(output).To(SatisfyAll( |
| 151 | + // HavePrefix("Running 'echo Hello, 世界'..."), |
| 152 | + // HaveSuffix("Hello, 世界\n"))) |
| 153 | + // }) |
| 154 | + // |
| 155 | + // // TODO: this requires a second user account |
| 156 | + // XIt("can transfer the app to another owner", func() { |
| 157 | + // }) |
| 158 | + // }) |
| 159 | + |
| 160 | +}) |
0 commit comments