})
		})

		Context("when the bbs fails with a Conflict error", func() {
			BeforeEach(func() {
				fakeBBS.DesireLRPStub = func(_ *models.DesiredLRP) error {
					fakeBBS.DesiredLRPByProcessGuidReturns(&models.DesiredLRP{
						ProcessGuid: "some-guid",
					}, nil)
					return models.ErrResourceExists
				}
			})

			It("retries", func() {
				Expect(fakeBBS.DesireLRPCallCount()).To(Equal(1))
				Expect(fakeBBS.UpdateDesiredLRPCallCount()).To(Equal(1))
			})

			It("suceeds if the second try is sucessful", func() {
				Expect(responseRecorder.Code).To(Equal(http.StatusAccepted))
			})

			Context("when updating the desired LRP fails with a conflict error", func() {
				BeforeEach(func() {
					fakeBBS.UpdateDesiredLRPReturns(models.ErrResourceConflict)
				})

				It("fails with a 409 Conflict if the second try is unsuccessful", func() {
					Expect(responseRecorder.Code).To(Equal(http.StatusConflict))
				})
			})