當前位置: 首頁>>代碼示例>>Golang>>正文


Golang utils.Chdir函數代碼示例

本文整理匯總了Golang中github.com/deis/deis/tests/utils.Chdir函數的典型用法代碼示例。如果您正苦於以下問題:Golang Chdir函數的具體用法?Golang Chdir怎麽用?Golang Chdir使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Chdir函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: buildSetup

func buildSetup(t *testing.T) *itutils.DeisTestConfig {
	cfg := itutils.GetGlobalConfig()
	cfg.ExampleApp = itutils.GetRandomApp()
	cfg.AppName = "buildsample"
	cmd := itutils.GetCommand("auth", "login")
	itutils.Execute(t, cmd, cfg, false, "")
	cmd = itutils.GetCommand("git", "clone")
	itutils.Execute(t, cmd, cfg, false, "")
	cmd = itutils.GetCommand("apps", "create")
	cmd1 := itutils.GetCommand("git", "push")
	cmd2 := itutils.GetCommand("git", "add")
	cmd3 := itutils.GetCommand("git", "commit")
	if err := utils.Chdir(cfg.ExampleApp); err != nil {
		t.Fatalf("Failed:\n%v", err)
	}

	itutils.Execute(t, cmd, cfg, false, "")
	itutils.Execute(t, cmd1, cfg, false, "")
	if err := utils.CreateFile(cfg.ExampleApp); err != nil {
		t.Fatalf("Failed:\n%v", err)
	}
	itutils.Execute(t, cmd2, cfg, false, "")
	itutils.Execute(t, cmd3, cfg, false, "")
	itutils.Execute(t, cmd1, cfg, false, "")
	if err := utils.Chdir(".."); err != nil {
		t.Fatalf("Failed:\n%v", err)
	}
	return cfg
}
開發者ID:huslage,項目名稱:deis,代碼行數:29,代碼來源:builds_test.go

示例2: configSetup

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
}
開發者ID:gpxl,項目名稱:deis,代碼行數:29,代碼來源:config_test.go

示例3: appsRunTest

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")
}
開發者ID:CloudSide,項目名稱:deis,代碼行數:33,代碼來源:apps_test.go

示例4: buildsScaleTest

// buildsScaleTest ensures that we can use a Procfile-based workflow for `deis pull`.
func buildsScaleTest(t *testing.T, params *utils.DeisTestConfig) {
	if err := utils.Chdir(params.ExampleApp); err != nil {
		t.Fatal(err)
	}
	utils.Execute(t, "scale worker=1 --app={{.AppName}}", params, false, "")
	utils.Execute(t, "logs --app={{.AppName}}", params, false, "hi")
	if err := utils.Chdir(".."); err != nil {
		t.Fatal(err)
	}
}
開發者ID:CodeJuan,項目名稱:deis,代碼行數:11,代碼來源:builds_test.go

示例5: appsRunTest

func appsRunTest(t *testing.T, params *utils.DeisTestConfig) {
	cmd := appsRunCmd
	if err := utils.Chdir(params.ExampleApp); err != nil {
		t.Fatal(err)
	}
	utils.Execute(t, cmd, params, false, "")
	if err := utils.Chdir(".."); err != nil {
		t.Fatal(err)
	}
	utils.Execute(t, cmd, params, true, "Not found")
}
開發者ID:netf,項目名稱:deis,代碼行數:11,代碼來源:apps_test.go

示例6: appsDestroyTest

func appsDestroyTest(t *testing.T, params *utils.DeisTestConfig) {
	if err := utils.Chdir(params.ExampleApp); err != nil {
		t.Fatal(err)
	}
	utils.Execute(t, appsDestroyCmd, params, false, "")
	if err := utils.Chdir(".."); err != nil {
		t.Fatal(err)
	}
	if err := utils.Rmdir(params.ExampleApp); err != nil {
		t.Fatal(err)
	}
}
開發者ID:gdestuynder,項目名稱:deis,代碼行數:12,代碼來源:apps_test.go

示例7: appsRunTest

