container.State = executor.StateCompleted container.RunResult.Stopped = false container.RunResult.FailureReason = "crashed" }) It("evacuates the lrp", func() { Expect(fakeBBS.EvacuateCrashedActualLRPCallCount()).To(Equal(1)) actualLRPKey, actualLRPContainerKey, reason := fakeBBS.EvacuateCrashedActualLRPArgsForCall(0) Expect(*actualLRPKey).To(Equal(lrpKey)) Expect(*actualLRPContainerKey).To(Equal(lrpInstanceKey)) Expect(reason).To(Equal("crashed")) }) Context("when the evacuation returns successfully", func() { BeforeEach(func() { fakeBBS.EvacuateCrashedActualLRPReturns(false, nil) }) It("deletes the container", func() { Expect(fakeContainerDelegate.DeleteContainerCallCount()).To(Equal(1)) _, actualContainerGuid := fakeContainerDelegate.DeleteContainerArgsForCall(0) Expect(actualContainerGuid).To(Equal(container.Guid)) }) }) Context("when the evacuation returns that it failed to remove the LRP", func() { BeforeEach(func() { fakeBBS.EvacuateCrashedActualLRPReturns(false, models.ErrActualLRPCannotBeCrashed) }) It("deletes the container", func() {