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 initiateBrokerConfig(serviceName, serviceBrokerAppName string) {
	brokerConfigJson := helpers.CurlApp(Config, serviceBrokerAppName, "/config")

	var brokerConfigMap customMap

	err := json.Unmarshal([]byte(brokerConfigJson), &brokerConfigMap)
	Expect(err).NotTo(HaveOccurred())

	dashboardClientId := random_name.CATSRandomName("DASHBOARD-ID")
	serviceId := random_name.CATSRandomName("SVC-ID")

	services := brokerConfigMap.key("behaviors").key("catalog").key("body")["services"].([]interface{})
	service := services[0].(map[string]interface{})
	service["dashboard_client"].(map[string]interface{})["id"] = dashboardClientId
	service["name"] = serviceName
	service["id"] = serviceId

	plans := service["plans"].([]interface{})

	for i, plan := range plans {
		servicePlanId := random_name.CATSRandomName(fmt.Sprintf("SVC-PLAN-ID-%d-", i))
		plan.(map[string]interface{})["id"] = servicePlanId
	}

	changedJson, err := json.Marshal(brokerConfigMap)
	Expect(err).NotTo(HaveOccurred())

	helpers.CurlApp(Config, serviceBrokerAppName, "/config", "-X", "POST", "-d", string(changedJson))
}
		MapRouteToApp(app2, domain, hostname, app2Path, Config.DefaultTimeoutDuration())
		MapRouteToApp(app3, domain, hostname, app3Path, Config.DefaultTimeoutDuration())
	})

	AfterEach(func() {
		AppReport(app1, Config.DefaultTimeoutDuration())
		AppReport(app2, Config.DefaultTimeoutDuration())
		AppReport(app3, Config.DefaultTimeoutDuration())

		DeleteApp(app1, Config.DefaultTimeoutDuration())
		DeleteApp(app2, Config.DefaultTimeoutDuration())
		DeleteApp(app3, Config.DefaultTimeoutDuration())
	})

	Context("when another app has a route with a context path", func() {
		It("routes to app with context path", func() {
			Eventually(func() string {
				return helpers.CurlAppRoot(Config, hostname)
			}, Config.DefaultTimeoutDuration()).Should(ContainSubstring(app1))

			Eventually(func() string {
				return helpers.CurlApp(Config, hostname, app2Path)
			}, Config.DefaultTimeoutDuration()).Should(ContainSubstring(app2))

			Eventually(func() string {
				return helpers.CurlApp(Config, hostname, app3Path)
			}, Config.DefaultTimeoutDuration()).Should(ContainSubstring(app3))
		})
	})
})
		PushAppNoStart(app, latticeAppAsset, Config.GetGoBuildpackName(), Config.GetAppsDomain(), Config.CfPushTimeoutDuration(), DEFAULT_MEMORY_LIMIT, "-c", cmd)
		EnableDiego(app, Config.DefaultTimeoutDuration())
		StartApp(app, APP_START_TIMEOUT)
	})

	AfterEach(func() {
		AppReport(app, Config.DefaultTimeoutDuration())
		DeleteApp(app, Config.DefaultTimeoutDuration())
	})

	Context("when app only has single route", func() {
		Context("when no ports are specified for the app", func() {
			It("should listen on the default app port", func() {
				Eventually(func() string {
					return helpers.CurlApp(Config, app, "/port")
				}, Config.DefaultTimeoutDuration(), "5s").Should(ContainSubstring("8080"))
			})
		})
	})

	Context("when app has multiple ports mapped", func() {
		BeforeEach(func() {
			UpdatePorts(app, []uint16{7777, 8888, 8080}, Config.DefaultTimeoutDuration())
			// create 2nd route
			spacename := TestSetup.RegularUserContext().Space
			secondRoute = fmt.Sprintf("%s-two", app)
			CreateRoute(secondRoute, "", spacename, Config.GetAppsDomain(), Config.DefaultTimeoutDuration())

			// map app route to other port
			CreateRouteMapping(app, secondRoute, 0, 7777, Config.DefaultTimeoutDuration())