}.CCRouteInfo()
					Expect(err).NotTo(HaveOccurred())
					desiredAppReq.RoutingInfo = routingInfo
				})

				It("exposes all encountered tcp ports", func() {
					parallelRunAction := desiredLRP.Action.CodependentAction
					Expect(parallelRunAction.Actions).To(HaveLen(1))

					runAction := parallelRunAction.Actions[0].RunAction

					httpRoutes := cfroutes.CFRoutes{
						{Hostnames: []string{"route1"}, Port: 8081},
						{Hostnames: []string{"route2"}, Port: 8082},
					}
					test_helpers.VerifyHttpRoutes(*desiredLRP.Routes, httpRoutes)

					Expect(desiredLRP.Ports).To(Equal([]uint32{8081, 8082}))

					Expect(desiredLRP.Monitor.GetValue()).To(Equal(models.Timeout(
						&models.ParallelAction{
							Actions: []*models.Action{
								&models.Action{
									RunAction: &models.RunAction{
										User:      "******",
										Path:      "/tmp/lifecycle/healthcheck",
										Args:      []string{"-port=8081"},
										LogSource: "HEALTH",
										ResourceLimits: &models.ResourceLimits{
											Nofile: &defaultNofile,
										},
Exemplo n.º 2
0
				routeInfo, err := cc_messages.CCHTTPRoutes{
					{Hostname: "route1"},
					{Hostname: "route2", RouteServiceUrl: "https://rs.example.com"},
					{Hostname: "route3", Port: 8080},
				}.CCRouteInfo()
				Expect(err).NotTo(HaveOccurred())

				routes, err := helpers.CCRouteInfoToRoutes(routeInfo, []uint32{8080})
				Expect(err).NotTo(HaveOccurred())

				expectedCfRoutes := cfroutes.CFRoutes{
					{Hostnames: []string{"route1", "route3"}, Port: 8080},
					{Hostnames: []string{"route2"}, Port: 8080, RouteServiceUrl: "https://rs.example.com"},
				}

				test_helpers.VerifyHttpRoutes(routes, expectedCfRoutes)
				Expect(routes).To(HaveLen(1))
			})
		})

		Context("when there are only tcp routes", func() {
			It("can convert itself into a Routes structure", func() {
				routeInfo, err := cc_messages.CCTCPRoutes{
					{RouterGroupGuid: "guid-1", ExternalPort: 5222, ContainerPort: 5222},
					{RouterGroupGuid: "guid-2", ExternalPort: 1883, ContainerPort: 6000},
				}.CCRouteInfo()
				Expect(err).NotTo(HaveOccurred())

				routes, err := helpers.CCRouteInfoToRoutes(routeInfo, []uint32{5222, 6000})
				Expect(err).NotTo(HaveOccurred())