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 claim fails for an unknown reason", func() { BeforeEach(func() { bbsClient.ClaimActualLRPReturns(errors.New("boom")) }) It("does not stop or delete the container", func() { Expect(containerDelegate.StopContainerCallCount()).To(Equal(0)) Expect(containerDelegate.DeleteContainerCallCount()).To(Equal(0)) }) }) } Context("and the container is INITIALIZING", func() { BeforeEach(func() { container.State = executor.StateInitializing }) itClaimsTheLRPOrDeletesTheContainer(sessionPrefix + "process-initializing-container") }) Context("and the container is CREATED", func() { BeforeEach(func() {