Example #1
0
			})
		})
	})

	Describe("UpdateAppRoutes", func() {
		It("updates the Routes", func() {
			desiredLRPs := []receptor.DesiredLRPResponse{
				{ProcessGuid: "americano-app"},
			}
			fakeReceptorClient.DesiredLRPsReturns(desiredLRPs, nil)
			expectedRouteOverrides := app_runner.RouteOverrides{
				{HostnamePrefix: "foo.com", Port: 8080},
				{HostnamePrefix: "bar.com", Port: 9090},
			}

			err := appRunner.UpdateAppRoutes("americano-app", expectedRouteOverrides)
			Expect(err).NotTo(HaveOccurred())

			Expect(fakeReceptorClient.UpdateDesiredLRPCallCount()).To(Equal(1))
			processGuid, updateRequest := fakeReceptorClient.UpdateDesiredLRPArgsForCall(0)
			Expect(processGuid).To(Equal("americano-app"))
			expectedRoutes := route_helpers.AppRoutes{
				{Hostnames: []string{"foo.com.myDiegoInstall.com"}, Port: 8080},
				{Hostnames: []string{"bar.com.myDiegoInstall.com"}, Port: 9090},
			}
			Expect(route_helpers.AppRoutesFromRoutingInfo(updateRequest.Routes)).To(ContainExactly(expectedRoutes))
		})

		Context("when an empty routes is passed", func() {
			It("deregisters the routes", func() {
				desiredLRPs := []receptor.DesiredLRPResponse{receptor.DesiredLRPResponse{ProcessGuid: "americano-app"}}