github.com/randomtask1155/cli@v6.41.1-0.20181227003417-a98eed78cbde+incompatible/integration/v6/push/app_flags_test.go (about) 1 package push 2 3 import ( 4 "fmt" 5 "regexp" 6 "time" 7 8 "code.cloudfoundry.org/cli/api/cloudcontroller/ccversion" 9 "code.cloudfoundry.org/cli/integration/helpers" 10 . "github.com/onsi/ginkgo" 11 . "github.com/onsi/gomega" 12 . "github.com/onsi/gomega/gbytes" 13 . "github.com/onsi/gomega/gexec" 14 ) 15 16 var _ = Describe("push with various flags and no manifest", func() { 17 var ( 18 appName string 19 ) 20 21 BeforeEach(func() { 22 appName = helpers.NewAppName() 23 }) 24 25 When("the API version is below 3.27.0 and health check type is not http", func() { 26 BeforeEach(func() { 27 helpers.SkipIfVersionAtLeast(ccversion.MinVersionApplicationFlowV3) 28 }) 29 30 It("creates the app with the specified settings, with the health check type", func() { 31 helpers.WithHelloWorldApp(func(dir string) { 32 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, 33 PushCommandName, appName, 34 "-b", "staticfile_buildpack", 35 "-c", fmt.Sprintf("echo 'hi' && %s", helpers.StaticfileBuildpackStartCommand), 36 "-u", "port", //works if this stuff is commentted out 37 "-k", "300M", 38 "-i", "2", 39 "-m", "70M", 40 "-s", "cflinuxfs2", 41 "-t", "180", 42 ) 43 Eventually(session).Should(Say(`Getting app info\.\.\.`)) 44 Eventually(session).Should(Say(`Creating app with these attributes\.\.\.`)) 45 Eventually(session).Should(Say(`\+\s+name:\s+%s`, appName)) 46 Eventually(session).Should(Say(`(?m)\s+buildpacks:\s+\+\s+staticfile_buildpack`)) 47 Eventually(session).Should(Say(`\s+command:\s+echo 'hi' && %s`, regexp.QuoteMeta(helpers.StaticfileBuildpackStartCommand))) 48 Eventually(session).Should(Say(`\s+disk quota:\s+300M`)) 49 Eventually(session).Should(Say(`\s+health check timeout:\s+180`)) 50 Eventually(session).Should(Say(`\s+health check type:\s+port`)) 51 Eventually(session).Should(Say(`\s+instances:\s+2`)) 52 Eventually(session).Should(Say(`\s+memory:\s+70M`)) 53 Eventually(session).Should(Say(`\s+stack:\s+cflinuxfs2`)) 54 Eventually(session).Should(Say(`\s+routes:`)) 55 Eventually(session).Should(Say(`(?i)\+\s+%s.%s`, appName, helpers.DefaultSharedDomain())) 56 Eventually(session).Should(Say(`Mapping routes\.\.\.`)) 57 Eventually(session).Should(Say(`Uploading files\.\.\.`)) 58 Eventually(session).Should(Say("100.00%")) 59 Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`)) 60 helpers.ConfirmStagingLogs(session) 61 Eventually(session).Should(Say(`Waiting for app to start\.\.\.`)) 62 Eventually(session).Should(Say(`requested state:\s+started`)) 63 Eventually(session).Should(Say(`start command:\s+echo 'hi' && %s`, regexp.QuoteMeta(helpers.StaticfileBuildpackStartCommand))) 64 Eventually(session).Should(Exit(0)) 65 }) 66 67 // output is different from when API version is above 3.27.0 68 session := helpers.CF("app", appName) 69 Eventually(session).Should(Say(`name:\s+%s`, appName)) 70 Eventually(session).Should(Say(`instances:\s+\d/2`)) 71 Eventually(session).Should(Say(`usage:\s+70M x 2`)) 72 Eventually(session).Should(Say(`stack:\s+cflinuxfs2`)) 73 Eventually(session).Should(Say(`buildpack:\s+staticfile_buildpack`)) 74 Eventually(session).Should(Say("#0.* of 70M")) 75 Eventually(session).Should(Exit(0)) 76 }) 77 }) 78 79 When("the API version is above 3.27.0 and health check type is not http", func() { 80 BeforeEach(func() { 81 helpers.SkipIfVersionLessThan(ccversion.MinVersionApplicationFlowV3) 82 }) 83 84 It("creates the app with the specified settings, with the health check type", func() { 85 helpers.WithHelloWorldApp(func(dir string) { 86 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, 87 PushCommandName, appName, 88 "-b", "staticfile_buildpack", 89 "-c", fmt.Sprintf("echo 'hi' && %s", helpers.StaticfileBuildpackStartCommand), 90 "-u", "port", //works if this stuff is commentted out 91 "-k", "300M", 92 "-i", "2", 93 "-m", "70M", 94 "-s", "cflinuxfs2", 95 "-t", "180", 96 ) 97 Eventually(session).Should(Say(`Getting app info\.\.\.`)) 98 Eventually(session).Should(Say(`Creating app with these attributes\.\.\.`)) 99 Eventually(session).Should(Say(`\+\s+name:\s+%s`, appName)) 100 Eventually(session).Should(Say(`(?m)\s+buildpacks:\s+\+\s+staticfile_buildpack`)) 101 Eventually(session).Should(Say(`\s+command:\s+echo 'hi' && %s`, regexp.QuoteMeta(helpers.StaticfileBuildpackStartCommand))) 102 Eventually(session).Should(Say(`\s+disk quota:\s+300M`)) 103 Eventually(session).Should(Say(`\s+health check timeout:\s+180`)) 104 Eventually(session).Should(Say(`\s+health check type:\s+port`)) 105 Eventually(session).Should(Say(`\s+instances:\s+2`)) 106 Eventually(session).Should(Say(`\s+memory:\s+70M`)) 107 Eventually(session).Should(Say(`\s+stack:\s+cflinuxfs2`)) 108 Eventually(session).Should(Say(`\s+routes:`)) 109 Eventually(session).Should(Say(`(?i)\+\s+%s.%s`, appName, helpers.DefaultSharedDomain())) 110 Eventually(session).Should(Say(`Mapping routes\.\.\.`)) 111 Eventually(session).Should(Say(`Uploading files\.\.\.`)) 112 Eventually(session).Should(Say("100.00%")) 113 Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`)) 114 helpers.ConfirmStagingLogs(session) 115 Eventually(session).Should(Say(`Waiting for app to start\.\.\.`)) 116 Eventually(session).Should(Say(`requested state:\s+started`)) 117 Eventually(session).Should(Say(`start command:\s+echo 'hi' && %s`, regexp.QuoteMeta(helpers.StaticfileBuildpackStartCommand))) 118 Eventually(session).Should(Exit(0)) 119 }) 120 121 // output is different from when API version is below 3.27.0 122 time.Sleep(5 * time.Second) 123 session := helpers.CF("app", appName) 124 Eventually(session).Should(Say(`name:\s+%s`, appName)) 125 Eventually(session).Should(Say(`last uploaded:\s+\w{3} \d{1,2} \w{3} \d{2}:\d{2}:\d{2} \w{3} \d{4}`)) 126 Eventually(session).Should(Say(`stack:\s+cflinuxfs2`)) 127 Eventually(session).Should(Say(`buildpacks:\s+staticfile`)) 128 Eventually(session).Should(Say(`type:\s+web`)) 129 Eventually(session).Should(Say(`instances:\s+2/2`)) 130 Eventually(session).Should(Say(`memory usage:\s+70M`)) 131 Eventually(session).Should(Say(`\s+state\s+since\s+cpu\s+memory\s+disk`)) 132 Eventually(session).Should(Say(`#0\s+running\s+\d{4}-[01]\d-[0-3]\dT[0-2][0-9]:[0-5]\d:[0-5]\dZ`)) 133 Eventually(session).Should(Exit(0)) 134 }) 135 }) 136 137 When("the API version is below 3.27.0 and health check type is http", func() { 138 BeforeEach(func() { 139 helpers.SkipIfVersionAtLeast(ccversion.MinVersionApplicationFlowV3) 140 }) 141 142 It("creates the app with the specified settings, with the health check type being 'http'", func() { 143 helpers.WithHelloWorldApp(func(dir string) { 144 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, 145 PushCommandName, appName, 146 "-b", "staticfile_buildpack", 147 "-c", fmt.Sprintf("echo 'hi' && %s", helpers.StaticfileBuildpackStartCommand), 148 "-u", "http", 149 "-k", "300M", 150 "-i", "2", 151 "-m", "70M", 152 "-s", "cflinuxfs2", 153 "-t", "180", 154 ) 155 156 Eventually(session).Should(Say(`Getting app info\.\.\.`)) 157 Eventually(session).Should(Say(`Creating app with these attributes\.\.\.`)) 158 Eventually(session).Should(Say(`\+\s+name:\s+%s`, appName)) 159 Eventually(session).Should(Say(`(?m)\s+buildpacks:\s+\+\s+staticfile_buildpack`)) 160 Eventually(session).Should(Say(`\s+command:\s+echo 'hi' && %s`, regexp.QuoteMeta(helpers.StaticfileBuildpackStartCommand))) 161 Eventually(session).Should(Say(`\s+disk quota:\s+300M`)) 162 Eventually(session).Should(Say(`\s+health check http endpoint:\s+/`)) 163 Eventually(session).Should(Say(`\s+health check timeout:\s+180`)) 164 Eventually(session).Should(Say(`\s+health check type:\s+http`)) 165 Eventually(session).Should(Say(`\s+instances:\s+2`)) 166 Eventually(session).Should(Say(`\s+memory:\s+70M`)) 167 Eventually(session).Should(Say(`\s+stack:\s+cflinuxfs2`)) 168 Eventually(session).Should(Say(`\s+routes:`)) 169 Eventually(session).Should(Say(`(?i)\+\s+%s.%s`, appName, helpers.DefaultSharedDomain())) 170 Eventually(session).Should(Say(`Mapping routes\.\.\.`)) 171 Eventually(session).Should(Say(`Uploading files\.\.\.`)) 172 Eventually(session).Should(Say("100.00%")) 173 Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`)) 174 helpers.ConfirmStagingLogs(session) 175 Eventually(session).Should(Say(`Waiting for app to start\.\.\.`)) 176 Eventually(session).Should(Say(`requested state:\s+started`)) 177 Eventually(session).Should(Say(`start command:\s+echo 'hi' && %s`, regexp.QuoteMeta(helpers.StaticfileBuildpackStartCommand))) 178 Eventually(session).Should(Exit(0)) 179 }) 180 181 // output is different from when API version is above 3.27.0 182 session := helpers.CF("app", appName) 183 Eventually(session).Should(Say(`name:\s+%s`, appName)) 184 Eventually(session).Should(Say(`instances:\s+\d/2`)) 185 Eventually(session).Should(Say(`usage:\s+70M x 2`)) 186 Eventually(session).Should(Say(`stack:\s+cflinuxfs2`)) 187 Eventually(session).Should(Say(`buildpack:\s+staticfile_buildpack`)) 188 Eventually(session).Should(Say("#0.* of 70M")) 189 Eventually(session).Should(Exit(0)) 190 }) 191 }) 192 193 When("the API version is above 3.27.0 and health check type is http", func() { 194 BeforeEach(func() { 195 helpers.SkipIfVersionLessThan(ccversion.MinVersionApplicationFlowV3) 196 }) 197 198 It("creates the app with the specified settings, with the health check type being 'http'", func() { 199 helpers.WithHelloWorldApp(func(dir string) { 200 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, 201 PushCommandName, appName, 202 "-b", "staticfile_buildpack", 203 "-c", fmt.Sprintf("echo 'hi' && %s", helpers.StaticfileBuildpackStartCommand), 204 "-u", "http", 205 "-k", "300M", 206 "-i", "2", 207 "-m", "70M", 208 "-s", "cflinuxfs2", 209 "-t", "180", 210 ) 211 212 Eventually(session).Should(Say(`Getting app info\.\.\.`)) 213 Eventually(session).Should(Say(`Creating app with these attributes\.\.\.`)) 214 Eventually(session).Should(Say(`\+\s+name:\s+%s`, appName)) 215 Eventually(session).Should(Say(`(?m)\s+buildpacks:\s+\+\s+staticfile_buildpack`)) 216 Eventually(session).Should(Say(`\s+command:\s+echo 'hi' && %s`, regexp.QuoteMeta(helpers.StaticfileBuildpackStartCommand))) 217 Eventually(session).Should(Say(`\s+disk quota:\s+300M`)) 218 Eventually(session).Should(Say(`\s+health check http endpoint:\s+/`)) 219 Eventually(session).Should(Say(`\s+health check timeout:\s+180`)) 220 Eventually(session).Should(Say(`\s+health check type:\s+http`)) 221 Eventually(session).Should(Say(`\s+instances:\s+2`)) 222 Eventually(session).Should(Say(`\s+memory:\s+70M`)) 223 Eventually(session).Should(Say(`\s+stack:\s+cflinuxfs2`)) 224 Eventually(session).Should(Say(`\s+routes:`)) 225 Eventually(session).Should(Say(`(?i)\+\s+%s.%s`, appName, helpers.DefaultSharedDomain())) 226 Eventually(session).Should(Say(`Mapping routes\.\.\.`)) 227 Eventually(session).Should(Say(`Uploading files\.\.\.`)) 228 Eventually(session).Should(Say("100.00%")) 229 Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`)) 230 helpers.ConfirmStagingLogs(session) 231 Eventually(session).Should(Say(`Waiting for app to start\.\.\.`)) 232 Eventually(session).Should(Say(`requested state:\s+started`)) 233 Eventually(session).Should(Say(`start command:\s+echo 'hi' && %s`, regexp.QuoteMeta(helpers.StaticfileBuildpackStartCommand))) 234 Eventually(session).Should(Exit(0)) 235 }) 236 237 // output is different from when API version is below 3.27.0 238 239 time.Sleep(5 * time.Second) 240 session := helpers.CF("app", appName) 241 Eventually(session).Should(Say(`name:\s+%s`, appName)) 242 Eventually(session).Should(Say(`last uploaded:\s+\w{3} \d{1,2} \w{3} \d{2}:\d{2}:\d{2} \w{3} \d{4}`)) 243 Eventually(session).Should(Say(`stack:\s+cflinuxfs2`)) 244 Eventually(session).Should(Say(`buildpacks:\s+staticfile`)) 245 Eventually(session).Should(Say(`type:\s+web`)) 246 Eventually(session).Should(Say(`instances:\s+2/2`)) 247 Eventually(session).Should(Say(`memory usage:\s+70M`)) 248 Eventually(session).Should(Say(`\s+state\s+since\s+cpu\s+memory\s+disk`)) 249 Eventually(session).Should(Say(`#0\s+running\s+\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z`)) 250 Eventually(session).Should(Exit(0)) 251 }) 252 }) 253 })