本文整理匯總了Golang中github.com/cloudfoundry-incubator/cf-test-helpers/helpers.AppUri函數的典型用法代碼示例。如果您正苦於以下問題:Golang AppUri函數的具體用法?Golang AppUri怎麽用?Golang AppUri使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AppUri函數的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: configureBroker
func configureBroker(serviceBrokerAppName, routeServiceName string) {
brokerConfigJson := helpers.CurlApp(serviceBrokerAppName, "/config")
var brokerConfigMap customMap
err := json.Unmarshal([]byte(brokerConfigJson), &brokerConfigMap)
Expect(err).NotTo(HaveOccurred())
if routeServiceName != "" {
routeServiceUrl := helpers.AppUri(routeServiceName, "/")
url, err := url.Parse(routeServiceUrl)
Expect(err).NotTo(HaveOccurred())
url.Scheme = "https"
routeServiceUrl = url.String()
brokerConfigMap.key("behaviors").key("bind").key("default").key("body")["route_service_url"] = routeServiceUrl
} else {
body := brokerConfigMap.key("behaviors").key("bind").key("default").key("body")
delete(body, "route_service_url")
}
changedJson, err := json.Marshal(brokerConfigMap)
Expect(err).NotTo(HaveOccurred())
helpers.CurlApp(serviceBrokerAppName, "/config", "-X", "POST", "-d", string(changedJson))
}
示例2: createServiceBroker
func createServiceBroker() (string, string, string) {
serviceBrokerAsset := assets.NewAssets().ServiceBroker
serviceBrokerAppName := PushApp(serviceBrokerAsset, config.RubyBuildpackName)
serviceName := initiateBrokerConfig(serviceBrokerAppName)
brokerName := generator.PrefixedRandomName("RATS-BROKER-")
brokerUrl := helpers.AppUri(serviceBrokerAppName, "")
config = helpers.LoadConfig()
context := helpers.NewContext(config)
cf.AsUser(context.AdminUserContext(), context.ShortTimeout(), func() {
session := cf.Cf("create-service-broker", brokerName, "user", "password", brokerUrl)
Expect(session.Wait(DEFAULT_TIMEOUT)).To(Exit(0))
session = cf.Cf("enable-service-access", serviceName)
Expect(session.Wait(DEFAULT_TIMEOUT)).To(Exit(0))
})
return brokerName, serviceBrokerAppName, serviceName
}
示例3: Update
func (b ServiceBroker) Update() {
cf.AsUser(b.context.AdminUserContext(), DEFAULT_TIMEOUT, func() {
Expect(cf.Cf("update-service-broker", b.Name, "username", "password", helpers.AppUri(b.Name, "")).Wait(DEFAULT_TIMEOUT)).To(Exit(0))
})
}
示例4: Configure
func (b ServiceBroker) Configure() {
Expect(runner.Curl(helpers.AppUri(b.Name, "/config"), "-d", b.ToJSON()).Wait(DEFAULT_TIMEOUT)).To(Exit(0))
}
示例5:
broker.Push()
broker.Configure()
})
AfterEach(func() {
broker.Destroy()
})
It("can be created, viewed (in list), updated, and deleted by SpaceDevelopers", func() {
cf.AsUser(context.RegularUserContext(), context.ShortTimeout(), func() {
spaceCmd := cf.Cf("space", context.RegularUserContext().Space, "--guid").Wait(DEFAULT_TIMEOUT)
spaceGuid := string(spaceCmd.Out.Contents())
spaceGuid = strings.Trim(spaceGuid, "\n")
body := map[string]string{
"name": broker.Name,
"broker_url": helpers.AppUri(broker.Name, ""),
"auth_username": context.RegularUserContext().Username,
"auth_password": context.RegularUserContext().Password,
"space_guid": spaceGuid,
}
jsonBody, _ := json.Marshal(body)
By("Create")
createBrokerCommand := cf.Cf("curl", "/v2/service_brokers", "-X", "POST", "-d", string(jsonBody)).Wait(DEFAULT_TIMEOUT)
Expect(createBrokerCommand).To(Exit(0))
By("Read")
serviceBrokersCommand := cf.Cf("service-brokers").Wait(DEFAULT_TIMEOUT)
Expect(serviceBrokersCommand).To(Exit(0))
Expect(serviceBrokersCommand.Out.Contents()).To(ContainSubstring(broker.Name))
示例6:
Expect(cf.Cf("start", appName).Wait(CF_PUSH_TIMEOUT)).To(Exit(0))
})
AfterEach(func() {
cf.Cf("delete", appName, "-f").Wait(DEFAULT_TIMEOUT)
Expect(cf.Cf("delete-service", dbInstanceName, "-f").Wait(DEFAULT_TIMEOUT)).To(Exit(0))
// Poll until destruction is complete, otherwise the org cleanup (in AfterSuite) fails.
pollForRDSDeletionCompletion(dbInstanceName)
})
It("can connect to the DB instance from the app", func() {
By("Sending request to DB Healthcheck app")
resp, err := httpClient.Get(helpers.AppUri(appName, "/db"))
Expect(err).NotTo(HaveOccurred())
body, err := ioutil.ReadAll(resp.Body)
Expect(err).NotTo(HaveOccurred())
Expect(resp.StatusCode).To(Equal(200), "Got %d response from healthcheck app. Response body:\n%s\n", resp.StatusCode, string(body))
By("Sending request to DB Healthcheck app without TLS")
resp, err = httpClient.Get(helpers.AppUri(appName, "/db?ssl=false"))
Expect(err).NotTo(HaveOccurred())
body, err = ioutil.ReadAll(resp.Body)
Expect(err).NotTo(HaveOccurred())
Expect(resp.StatusCode).NotTo(Equal(200), "Got %d response from healthcheck app. Response body:\n%s\n", resp.StatusCode, string(body))
Expect(body).To(MatchRegexp("no pg_hba.conf entry for .* SSL off"), "Connection without TLS did not report a TLS error")
By("Testing permissions after unbind and rebind")
resp, err = httpClient.Get(helpers.AppUri(appName, "/db/permissions-check?phase=setup"))
示例7:
broker.Configure()
})
AfterEach(func() {
app_helpers.AppReport(broker.Name, Config.DefaultTimeoutDuration())
broker.Destroy()
})
It("can be created, viewed (in list), updated, and deleted by SpaceDevelopers", func() {
workflowhelpers.AsUser(TestSetup.RegularUserContext(), TestSetup.ShortTimeout(), func() {
spaceCmd := cf.Cf("space", TestSetup.RegularUserContext().Space, "--guid").Wait(Config.DefaultTimeoutDuration())
spaceGuid := string(spaceCmd.Out.Contents())
spaceGuid = strings.Trim(spaceGuid, "\n")
body := map[string]string{
"name": broker.Name,
"broker_url": helpers.AppUri(broker.Name, "", Config),
"auth_username": TestSetup.RegularUserContext().Username,
"auth_password": TestSetup.RegularUserContext().Password,
"space_guid": spaceGuid,
}
jsonBody, _ := json.Marshal(body)
By("Create")
createBrokerCommand := cf.Cf("curl", "/v2/service_brokers", "-X", "POST", "-d", string(jsonBody)).Wait(Config.DefaultTimeoutDuration())
Expect(createBrokerCommand).To(Exit(0))
By("Read")
serviceBrokersCommand := cf.Cf("service-brokers").Wait(Config.DefaultTimeoutDuration())
Expect(serviceBrokersCommand).To(Exit(0))
Expect(serviceBrokersCommand.Out.Contents()).To(ContainSubstring(broker.Name))
示例8: curlAppWithCookies
func curlAppWithCookies(appName, path string, cookieStorePath string) string {
uri := helpers.AppUri(appName, path)
curlCmd := runner.Curl(uri, "-b", cookieStorePath, "-c", cookieStorePath)
runner.NewCmdRunner(curlCmd, helpers.CURL_TIMEOUT).Run()
return string(curlCmd.Out.Contents())
}
示例9: Update
func (b ServiceBroker) Update() {
workflowhelpers.AsUser(b.TestSetup.AdminUserContext(), Config.DefaultTimeoutDuration(), func() {
Expect(cf.Cf("update-service-broker", b.Name, "username", "password", helpers.AppUri(b.Name, "", Config)).Wait(Config.DefaultTimeoutDuration())).To(Exit(0))
})
}
示例10: CreateSpaceScoped
func (b ServiceBroker) CreateSpaceScoped() {
workflowhelpers.AsUser(b.TestSetup.RegularUserContext(), Config.DefaultTimeoutDuration(), func() {
Expect(cf.Cf("create-service-broker", b.Name, "username", "password", helpers.AppUri(b.Name, "", Config), "--space-scoped").Wait(Config.DefaultTimeoutDuration())).To(Exit(0))
Expect(cf.Cf("service-brokers").Wait(Config.DefaultTimeoutDuration())).To(Say(b.Name))
})
}
示例11: Configure
func (b ServiceBroker) Configure() {
Expect(helpers.Curl(Config, helpers.AppUri(b.Name, "/config", Config), "-d", b.ToJSON()).Wait(Config.DefaultTimeoutDuration())).To(Exit(0))
}