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))
		})
	})
})
		AfterEach(func() {
			AppReport(appName, Config.DefaultTimeoutDuration())
			DeleteApp(appName, Config.DefaultTimeoutDuration())
		})

		Context("when an app has multiple instances", func() {
			BeforeEach(func() {
				ScaleAppInstances(appName, 3, Config.CfPushTimeoutDuration())
			})

			Context("when the client does not send VCAP_ID and JSESSION cookies", func() {
				It("routes requests round robin to all instances", func() {
					var body string

					Eventually(func() string {
						body = helpers.CurlAppRoot(Config, appName)
						return body
					}, Config.DefaultTimeoutDuration()).Should(ContainSubstring(fmt.Sprintf("Hello, %s", appName)))

					indexPre := parseInstanceIndex(body)

					Eventually(func() int {
						body := helpers.CurlAppRoot(Config, appName)
						index := parseInstanceIndex(body)
						return index
					}, Config.DefaultTimeoutDuration()).ShouldNot(Equal(indexPre))
				})
			})
		})
	})
			})

			AfterEach(func() {
				AppReport(appName, Config.DefaultTimeoutDuration())
				AppReport(routeServiceName, Config.DefaultTimeoutDuration())

				unbindRouteFromService(appName, serviceInstanceName)
				deleteServiceInstance(serviceInstanceName)
				deleteServiceBroker(brokerName)
				DeleteApp(appName, Config.DefaultTimeoutDuration())
				DeleteApp(routeServiceName, Config.DefaultTimeoutDuration())
			})

			It("a request to the app is routed through the route service", func() {
				Eventually(func() *Session {
					helpers.CurlAppRoot(Config, appName)
					logs := cf.Cf("logs", "--recent", routeServiceName)
					Expect(logs.Wait(Config.DefaultTimeoutDuration())).To(Exit(0))
					return logs
				}, Config.DefaultTimeoutDuration()).Should(Say("Response Body: go, world"))
			})
		})

		Context("when service broker does not return a route service url", func() {
			var (
				serviceInstanceName string
				brokerName          string
				appName             string
				golangAsset         = assets.NewAssets().Golang
			)