本文整理汇总了Golang中github.com/deis/deis/tests/utils.Chdir函数的典型用法代码示例。如果您正苦于以下问题:Golang Chdir函数的具体用法?Golang Chdir怎么用?Golang Chdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Chdir函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: buildsCreateTest
// buildsCreateTest uses the `deis builds:create` (or `deis pull`) command
// to promote a build from an existing docker image.
func buildsCreateTest(t *testing.T, params *utils.DeisTestConfig) {
params.AppName = "deispullsample"
params.ImageID = "deis/example-go:latest"
params.ExampleApp = "example-deis-pull"
if err := os.Mkdir(params.ExampleApp, 0755); err != nil {
t.Fatal(err)
}
if err := utils.Chdir(params.ExampleApp); err != nil {
t.Fatal(err)
}
utils.Execute(t, appsCreateCmdNoRemote, params, false, "")
utils.Execute(t, buildsCreateCmd, params, false, "")
if err := utils.Chdir(".."); err != nil {
t.Fatal(err)
}
}
开发者ID:ericcapricorn,项目名称:deis,代码行数:18,代码来源:builds_test.go
示例17: buildSetup
func buildSetup(t *testing.T) *utils.DeisTestConfig {
cfg := utils.GetGlobalConfig()
cfg.AppName = "buildsample"
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.Execute(t, "git commit --allow-empty -m bump", cfg, false, "")
utils.Execute(t, gitPushCmd, cfg, false, "")
if err := utils.Chdir(".."); err != nil {
t.Fatal(err)
}
return cfg
}
开发者ID:ericcapricorn,项目名称:deis,代码行数:17,代码来源:builds_test.go
示例18: 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.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)
}
}
开发者ID:yun-an,项目名称:deis,代码行数:18,代码来源:apps_test.go
示例19: 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")
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
}
开发者ID:gdestuynder,项目名称:deis,代码行数:19,代码来源:config_test.go
示例20: appsCreateTest
func appsCreateTest(t *testing.T, params *utils.DeisTestConfig) {
wd, _ := os.Getwd()
defer os.Chdir(wd)
if err := utils.Chdir(params.ExampleApp); err != nil {
t.Fatal(err)
}
cmd := appsCreateCmd
utils.Execute(t, cmd, params, false, "")
utils.Execute(t, cmd, params, true, "App with this Id already exists")
}
开发者ID:ericcapricorn,项目名称:deis,代码行数:10,代码来源:apps_test.go
注:本文中的github.com/deis/deis/tests/utils.Chdir函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论