Beispiel #1
0
func initializeHandler(logger lager.Logger, noaaClient *noaa.Consumer, maxInFlight int, apiClient bbs.Client) http.Handler {
	apiHandler, err := handler.New(apiClient, noaaClient, maxInFlight, *bulkLRPStatusWorkers, logger)
	if err != nil {
		logger.Fatal("initialize-handler.failed", err)
	}

	return apiHandler
}
Beispiel #2
0
			fakeActualLRPResponses chan []*models.ActualLRPGroup
			statsRequest           *http.Request
			statusRequest          *http.Request
			httpClient             *http.Client
		)

		BeforeEach(func() {
			var err error
			var httpHandler http.Handler

			httpClient = &http.Client{}
			logger = lagertest.NewTestLogger("test")
			bbsClient = new(fake_bbs.FakeClient)
			noaaClient = &fakes.FakeNoaaClient{}

			httpHandler, err = handler.New(bbsClient, noaaClient, 2, 15, logger)
			Expect(err).NotTo(HaveOccurred())

			server = httptest.NewServer(httpHandler)

			fakeActualLRPResponses = make(chan []*models.ActualLRPGroup, 2)

			bbsClient.DesiredLRPByProcessGuidStub = func(string) (*models.DesiredLRP, error) {
				return &models.DesiredLRP{}, nil
			}

			bbsClient.ActualLRPGroupsByProcessGuidStub = func(string) ([]*models.ActualLRPGroup, error) {
				return <-fakeActualLRPResponses, nil
			}

			noaaClient.ContainerMetricsReturns([]*events.ContainerMetric{