Example #1
0
func TestPs(t *testing.T) {
	params := psSetup(t)
	psScaleTest(t, params, psScaleCmd)
	appsOpenTest(t, params)
	psListTest(t, params, false)
	psScaleTest(t, params, psRestartCmd)
	psScaleTest(t, params, psDownScaleCmd)

	// FIXME if we don't wait here, some of the routers may give us a 502 before
	// the app is removed from the config.
	// we wait 7 seconds since confd reloads every 5 seconds
	time.Sleep(time.Millisecond * 7000)

	// test for a 503 response
	utils.CurlWithFail(t, fmt.Sprintf("http://%s.%s", params.AppName, params.Domain), true, "503")

	utils.AppsDestroyTest(t, params)
	utils.Execute(t, psScaleCmd, params, true, "404 NOT FOUND")
	// ensure we can choose our preferred beverage
	utils.Execute(t, psScaleCmd, params, true, "but first, coffee!")
	if err := os.Setenv("DEIS_DRINK_OF_CHOICE", "tea"); err != nil {
		t.Fatal(err)
	}
	utils.Execute(t, psScaleCmd, params, true, "but first, tea!")
}
Example #2
0
func TestPs(t *testing.T) {
	params := psSetup(t)
	psScaleTest(t, params, psScaleCmd)
	appsOpenTest(t, params)
	psListTest(t, params, false)
	psScaleTest(t, params, psDownScaleCmd)
	utils.CurlWithFail(t, params, true, "503")

	utils.AppsDestroyTest(t, params)
	utils.Execute(t, psScaleCmd, params, true, "404 NOT FOUND")
	// ensure we can choose our preferred beverage
	utils.Execute(t, psScaleCmd, params, true, "but first, coffee!")
	if err := os.Setenv("DEIS_DRINK_OF_CHOICE", "tea"); err != nil {
		t.Fatal(err)
	}
	utils.Execute(t, psScaleCmd, params, true, "but first, tea!")
}
Example #3
0
func configSetup(t *testing.T) *utils.DeisTestConfig {
	cfg := utils.GetGlobalConfig()
	cfg.AppName = "configsample"
	utils.Execute(t, authLoginCmd, cfg, false, "")
	utils.Execute(t, gitCloneCmd, cfg, false, "")
	if err := utils.Chdir(cfg.ExampleApp); err != nil {
		t.Fatal(err)
	}
	utils.Execute(t, appsCreateCmd, cfg, false, "")
	// ensure envvars with spaces work fine on `git push`
	// https://github.com/deis/deis/issues/2477
	utils.Execute(t, configSet3Cmd, cfg, false, "the Deis team")
	utils.Execute(t, gitPushCmd, cfg, false, "")
	utils.CurlWithFail(t, cfg, false, "the Deis team")
	if err := utils.Chdir(".."); err != nil {
		t.Fatal(err)
	}
	return cfg
}
Example #4
0
func appsOpenTest(t *testing.T, params *utils.DeisTestConfig) {
	utils.CurlApp(t, *params)
	utils.CurlWithFail(t, fmt.Sprintf("http://%s.%s", "this-app-does-not-exist", params.Domain), true, "404 Not Found")
}