コード例 #1
0
ファイル: integration_test.go プロジェクト: bdemers/deis
func cookieTest(t *testing.T, params *utils.DeisTestConfig) {
	// Regression test for https://github.com/deis/deis/pull/1136
	// Ensure that cookies are cleared on auth:register and auth:cancel
	user, err := user.Current()
	if err != nil {
		t.Fatal(err)
	}
	cookieJar := user.HomeDir + "/.deis/cookies.txt"
	utils.Execute(t, authRegisterCmd, params, false, "")
	cmd := "cat " + cookieJar
	utils.CheckList(t, cmd, params, "csrftoken", false)
	utils.CheckList(t, cmd, params, "sessionid", false)
	info, err := os.Stat(cookieJar)
	if err != nil {
		t.Fatal(err)
	}
	mode := info.Mode().String()
	expected := "-rw-------"
	if mode != expected {
		t.Fatalf("%s has wrong mode:\n   current: %s\n  expected: %s",
			cookieJar, mode, expected)
	}
	utils.AuthCancel(t, params)
	utils.CheckList(t, cmd, params, "csrftoken", true)
	utils.CheckList(t, cmd, params, "sessionid", true)
}
コード例 #2
0
ファイル: config_test.go プロジェクト: gpxl/deis
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
}
コード例 #3
0
ファイル: config_test.go プロジェクト: bladealslayer/deis
func configSetTest(t *testing.T, params *utils.DeisTestConfig) {
	utils.Execute(t, configSetCmd, params, false, "讲台")
	utils.CheckList(t, appsInfoCmd, params, "(v5)", false)
	utils.Execute(t, configSet2Cmd, params, false, "10")
	utils.CheckList(t, appsInfoCmd, params, "(v6)", false)
	utils.Execute(t, configSetHealthcheckCmd, params, false, "/")
	utils.CheckList(t, appsInfoCmd, params, "(v7)", false)
}
コード例 #4
0
ファイル: perms_test.go プロジェクト: CodeJuan/deis
func permsCreateAppTest(t *testing.T, params, user *utils.DeisTestConfig) {
	utils.Execute(t, authLoginCmd, user, false, "")
	utils.Execute(t, permsCreateAppCmd, user, true, "403 FORBIDDEN")
	utils.Execute(t, authLoginCmd, params, false, "")
	utils.Execute(t, permsCreateAppCmd, params, false, "")
	utils.CheckList(t, permsListAppCmd, params, "test1", false)
}
コード例 #5
0
ファイル: apps_test.go プロジェクト: CloudSide/deis
func appsRunTest(t *testing.T, params *utils.DeisTestConfig) {
	cmd := appsRunCmd
	if err := utils.Chdir(params.ExampleApp); err != nil {
		t.Fatal(err)
	}
	utils.CheckList(t, cmd, params, "Hello, 世界", false)
	utils.Execute(t, "apps:run env", params, true, "GIT_SHA")
	// Fleet/systemd unit files have a limit of 2048 characters per line or else one encounters
	// problems parsing the unit.  To verify long log messages are truncated and do not crash
	// logspout (see https://github.com/deis/deis/issues/2046) we must issue a (relatively) short
	// command via `deis apps:run` that produces a LONG, but testable (predictable) log message we
	// can search for in the output of `deis logs`.
	//
	// The strategy for achieving this is to generate 1k random characters, then use that with a
	// command submitted via `deis apps:run` that will echo those 1k bytes 64x (on a single line).
	// Such a message is long enough to crash logspout if handled improperly and ALSO gives us a
	// large, distinct, and predictable string we can search for in the logs to assert success (and
	// assert that the message didn't crash logspout) WITHOUT ever needing to transmit such an
	// egregiously long command via `deis apps:run`.
	largeString := randomString(1024)
	utils.Execute(t, fmt.Sprintf("apps:run \"printf '%s%%.0s' {1..64}\"", largeString), params, false, largeString)
	// To assert the long message didn't crash logspout AND made it to the logger, we will search
	// the logs for a fragment of the long message-- specifically 2x the random string we generated.
	// This will help us ensure the actual log message made it through and not JUST the log message
	// that states the command being execured via `deis apps:run`.  We want to find the former, not
	// the latter because the latter is too short a message to have possibly crashed logspout if
	// mishandled.
	utils.Execute(t, "logs", params, false, strings.Repeat(largeString, 2))
	if err := utils.Chdir(".."); err != nil {
		t.Fatal(err)
	}
	utils.Execute(t, cmd, params, true, "Not found")
}
コード例 #6
0
ファイル: ps_test.go プロジェクト: ericcapricorn/deis
func psListTest(t *testing.T, params *utils.DeisTestConfig, notflag bool) {
	output := "web.2 up (v2)"
	if strings.Contains(params.ExampleApp, "dockerfile") {
		output = strings.Replace(output, "web", "cmd", 1)
	}
	utils.CheckList(t, psListCmd, params, output, notflag)
}
コード例 #7
0
ファイル: auth_test.go プロジェクト: laurrentt/deis
func authCancel(t *testing.T, params *utils.DeisTestConfig) {
	utils.Execute(t, authCancelCmd, params, false, "Account cancelled")
	user := utils.GetGlobalConfig()

	// Admins can delete other users.
	user.UserName, user.Password = "******", "test"
	utils.Execute(t, authRegisterCmd, user, false, "")
	admin := utils.GetGlobalConfig()
	utils.Execute(t, authLoginCmd, admin, false, "")
	utils.Execute(t, authCancelAdminCmd, user, false, "Account cancelled")
	// Make sure the admin is still logged in
	utils.CheckList(t, authWhoamiCmd, admin, admin.UserName, false)
}
コード例 #8
0
ファイル: apps_test.go プロジェクト: yun-an/deis
func appsTransferTest(t *testing.T, params *utils.DeisTestConfig) {
	user := utils.GetGlobalConfig()
	user.UserName, user.Password = "******", "test"
	user.AppName = "transfer-test"
	user.NewOwner = params.UserName
	utils.Execute(t, authRegisterCmd, user, false, "")
	utils.Execute(t, authLoginCmd, user, false, "")
	utils.Execute(t, appsCreateCmdNoRemote, user, false, "")
	utils.Execute(t, appsTransferCmd, user, false, "")
	utils.Execute(t, appsInfoCmd, user, true, "403 FORBIDDEN")
	utils.Execute(t, authLoginCmd, params, false, "")
	params.AppName = user.AppName
	utils.CheckList(t, appsInfoCmd, params, params.UserName, false)
}
コード例 #9
0
ファイル: config_test.go プロジェクト: gpxl/deis
func configPushTest(t *testing.T, params *utils.DeisTestConfig) {
	if err := utils.Chdir(params.ExampleApp); err != nil {
		t.Fatal(err)
	}
	// create a .env in the project root
	if err := ioutil.WriteFile(".env", []byte("POWERED_BY=Deis"), 0664); err != nil {
		t.Fatal(err)
	}
	utils.Execute(t, "config:push --app {{.AppName}}", params, false, "Deis")
	utils.CheckList(t, appsInfoCmd, params, "(v7)", false)
	if err := utils.Chdir(".."); err != nil {
		t.Fatal(err)
	}
}
コード例 #10
0
ファイル: apps_test.go プロジェクト: gdestuynder/deis
func appsRunTest(t *testing.T, params *utils.DeisTestConfig) {
	cmd := appsRunCmd
	if err := utils.Chdir(params.ExampleApp); err != nil {
		t.Fatal(err)
	}
	utils.CheckList(t, cmd, params, "Hello, 世界", false)
	utils.Execute(t, "apps:run env", params, true, "GIT_SHA")
	// run a REALLY large command to test https://github.com/deis/deis/issues/2046
	largeString := randomString(1024)
	utils.Execute(t, "apps:run echo "+largeString, params, false, largeString)
	if err := utils.Chdir(".."); err != nil {
		t.Fatal(err)
	}
	utils.Execute(t, cmd, params, true, "Not found")
}
コード例 #11
0
ファイル: clusters_test.go プロジェクト: bdemers/deis
func clustersListTest(
	t *testing.T, params *utils.DeisTestConfig, notflag bool) {
	utils.CheckList(t, clustersListCmd, params, params.ClusterName, notflag)
}
コード例 #12
0
ファイル: config_test.go プロジェクト: johanneswuerbach/deis
func configUnsetTest(t *testing.T, params *utils.DeisTestConfig) {
	utils.Execute(t, configUnsetCmd, params, false, "")
	utils.CheckList(t, appsInfoCmd, params, "(v7)", false)
	utils.CheckList(t, "run env --app={{.AppName}}", params, "FOO", true)
}
コード例 #13
0
ファイル: config_test.go プロジェクト: johanneswuerbach/deis
func configListTest(
	t *testing.T, params *utils.DeisTestConfig, notflag bool) {
	utils.CheckList(t, configListCmd, params, "FOO", notflag)
}
コード例 #14
0
ファイル: config_test.go プロジェクト: bdemers/deis
func configUnsetTest(t *testing.T, params *utils.DeisTestConfig) {
	utils.Execute(t, configUnsetCmd, params, false, "")
	utils.CheckList(t, appsInfoCmd, params, "(v4)", false)
}
コード例 #15
0
ファイル: apps_test.go プロジェクト: gdestuynder/deis
func appsListTest(t *testing.T, params *utils.DeisTestConfig, notflag bool) {
	utils.CheckList(t, appsListCmd, params, params.AppName, notflag)
}
コード例 #16
0
ファイル: keys_test.go プロジェクト: CodeJuan/deis
func keysListTest(t *testing.T, params *utils.DeisTestConfig, notflag bool) {
	utils.CheckList(t, keysListCmd, params, params.AuthKey, notflag)
}
コード例 #17
0
ファイル: users_test.go プロジェクト: CodeJuan/deis
func usersListTest(t *testing.T, params *utils.DeisTestConfig, user *utils.DeisTestConfig) {
	utils.Execute(t, authLoginCmd, user, false, "")
	utils.Execute(t, usersListCmd, user, true, "403 FORBIDDEN")
	utils.Execute(t, authLoginCmd, params, false, "")
	utils.CheckList(t, usersListCmd, params, "user-list-test", false)
}
コード例 #18
0
ファイル: perms_test.go プロジェクト: CodeJuan/deis
func permsDeleteAdminTest(t *testing.T, params *utils.DeisTestConfig) {
	utils.Execute(t, permsDeleteAdminCmd, params, false, "")
	utils.CheckList(t, permsListAdminCmd, params, "test1", true)
}
コード例 #19
0
ファイル: clusters_test.go プロジェクト: bdemers/deis
func clustersUpdateTest(t *testing.T, params *utils.DeisTestConfig) {
	// Regression test for https://github.com/deis/deis/pull/1283
	// Check that we didn't store the path of the key in the cluster.
	utils.CheckList(t, clustersUpdateCmd, params, "~/.ssh/", true)
}
コード例 #20
0
ファイル: releases_test.go プロジェクト: CodeJuan/deis
func releasesListTest(
	t *testing.T, params *utils.DeisTestConfig, notflag bool) {
	utils.CheckList(t, releasesListCmd, params, params.Version, notflag)
}
コード例 #21
0
ファイル: perms_test.go プロジェクト: CodeJuan/deis
func permsDeleteAppTest(t *testing.T, params, user *utils.DeisTestConfig) {
	utils.Execute(t, authLoginCmd, user, false, "")
	utils.Execute(t, permsDeleteAppCmd, user, false, "")
	utils.Execute(t, authLoginCmd, params, false, "")
	utils.CheckList(t, permsListAppCmd, params, "test1", true)
}