예제 #1
0
				TaskDefinition: oldTaskDef,
			}

		})

		JustBeforeEach(func() {
			request := newTestRequest(requestBody)
			handler.DesireTask_r1(logger, responseRecorder, request)
		})

		Context("when the desire is successful", func() {
			It("upconverts the deprecated volume mounts", func() {
				expectedTaskDef := model_helpers.NewValidTaskDefinition()

				Expect(controller.DesireTaskCallCount()).To(Equal(1))
				_, actualTaskDef, _, _ := controller.DesireTaskArgsForCall(0)
				Expect(actualTaskDef.VolumeMounts).To(Equal(expectedTaskDef.VolumeMounts))
				Expect(actualTaskDef).To(Equal(expectedTaskDef))

				Expect(responseRecorder.Code).To(Equal(http.StatusOK))
				response := &models.TaskLifecycleResponse{}
				err := response.Unmarshal(responseRecorder.Body.Bytes())
				Expect(err).NotTo(HaveOccurred())

				Expect(response.Error).To(BeNil())
			})
		})
	})
})

// var _ = Describe("Task Handlers", func() {
예제 #2
0
			requestBody = &models.DesireTaskRequest{
				TaskGuid:       taskGuid,
				Domain:         domain,
				TaskDefinition: taskDef,
			}
		})

		JustBeforeEach(func() {
			request := newTestRequest(requestBody)
			handler.DesireTask(logger, responseRecorder, request)
		})

		Context("when the desire is successful", func() {
			It("desires the task with the requested definitions", func() {
				Expect(controller.DesireTaskCallCount()).To(Equal(1))
				_, actualTaskDef, actualTaskGuid, actualDomain := controller.DesireTaskArgsForCall(0)
				Expect(actualTaskDef).To(Equal(taskDef))
				Expect(actualTaskGuid).To(Equal(taskGuid))
				Expect(actualDomain).To(Equal(domain))

				Expect(responseRecorder.Code).To(Equal(http.StatusOK))
				response := &models.TaskLifecycleResponse{}
				err := response.Unmarshal(responseRecorder.Body.Bytes())
				Expect(err).NotTo(HaveOccurred())

				Expect(response.Error).To(BeNil())
			})
		})

		Context("when the controller returns an unrecoverable error", func() {
			BeforeEach(func() {