Expect(processGuid).To(Equal(expectedLrpKey.ProcessGuid)) Expect(int32(index)).To(Equal(expectedLrpKey.Index)) }) Context("when the removal succeeds", func() { It("deletes the container", func() { Expect(containerDelegate.DeleteContainerCallCount()).To(Equal(1)) delegateLogger, containerGuid := containerDelegate.DeleteContainerArgsForCall(0) Expect(containerGuid).To(Equal(container.Guid)) Expect(delegateLogger.SessionName()).To(Equal(expectedSessionName)) }) }) Context("when the removal fails", func() { BeforeEach(func() { bbsClient.RemoveActualLRPReturns(errors.New("whoops")) }) It("deletes the container", func() { Expect(containerDelegate.DeleteContainerCallCount()).To(Equal(1)) delegateLogger, containerGuid := containerDelegate.DeleteContainerArgsForCall(0) Expect(containerGuid).To(Equal(container.Guid)) Expect(delegateLogger.SessionName()).To(Equal(expectedSessionName)) }) }) }) Context("and the container was not requested to stop", func() { BeforeEach(func() { container.RunResult.Stopped = false container.RunResult.FailureReason = "crashed"