コード例 #1
0
						stagingTask := &models.Task{
							TaskGuid:       "a-staging-guid",
							TaskDefinition: &models.TaskDefinition{Annotation: `"fake-backend"}`},
						}

						fakeDiegoClient.TaskByGuidReturns(stagingTask, nil)
					})

					It("returns StatusInternalServerError", func() {
						Expect(responseRecorder.Code).To(Equal(http.StatusInternalServerError))
					})
				})

				It("increments the counter to track arriving stop staging messages", func() {
					Expect(fakeMetricSender.GetCounter("StagingStopRequestsReceived")).To(Equal(uint64(1)))
				})

				It("cancels the Diego task", func() {
					Expect(fakeDiegoClient.CancelTaskCallCount()).To(Equal(1))
					Expect(fakeDiegoClient.CancelTaskArgsForCall(0)).To(Equal("a-staging-guid"))
				})

				It("returns an Accepted response", func() {
					Expect(responseRecorder.Code).To(Equal(http.StatusAccepted))
				})

			})
		})
	})
})