Expect(response.KeepContainer).To(BeFalse()) Expect(response.Error).To(Equal(models.ErrActualLRPCannotBeRemoved)) }) It("emits only the removal of the evacuating to the hub", func() { Eventually(actualHub.EmitCallCount).Should(Equal(1)) event := actualHub.EmitArgsForCall(0) removeEvent, ok := event.(*models.ActualLRPRemovedEvent) Expect(ok).To(BeTrue()) Expect(removeEvent.ActualLrpGroup).To(Equal(&models.ActualLRPGroup{Evacuating: actual})) }) }) Context("when the DB returns an unrecoverable error", func() { BeforeEach(func() { fakeActualLRPDB.RemoveActualLRPReturns(models.NewUnrecoverableError(nil)) }) It("logs and writes to the exit channel", func() { Eventually(logger).Should(gbytes.Say("unrecoverable-error")) Eventually(exitCh).Should(Receive()) }) }) Context("when removing the actual lrp fails", func() { BeforeEach(func() { fakeActualLRPDB.RemoveActualLRPReturns(errors.New("boom!")) }) It("returns an error but does not keep the container", func() { response := models.EvacuationResponse{}