Example #1
0
func domainsTest(t *testing.T, cfg *utils.DeisTestConfig) {
	utils.Execute(t, domainsAddCmd, cfg, false, "done")
	// ensure both the root domain and the custom domain work
	utils.CurlApp(t, *cfg)
	utils.Curl(t, fmt.Sprintf("http://%s", cfg.AppDomain))
	utils.Execute(t, domainsRemoveCmd, cfg, false, "done")
	// only the root domain should work now
	utils.CurlApp(t, *cfg)
	// TODO (bacongobbler): add test to ensure that the custom domain fails to connect
}
Example #2
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")
	// ensure custom buildpack URLs are in order
	url := buildpacks[cfg.ExampleApp]
	if url == "" {
		// set url anyway so example-dockerfile apps create a build
		url = buildpacks["example-go"]
	}
	cmd := strings.Replace(configSetBuildpackCmd, "$BUILDPACK_URL", url, 1)
	utils.Execute(t, cmd, cfg, false, url)
	utils.Execute(t, gitPushCmd, cfg, false, "")
	utils.CurlApp(t, *cfg)
	utils.CheckList(t, "run env --app={{.AppName}}", cfg, "DEIS_APP", false)
	utils.CheckList(t, "run env --app={{.AppName}}", cfg, "DEIS_RELEASE", false)
	if err := utils.Chdir(".."); err != nil {
		t.Fatal(err)
	}
	return cfg
}
Example #3
0
func certsTest(t *testing.T, cfg *utils.DeisTestConfig) {
	utils.Execute(t, domainsAddCmd, cfg, false, "done")
	utils.Execute(t, certsAddCmd, cfg, false, cfg.AppDomain)
	// wait for the certs to be populated in the router; cron takes up to 1 minute
	fmt.Println("sleeping for 60 seconds until certs are generated...")
	time.Sleep(60 * time.Second)
	fmt.Println("ok")
	// ensure the custom domain's SSL endpoint works
	utils.Curl(t, fmt.Sprintf("https://%s", cfg.AppDomain))
	utils.Execute(t, certsRemoveCmd, cfg, false, "done")
	// only the root domain should work now
	utils.CurlApp(t, *cfg)
	// TODO (bacongobbler): add test to ensure that the custom domain fails to connect
}
Example #4
0
func domainsSetup(t *testing.T) *utils.DeisTestConfig {
	cfg := utils.GetGlobalConfig()
	cfg.AppName = "domainsample"
	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, "")
	utils.Execute(t, gitPushCmd, cfg, false, "")
	utils.CurlApp(t, *cfg)
	if err := utils.Chdir(".."); err != nil {
		t.Fatal(err)
	}
	return cfg
}
Example #5
0
func appsLogsTest(t *testing.T, params *utils.DeisTestConfig) {
	cmd := appsLogsCmd
	// test for application lifecycle logs
	utils.Execute(t, cmd, params, false, "204 NO CONTENT")
	if err := utils.Chdir(params.ExampleApp); err != nil {
		t.Fatal(err)
	}
	utils.Execute(t, gitPushCmd, params, false, "")
	utils.CurlApp(t, *params)
	utils.Execute(t, cmd, params, false, "created initial release")
	utils.Execute(t, cmd, params, false, "listening on 5000...")

	utils.Execute(t, appsLogsLimitCmd, params, false, "")

	if err := utils.Chdir(".."); err != nil {
		t.Fatal(err)
	}
}
Example #6
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")
}