Exemplo n.º 1
0
			CPUWeight:  10,
			LogGuid:    "guid",
			LogSource:  "source-name",
			ResultFile: "result-file",
			Annotation: "some annotation",
			Privileged: true,
		}

		Context("when everything succeeds", func() {
			JustBeforeEach(func() {
				handler.Create(responseRecorder, newTestRequest(validCreateRequest))
			})

			It("calls DesireTask on the BBS with the correct task", func() {
				Expect(fakeBBS.DesireTaskCallCount()).To(Equal(1))
				_, task := fakeBBS.DesireTaskArgsForCall(0)
				Expect(task).To(Equal(expectedTask))
			})

			It("responds with 201 CREATED", func() {
				Expect(responseRecorder.Code).To(Equal(http.StatusCreated))
			})

			It("responds with an empty body", func() {
				Expect(responseRecorder.Body.String()).To(Equal(""))
			})

			Context("when env vars are specified", func() {
				BeforeEach(func() {
					validCreateRequest.EnvironmentVariables = []receptor.EnvironmentVariable{
						{Name: "var1", Value: "val1"},