fakeProcess.WaitStub = func() (int, error) { <-stopped return 128 + 15, nil } fakeContainer.StopStub = func(bool) error { close(stopped) return nil } }) It("stops the container", func() { process.Signal(os.Interrupt) Eventually(process.Wait()).Should(Receive(Equal(ErrInterrupted))) Ω(fakeContainer.StopCallCount()).Should(Equal(1)) }) }) Describe("releasing", func() { It("releases the container", func() { Ω(fakeContainer.ReleaseCallCount()).Should(BeZero()) step.Release() Ω(fakeContainer.ReleaseCallCount()).Should(Equal(1)) }) }) Context("when running the task's script fails", func() { disaster := errors.New("nope")