本文整理汇总了Golang中github.com/convox/rack/test.Runs函数的典型用法代码示例。如果您正苦于以下问题:Golang Runs函数的具体用法?Golang Runs怎么用?Golang Runs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Runs函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestConvoxInstallSTDINCredentials
func TestConvoxInstallSTDINCredentials(t *testing.T) {
stackId := "arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83"
cycles := []awsutil.Cycle{
awsutil.Cycle{
awsutil.Request{"/", "", "/./"},
awsutil.Response{200, `<CreateStackResult><StackId>` + stackId + `</StackId></CreateStackResult>`},
},
awsutil.Cycle{
awsutil.Request{"/", "", ""},
awsutil.Response{200, ""},
},
}
handler := awsutil.NewHandler(cycles)
s := httptest.NewServer(handler)
defaults.DefaultConfig.Endpoint = &s.URL
defer s.Close()
latest, _ := version.Latest()
test.Runs(t,
test.ExecRun{
Command: "convox install",
Exit: 0,
Env: map[string]string{"AWS_ENDPOINT_URL": s.URL, "AWS_REGION": "test"},
Stdin: `{"Credentials":{"AccessKeyId":"FOO","SecretAccessKey":"BAR","Expiration":"2015-09-17T14:09:41Z"}}`,
Stdout: Banner + "\nInstalling Convox (" + latest + ")...\n" + stackId + "\n",
},
)
}
开发者ID:anthonyrisinger,项目名称:rack,代码行数:31,代码来源:install_test.go
示例2: TestRackUpdateStable
func TestRackUpdateStable(t *testing.T) {
versions, err := version.All()
require.Nil(t, err)
stable, err := versions.Resolve("stable")
require.Nil(t, err)
ts := testServer(t,
test.Http{Method: "PUT", Body: fmt.Sprintf("version=%s", stable.Version), Path: "/system", Code: 200, Response: client.System{
Name: "mysystem",
Version: "ver",
Count: 1,
Type: "type",
}},
)
defer ts.Close()
test.Runs(t,
test.ExecRun{
Command: "convox rack update",
Exit: 0,
Stdout: fmt.Sprintf("Name mysystem\nStatus \nVersion ver\nCount 1\nType type\n\nUpdating to version: %s\n", stable.Version),
},
)
}
开发者ID:gmelika,项目名称:rack,代码行数:26,代码来源:rack_test.go
示例3: TestInvalidLogin
func TestInvalidLogin(t *testing.T) {
temp, _ := ioutil.TempDir("", "convox-test")
ts := testServer(t,
test.Http{Method: "GET", Path: "/apps", Code: 401, Response: "unauthorized"},
test.Http{Method: "GET", Path: "/auth", Code: 404, Response: "not found"},
)
defer ts.Close()
test.Runs(t,
test.ExecRun{
Command: fmt.Sprintf("convox login --password foobar %s", ts.URL),
Env: map[string]string{"CONVOX_CONFIG": temp},
Exit: 1,
Stderr: "ERROR: invalid login\nHave you created an account at https://convox.com/signup?\n",
},
test.ExecRun{
Command: "convox login --password foobar BAD",
Env: map[string]string{"CONVOX_CONFIG": temp},
Exit: 1,
Stderr: "ERROR",
},
)
}
开发者ID:convox,项目名称:rack,代码行数:25,代码来源:login_test.go
示例4: TestApiGet
func TestApiGet(t *testing.T) {
ts := testServer(t,
test.Http{Method: "GET", Path: "/foo", Code: 200, Response: "bar"},
)
defer ts.Close()
test.Runs(t,
test.ExecRun{
Command: "convox api get /foo",
Exit: 0,
Stdout: "\"bar\"\n",
},
)
}
开发者ID:gmelika,项目名称:rack,代码行数:14,代码来源:api_test.go
示例5: TestServicesCreate
func TestServicesCreate(t *testing.T) {
ts := testServer(t,
test.Http{Method: "POST", Path: "/services", Body: "name=syslog-1234&type=syslog&url=tcp%2Btls%3A%2F%2Flogs1.example.com%3A12345", Code: 200, Response: client.Service{}},
)
defer ts.Close()
test.Runs(t,
test.ExecRun{
Command: "convox services create syslog --name=syslog-1234 --url=tcp+tls://logs1.example.com:12345",
Exit: 0,
Stdout: "Creating syslog-1234 (syslog: name=\"syslog-1234\" url=\"tcp+tls://logs1.example.com:12345\")... CREATING\n",
},
)
}
开发者ID:convox,项目名称:rack,代码行数:15,代码来源:services_test.go
示例6: TestServicesDelete
func TestServicesDelete(t *testing.T) {
tsd := testServer(t,
test.Http{Method: "DELETE", Path: "/services/syslog-1234", Code: 200, Response: client.Service{}},
)
defer tsd.Close()
test.Runs(t,
test.ExecRun{
Command: "convox services delete syslog-1234",
Exit: 0,
Stdout: "Deleting syslog-1234... DELETING\n",
},
)
}
开发者ID:convox,项目名称:rack,代码行数:15,代码来源:services_test.go
示例7: TestAppsCreate
func TestAppsCreate(t *testing.T) {
ts := testServer(t,
test.Http{Method: "POST", Path: "/apps", Code: 200, Response: client.App{}},
)
defer ts.Close()
test.Runs(t,
test.ExecRun{
Command: "convox apps create foobar",
Exit: 0,
Stdout: "Creating app foobar... CREATING\n",
},
)
}
开发者ID:jbuck,项目名称:rack,代码行数:15,代码来源:apps_test.go
示例8: TestAppsCreateFail
func TestAppsCreateFail(t *testing.T) {
ts := testServer(t,
test.Http{Method: "POST", Path: "/apps", Code: 403, Response: client.Error{Error: "app already exists"}},
)
defer ts.Close()
test.Runs(t,
test.ExecRun{
Command: "convox apps create foobar",
Exit: 1,
Stdout: "Creating app foobar... ",
Stderr: "ERROR: app already exists\n",
},
)
}
开发者ID:jbuck,项目名称:rack,代码行数:16,代码来源:apps_test.go
示例9: TestDeployPreventAgainstCreating
func TestDeployPreventAgainstCreating(t *testing.T) {
ts := testServer(t,
test.Http{Method: "GET", Path: "/apps/foo", Code: 200, Response: client.App{Name: "foo", Status: "creating"}},
)
defer ts.Close()
test.Runs(t,
test.ExecRun{
Command: "convox deploy --app foo",
Exit: 1,
Stdout: "Deploying foo\n",
Stderr: "ERROR: app is still creating: foo\n",
},
)
}
开发者ID:anthonyrisinger,项目名称:rack,代码行数:16,代码来源:deploy_test.go
示例10: TestConvoxInstallValidateStackName
func TestConvoxInstallValidateStackName(t *testing.T) {
stackId := "arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83"
cycles := []awsutil.Cycle{
awsutil.Cycle{
awsutil.Request{"/", "", "/./"},
awsutil.Response{200, `<CreateStackResult><StackId>` + stackId + `</StackId></CreateStackResult>`},
},
awsutil.Cycle{
awsutil.Request{"/", "", ""},
awsutil.Response{200, ""},
},
}
handler := awsutil.NewHandler(cycles)
s := httptest.NewServer(handler)
defer s.Close()
os.Setenv("AWS_ENDPOINT", s.URL)
latest, _ := version.Latest()
test.Runs(t,
test.ExecRun{
Command: "convox install --stack-name valid",
Exit: 0,
Env: map[string]string{"AWS_ENDPOINT_URL": s.URL, "AWS_REGION": "test"},
Stdin: `{"Credentials":{"AccessKeyId":"FOO","SecretAccessKey":"BAR","Expiration":"2015-09-17T14:09:41Z"}}`,
Stdout: Banner + "\nInstalling Convox (" + latest + ")...\n" + stackId + "\n",
},
test.ExecRun{
Command: "convox install --stack-name Invalid",
Exit: 1,
Env: map[string]string{"AWS_ENDPOINT_URL": s.URL, "AWS_REGION": "test"},
Stdin: `{"Credentials":{"AccessKeyId":"FOO","SecretAccessKey":"BAR","Expiration":"2015-09-17T14:09:41Z"}}`,
Stderr: `ERROR: Stack name is invalid, must match [a-z0-9-]*`,
},
test.ExecRun{
Command: "convox install --stack-name in_valid",
Exit: 1,
Env: map[string]string{"AWS_ENDPOINT_URL": s.URL, "AWS_REGION": "test"},
Stdin: `{"Credentials":{"AccessKeyId":"FOO","SecretAccessKey":"BAR","Expiration":"2015-09-17T14:09:41Z"}}`,
Stderr: `ERROR: Stack name is invalid, must match [a-z0-9-]*`,
},
)
}
开发者ID:cleblanc87,项目名称:rack,代码行数:47,代码来源:install_test.go
示例11: TestServices
func TestServices(t *testing.T) {
ts := testServer(t,
test.Http{Method: "GET", Path: "/services", Code: 200, Response: client.Services{
client.Service{Name: "syslog-1234", Type: "syslog", Status: "running"},
}},
)
defer ts.Close()
test.Runs(t,
test.ExecRun{
Command: "convox services",
Exit: 0,
Stdout: "NAME TYPE STATUS\nsyslog-1234 syslog running\n",
},
)
}
开发者ID:convox,项目名称:rack,代码行数:17,代码来源:services_test.go
示例12: TestBuildsCreateReturnsNoBuild
func TestBuildsCreateReturnsNoBuild(t *testing.T) {
ts := testServer(t,
test.Http{Method: "GET", Path: "/apps/foo", Code: 200, Response: client.App{Name: "foo", Status: "running"}},
test.Http{Method: "POST", Path: "/apps/foo/builds", Body: "repo=https%3A%2F%2Fexample.org", Code: 200, Response: client.Build{}},
)
defer ts.Close()
test.Runs(t,
test.ExecRun{
Command: "convox build https://example.org --app foo",
Exit: 1,
Stdout: "",
Stderr: "ERROR: unable to fetch build id\n",
},
)
}
开发者ID:nicolas-brousse,项目名称:rack,代码行数:17,代码来源:builds_test.go
示例13: TestApps
func TestApps(t *testing.T) {
ts := testServer(t,
test.Http{Method: "GET", Path: "/apps", Code: 200, Response: client.Apps{
client.App{Name: "sinatra", Status: "running"},
}},
)
defer ts.Close()
test.Runs(t,
test.ExecRun{
Command: "convox apps",
Exit: 0,
Stdout: "APP STATUS \nsinatra running\n",
},
)
}
开发者ID:jbuck,项目名称:rack,代码行数:17,代码来源:apps_test.go
示例14: TestLogin
func TestLogin(t *testing.T) {
temp, _ := ioutil.TempDir("", "convox-test")
ts := testServer(t,
test.Http{Method: "GET", Path: "/apps", Code: 200, Response: client.Apps{}},
)
defer ts.Close()
test.Runs(t,
test.ExecRun{
Command: fmt.Sprintf("convox login --password foobar %s", ts.URL),
Env: map[string]string{"CONVOX_CONFIG": temp},
Exit: 0,
Stdout: "Logged in successfully.\n",
},
)
}
开发者ID:convox,项目名称:rack,代码行数:18,代码来源:login_test.go
示例15: TestStartWithMapEnv
func TestStartWithMapEnv(t *testing.T) {
temp, _ := ioutil.TempDir("", "convox-test")
appDir := temp + "/app"
os.Mkdir(appDir, 0777)
defer os.RemoveAll(appDir)
d1 := []byte(manifestMapEnv)
ioutil.WriteFile(appDir+"/docker-compose.yml", d1, 0777)
test.Runs(t,
test.ExecRun{
Command: fmt.Sprintf("convox start"),
Dir: appDir,
Env: map[string]string{"CONVOX_CONFIG": temp},
OutMatch: "docker run",
Exit: 0,
},
)
}
开发者ID:soulware,项目名称:rack,代码行数:19,代码来源:start_test.go
示例16: TestStartWithMissingEnv
func TestStartWithMissingEnv(t *testing.T) {
temp, _ := ioutil.TempDir("", "convox-test")
appDir := temp + "/app"
os.Mkdir(appDir, 0777)
defer os.RemoveAll(appDir)
d1 := []byte(manifestRequired)
ioutil.WriteFile(appDir+"/docker-compose.yml", d1, 0777)
test.Runs(t,
test.ExecRun{
Command: fmt.Sprintf("convox start"),
Dir: appDir,
Env: map[string]string{"CONVOX_CONFIG": temp},
Exit: 1,
Stderr: "ERROR: env expected: FOO",
},
)
}
开发者ID:soulware,项目名称:rack,代码行数:19,代码来源:start_test.go
示例17: TestRackUpdateSpecified
func TestRackUpdateSpecified(t *testing.T) {
ts := testServer(t,
test.Http{Method: "PUT", Body: "version=20150909014908", Path: "/system", Code: 200, Response: client.System{
Name: "mysystem",
Version: "ver",
Count: 1,
Type: "type",
}},
)
defer ts.Close()
test.Runs(t,
test.ExecRun{
Command: "convox rack update 20150909014908",
Exit: 0,
Stdout: "Name mysystem\nStatus \nVersion ver\nCount 1\nType type\n\nUpdating to version: 20150909014908\n",
},
)
}
开发者ID:gmelika,项目名称:rack,代码行数:20,代码来源:rack_test.go
注:本文中的github.com/convox/rack/test.Runs函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论