コード例 #1
0
			It("responds with 202 Accepted", func() {
				Expect(responseRecorder.Code).To(Equal(http.StatusAccepted))
			})

			It("increments the desired LRPs counter", func() {
				Expect(metricSender.GetCounter("LRPsDesired")).To(Equal(uint64(1)))
			})
		})
	})

	Context("when desired LRP already exists", func() {
		var opaqueRoutingMessage json.RawMessage

		BeforeEach(func() {
			buildpackBuilder.ExtractExposedPortsStub = func(ccRequest *cc_messages.DesireAppRequestFromCC) ([]uint32, error) {
				return []uint32{8080}, nil
			}

			cfRoute := cfroutes.CFRoute{
				Hostnames: []string{"route1"},
				Port:      8080,
			}
			cfRoutePayload, err := json.Marshal(cfRoute)
			Expect(err).NotTo(HaveOccurred())

			cfRouteMessage := json.RawMessage(cfRoutePayload)
			opaqueRoutingMessage = json.RawMessage([]byte(`{"some": "value"}`))

			fakeBBS.DesiredLRPByProcessGuidReturns(&models.DesiredLRP{
				ProcessGuid: "some-guid",
				Routes: &models.Routes{
コード例 #2
0
			errors := make(chan error, 1)
			close(errors)

			return desired, errors
		}

		buildpackRecipeBuilder = new(fakes.FakeRecipeBuilder)
		buildpackRecipeBuilder.BuildStub = func(ccRequest *cc_messages.DesireAppRequestFromCC) (*models.DesiredLRP, error) {
			createRequest := models.DesiredLRP{
				ProcessGuid: ccRequest.ProcessGuid,
				Annotation:  ccRequest.ETag,
			}
			return &createRequest, nil
		}
		buildpackRecipeBuilder.ExtractExposedPortsStub = func(ccRequest *cc_messages.DesireAppRequestFromCC) ([]uint32, error) {
			return []uint32{8080}, nil
		}

		dockerRecipeBuilder = new(fakes.FakeRecipeBuilder)
		dockerRecipeBuilder.BuildStub = func(ccRequest *cc_messages.DesireAppRequestFromCC) (*models.DesiredLRP, error) {
			createRequest := models.DesiredLRP{
				ProcessGuid: ccRequest.ProcessGuid,
				Annotation:  ccRequest.ETag,
			}
			return &createRequest, nil
		}

		bbsClient = new(fake_bbs.FakeClient)
		bbsClient.DesiredLRPSchedulingInfosReturns(existingSchedulingInfos, nil)

		bbsClient.UpsertDomainStub = func(string, time.Duration) error {