本文整理匯總了Golang中cf.Application.Routes方法的典型用法代碼示例。如果您正苦於以下問題:Golang Application.Routes方法的具體用法?Golang Application.Routes怎麽用?Golang Application.Routes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cf.Application
的用法示例。
在下文中一共展示了Application.Routes方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestPushingAppWhenItAlreadyExistsAndHostIsSpecified
func TestPushingAppWhenItAlreadyExistsAndHostIsSpecified(t *testing.T) {
deps := getPushDependencies()
domain := cf.Domain{}
domain.Name = "example.com"
domain.Guid = "domain-guid"
domain.Shared = true
existingRoute := cf.RouteSummary{}
existingRoute.Host = "existing-app"
existingRoute.Domain = domain.DomainFields
existingApp := cf.Application{}
existingApp.Name = "existing-app"
existingApp.Guid = "existing-app-guid"
existingApp.Routes = []cf.RouteSummary{existingRoute}
deps.appRepo.ReadApp = existingApp
deps.appRepo.UpdateAppResult = existingApp
deps.routeRepo.FindByHostAndDomainNotFound = true
deps.domainRepo.ListSharedDomainsDomains = []cf.Domain{domain}
ui := callPush(t, []string{"-n", "new-host", "existing-app"}, deps)
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Creating route", "new-host.example.com"},
{"OK"},
{"Binding", "new-host.example.com"},
})
assert.Equal(t, deps.routeRepo.FindByHostAndDomainDomain, "example.com")
assert.Equal(t, deps.routeRepo.FindByHostAndDomainHost, "new-host")
assert.Equal(t, deps.routeRepo.CreatedHost, "new-host")
assert.Equal(t, deps.routeRepo.CreatedDomainGuid, "domain-guid")
}
示例2: TestPushingAppWithNoFlagsWhenAppIsAlreadyBoundToDomain
func TestPushingAppWithNoFlagsWhenAppIsAlreadyBoundToDomain(t *testing.T) {
deps := getPushDependencies()
domain := cf.DomainFields{}
domain.Name = "example.com"
existingRoute := cf.RouteSummary{}
existingRoute.Host = "foo"
existingRoute.Domain = domain
existingApp := cf.Application{}
existingApp.Name = "existing-app"
existingApp.Guid = "existing-app-guid"
existingApp.Routes = []cf.RouteSummary{existingRoute}
deps.appRepo.ReadApp = existingApp
deps.appRepo.UpdateAppResult = existingApp
_ = callPush(t, []string{"existing-app"}, deps)
assert.Equal(t, deps.appBitsRepo.UploadedAppGuid, "existing-app-guid")
assert.Equal(t, deps.domainRepo.FindByNameInCurrentSpaceName, "")
assert.Equal(t, deps.routeRepo.FindByHostAndDomainDomain, "")
assert.Equal(t, deps.routeRepo.FindByHostAndDomainHost, "")
assert.Equal(t, deps.routeRepo.CreatedHost, "")
assert.Equal(t, deps.routeRepo.CreatedDomainGuid, "")
}
示例3: TestPushingAppWhenItAlreadyExistsAndDomainIsSpecifiedIsAlreadyBound
func TestPushingAppWhenItAlreadyExistsAndDomainIsSpecifiedIsAlreadyBound(t *testing.T) {
deps := getPushDependencies()
domain := cf.DomainFields{}
domain.Name = "example.com"
domain.Guid = "domain-guid"
existingRoute := cf.RouteSummary{}
existingRoute.Host = "existing-app"
existingRoute.Domain = domain
existingApp := cf.Application{}
existingApp.Name = "existing-app"
existingApp.Guid = "existing-app-guid"
existingApp.Routes = []cf.RouteSummary{existingRoute}
foundRoute := cf.Route{}
foundRoute.RouteFields = existingRoute.RouteFields
foundRoute.Domain = existingRoute.Domain
deps.appRepo.ReadApp = existingApp
deps.appRepo.UpdateAppResult = existingApp
deps.routeRepo.FindByHostAndDomainRoute = foundRoute
ui := callPush(t, []string{"-d", "example.com", "existing-app"}, deps)
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Using route", "existing-app", "example.com"},
})
assert.Equal(t, deps.appBitsRepo.UploadedAppGuid, "existing-app-guid")
}
示例4: TestPushingAppWhenItAlreadyExistsAndChangingOptions
func TestPushingAppWhenItAlreadyExistsAndChangingOptions(t *testing.T) {
deps := getPushDependencies()
existingRoute := cf.RouteSummary{}
existingRoute.Host = "existing-app"
existingApp := cf.Application{}
existingApp.Name = "existing-app"
existingApp.Guid = "existing-app-guid"
existingApp.Routes = []cf.RouteSummary{existingRoute}
deps.appRepo.ReadApp = existingApp
stack := cf.Stack{}
stack.Name = "differentStack"
stack.Guid = "differentStack-guid"
deps.stackRepo.FindByNameStack = stack
args := []string{
"-c", "different start command",
"-i", "10",
"-m", "1G",
"-b", "https://github.com/heroku/heroku-buildpack-different.git",
"-s", "differentStack",
"existing-app",
}
_ = callPush(t, args, deps)
assert.Equal(t, deps.appRepo.UpdateParams.Get("command"), "different start command")
assert.Equal(t, deps.appRepo.UpdateParams.Get("instances"), 10)
assert.Equal(t, deps.appRepo.UpdateParams.Get("memory"), uint64(1024))
assert.Equal(t, deps.appRepo.UpdateParams.Get("buildpack"), "https://github.com/heroku/heroku-buildpack-different.git")
assert.Equal(t, deps.appRepo.UpdateParams.Get("stack_guid"), "differentStack-guid")
}
示例5: TestPushingAppWhenItAlreadyExistsAndDomainSpecifiedIsNotBound
func TestPushingAppWhenItAlreadyExistsAndDomainSpecifiedIsNotBound(t *testing.T) {
deps := getPushDependencies()
domain := cf.DomainFields{}
domain.Name = "example.com"
existingRoute := cf.RouteSummary{}
existingRoute.Host = "existing-app"
existingRoute.Domain = domain
existingApp := cf.Application{}
existingApp.Name = "existing-app"
existingApp.Guid = "existing-app-guid"
existingApp.Routes = []cf.RouteSummary{existingRoute}
foundDomain := cf.Domain{}
foundDomain.Guid = "domain-guid"
foundDomain.Name = "newdomain.com"
deps.appRepo.ReadApp = existingApp
deps.appRepo.UpdateAppResult = existingApp
deps.routeRepo.FindByHostAndDomainNotFound = true
deps.domainRepo.FindByNameDomain = foundDomain
ui := callPush(t, []string{"-d", "newdomain.com", "existing-app"}, deps)
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Creating route", "existing-app.newdomain.com"},
{"OK"},
{"Binding", "existing-app.newdomain.com"},
})
assert.Equal(t, deps.appBitsRepo.UploadedAppGuid, "existing-app-guid")
assert.Equal(t, deps.domainRepo.FindByNameInCurrentSpaceName, "newdomain.com")
assert.Equal(t, deps.routeRepo.FindByHostAndDomainDomain, "newdomain.com")
assert.Equal(t, deps.routeRepo.FindByHostAndDomainHost, "existing-app")
assert.Equal(t, deps.routeRepo.CreatedHost, "existing-app")
assert.Equal(t, deps.routeRepo.CreatedDomainGuid, "domain-guid")
}