func appsRunTest(t *testing.T, params *itutils.DeisTestConfig) {
	cmd := itutils.GetCommand("apps", "run")
	if err := utils.Chdir(params.ExampleApp); err != nil {
		t.Fatalf("Failed:\n%v", err)
	}
	itutils.Execute(t, cmd, params, false, "")

	if err := utils.Chdir(".."); err != nil {
		t.Fatalf("Failed:\n%v", err)
	}
	itutils.Execute(t, cmd, params, true, "Could not find deis remote in `git remote -v`")
}
開發者ID:huslage,項目名稱:deis,代碼行數:12,代碼來源:apps_test.go

示例8: appsCreateTest

func appsCreateTest(t *testing.T, params *itutils.DeisTestConfig) {
	cmd := itutils.GetCommand("apps", "create")
	if err := utils.Chdir(params.ExampleApp); err != nil {
		t.Fatalf("Failed:\n%v", err)
	}
	itutils.Execute(t, cmd, params, false, "")
	itutils.Execute(t, cmd, params, true, "Deis remote already exists")

	if err := utils.Chdir(".."); err != nil {
		t.Fatalf("Failed:\n%v", err)
	}
}
開發者ID:huslage,項目名稱:deis,代碼行數:12,代碼來源:apps_test.go

示例9: AppsDestroyTest

func AppsDestroyTest(t *testing.T, params *DeisTestConfig) {
	cmd := GetCommand("apps", "destroy")
	if err := utils.Chdir(params.ExampleApp); err != nil {
		t.Fatalf("Failed:\n%v", err)
	}
	Execute(t, cmd, params, false, "")
	if err := utils.Chdir(".."); err != nil {
		t.Fatalf("Failed:\n%v", err)
	}
	if err := utils.Rmdir(params.ExampleApp); err != nil {
		t.Fatalf("Failed:\n%v", err)
	}
}
開發者ID:huslage,項目名稱:deis,代碼行數:13,代碼來源:itutils.go

示例10: appsLogsTest

func appsLogsTest(t *testing.T, params *itutils.DeisTestConfig) {
	cmd := itutils.GetCommand("apps", "logs")
	cmd1 := itutils.GetCommand("git", "push")
	itutils.Execute(t, cmd, params, true, "204 NO CONTENT")
	if err := utils.Chdir(params.ExampleApp); err != nil {
		t.Fatalf("Failed:\n%v", err)
	}
	itutils.Execute(t, cmd1, params, false, "")
	itutils.Execute(t, cmd, params, false, "")
	if err := utils.Chdir(".."); err != nil {
		t.Fatalf("Failed:\n%v", err)
	}
}
開發者ID:huslage,項目名稱:deis,代碼行數:13,代碼來源:apps_test.go

示例11: configPushTest

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)
	}
}
開發者ID:gpxl,項目名稱:deis,代碼行數:14,代碼來源:config_test.go

示例12: appsLogsTest

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.Curl(t, params)
	utils.Execute(t, cmd, params, false, "")
	if err := utils.Chdir(".."); err != nil {
		t.Fatal(err)
	}
}
開發者ID:fmd,項目名稱:deis,代碼行數:14,代碼來源:apps_test.go

示例13: psSetup

func psSetup(t *testing.T) *utils.DeisTestConfig {
	cfg := utils.GetGlobalConfig()
	cfg.AppName = "pssample"
	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, "")
	if err := utils.Chdir(".."); err != nil {
		t.Fatal(err)
	}
	return cfg
}
開發者ID:ericcapricorn,項目名稱:deis,代碼行數:15,代碼來源:ps_test.go

示例14: appsLogsTest

func appsLogsTest(t *testing.T, params *utils.DeisTestConfig) {
	cmd := appsLogsCmd
	utils.Execute(t, cmd, params, true, "204 NO CONTENT")
	if err := utils.Chdir(params.ExampleApp); err != nil {
		t.Fatal(err)
	}
	utils.Execute(t, gitPushCmd, params, false, "")
	// TODO: nginx needs a few seconds to wake up here--fixme!
	time.Sleep(5000 * time.Millisecond)
	utils.Curl(t, params)
	utils.Execute(t, cmd, params, false, "")
	if err := utils.Chdir(".."); err != nil {
		t.Fatal(err)
	}
}
開發者ID:netf,項目名稱:deis,代碼行數:15,代碼來源:apps_test.go

示例15: appsRunTest

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")
}
開發者ID:gdestuynder,項目名稱:deis,代碼行數:15,代碼來源:apps_test.go


注:本文中的github.com/deis/deis/tests/utils.Chdir函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。