コード例 #1
0
ファイル: commands.go プロジェクト: sgoings/workflow-e2e
// Curl polls an app over HTTP until it returns the expected "Powered by" banner.
func Curl(app model.App, banner string) {
	// curl the app's root URL and print just the HTTP response code
	cmdRetryTimeout := 60
	curlCmd := model.Cmd{CommandLineString: fmt.Sprintf(
		`curl -sL -w "%%{http_code}\\n" "%s" -o /dev/null`, app.URL)}
	Eventually(cmd.Retry(curlCmd, strconv.Itoa(http.StatusOK), cmdRetryTimeout)).Should(BeTrue())
	// verify that the response contains "Powered by" as all the example apps do
	curlCmd = model.Cmd{CommandLineString: fmt.Sprintf(`curl -sL "%s"`, app.URL)}
	Eventually(cmd.Retry(curlCmd, banner, cmdRetryTimeout)).Should(BeTrue())
}
コード例 #2
0
ファイル: ps_test.go プロジェクト: helgi/workflow-e2e
					sess, err := cmd.Start("deis ps:scale cmd=%d --app=%s", &user, scaleTo, app.Name)
					Eventually(sess).Should(Say("Scaling processes... but first,"))
					Eventually(sess, settings.MaxEventuallyTimeout).Should(Say(`done in \d+s`))
					Eventually(sess).Should(Say("=== %s Processes", app.Name))
					Expect(err).NotTo(HaveOccurred())
					Eventually(sess).Should(Exit(0))

					// test that there are the right number of processes listed
					procsListing := listProcs(user, app).Out.Contents()
					procs := scrapeProcs(app.Name, procsListing)
					Expect(len(procs)).To(Equal(scaleTo))

					// curl the app's root URL and print just the HTTP response code
					cmdRetryTimeout := 60
					curlCmd := model.Cmd{CommandLineString: fmt.Sprintf(`curl -sL -w "%%{http_code}\\n" "%s" -o /dev/null`, app.URL)}
					Eventually(cmd.Retry(curlCmd, strconv.Itoa(respCode), cmdRetryTimeout)).Should(BeTrue())
				},
				Entry("scales to 1", 1, 200),
				Entry("scales to 3", 3, 200),
				Entry("scales to 0", 0, 503),
			)

			// TODO: Test is broken
			XIt("that app remains responsive during a scaling event", func() {
				stopCh := make(chan struct{})
				doneCh := make(chan struct{})

				// start scaling the app
				go func() {
					for range stopCh {
						sess, err := cmd.Start("deis ps:scale web=4 -a %s", &user, app.Name)
コード例 #3
0
ファイル: certs_test.go プロジェクト: sgoings/workflow-e2e
				AfterEach(func() {
					domains.Remove(user, app, domain)
				})

				Context("and that user also owns an existing cert", func() {

					BeforeEach(func() {
						certs.Add(user, cert)
					})

					AfterEach(func() {
						certs.Remove(user, cert)
					})

					Specify("that user can attach/detach that cert to/from that domain", func() {
						certs.Attach(user, cert, domain)
						curlCmd := model.Cmd{CommandLineString: fmt.Sprintf(`curl -k -H "Host: %s" -sL -w "%%{http_code}\\n" "%s" -o /dev/null`, domain, app.URL)}
						Eventually(cmd.Retry(curlCmd, strconv.Itoa(http.StatusOK), 60)).Should(BeTrue())
						certs.Detach(user, cert, domain)
					})

				})

			})

		})

	})

})
コード例 #4
0
ファイル: domains_test.go プロジェクト: helgi/workflow-e2e
			Context("with a domain added to it", func() {

				cmdRetryTimeout := 60

				var domain string

				BeforeEach(func() {
					domain = getRandDomain()
					domains.Add(user, app, domain)
				})

				AfterEach(func() {
					domains.Remove(user, app, domain)
					// App can no longer be accessed at the previously associated domain
					curlCmd := model.Cmd{CommandLineString: fmt.Sprintf(`curl -sL -H "Host: %s" -w "%%{http_code}\\n" "%s" -o /dev/null`, domain, app.URL)}
					Eventually(cmd.Retry(curlCmd, strconv.Itoa(http.StatusNotFound), cmdRetryTimeout)).Should(BeTrue())
				})

				Specify("that app can be accessed at its usual address", func() {
					curlCmd := model.Cmd{CommandLineString: fmt.Sprintf(`curl -sL -w "%%{http_code}\\n" "%s" -o /dev/null`, app.URL)}
					Eventually(cmd.Retry(curlCmd, strconv.Itoa(http.StatusOK), cmdRetryTimeout)).Should(BeTrue())
				})

				Specify("that app can be accessed at the associated domain", func() {
					curlCmd := model.Cmd{CommandLineString: fmt.Sprintf(`curl -sL -H "Host: %s" -w "%%{http_code}\\n" "%s" -o /dev/null`, domain, app.URL)}
					Eventually(cmd.Retry(curlCmd, strconv.Itoa(http.StatusOK), cmdRetryTimeout)).Should(BeTrue())
				})

			})

		})