Expect(tarStream).To(BeNil()) Expect(err).To(MatchError("stream-out: pid not found for container")) }) It("returns the error if nstar fails", func() { fakeNstarRunner.StreamOutReturns(nil, errors.New("failed")) tarStream, err := containerizer.StreamOut(logger, "some-handle", garden.StreamOutSpec{}) Expect(tarStream).To(BeNil()) Expect(err).To(MatchError("stream-out: nstar: failed")) }) }) Describe("destroy", func() { It("should run kill", func() { Expect(containerizer.Destroy(logger, "some-handle")).To(Succeed()) Expect(fakeContainerRunner.KillCallCount()).To(Equal(1)) Expect(arg2(fakeContainerRunner.KillArgsForCall(0))).To(Equal("some-handle")) }) Context("when kill succeeds", func() { It("destroys the depot directory", func() { Expect(containerizer.Destroy(logger, "some-handle")).To(Succeed()) Expect(fakeDepot.DestroyCallCount()).To(Equal(1)) Expect(arg2(fakeDepot.DestroyArgsForCall(0))).To(Equal("some-handle")) }) }) Context("when kill fails", func() { It("does not destroy the depot directory", func() { fakeContainerRunner.KillReturns(errors.New("killing is wrong"))