func configureBroker(serviceBrokerAppName, routeServiceName string) { brokerConfigJson := helpers.CurlApp(Config, serviceBrokerAppName, "/config") var brokerConfigMap customMap err := json.Unmarshal([]byte(brokerConfigJson), &brokerConfigMap) Expect(err).NotTo(HaveOccurred()) if routeServiceName != "" { routeServiceUrl := helpers.AppUri(routeServiceName, "/", Config) 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(Config, serviceBrokerAppName, "/config", "-X", "POST", "-d", string(changedJson)) }
func createServiceBroker(brokerName, brokerAppName, serviceName string) { serviceBrokerAsset := assets.NewAssets().ServiceBroker PushApp(brokerAppName, serviceBrokerAsset, Config.GetRubyBuildpackName(), Config.GetAppsDomain(), Config.CfPushTimeoutDuration(), DEFAULT_MEMORY_LIMIT) initiateBrokerConfig(serviceName, brokerAppName) brokerUrl := helpers.AppUri(brokerAppName, "", Config) workflowhelpers.AsUser(TestSetup.AdminUserContext(), TestSetup.ShortTimeout(), func() { session := cf.Cf("create-service-broker", brokerName, "user", "password", brokerUrl) Expect(session.Wait(Config.DefaultTimeoutDuration())).To(Exit(0)) session = cf.Cf("enable-service-access", serviceName) Expect(session.Wait(Config.DefaultTimeoutDuration())).To(Exit(0)) }) }
func curlAppWithCookies(appName, path string, cookieStorePath string) string { uri := helpers.AppUri(appName, path, Config) curlCmd := helpers.Curl(Config, uri, "-b", cookieStorePath, "-c", cookieStorePath).Wait(helpers.CURL_TIMEOUT) Expect(curlCmd).To(gexec.Exit(0)) return string(curlCmd.Out.Contents()) }