It("returns the list error", func() { err := gardenChecker.Healthcheck(logger) By("Retries the failing list command") Expect(gardenClient.ContainersCallCount()).To(Equal(retryCount)) By("Returns the error") Expect(err).To(Equal(listErr)) }) }) Context("when deleting old containers fails", func() { var destroyErr = errors.New("boom") BeforeEach(func() { gardenClient.ContainersReturns([]garden.Container{fakeContainer}, nil) gardenClient.DestroyReturns(destroyErr) }) It("returns the destroy error", func() { err := gardenChecker.Healthcheck(logger) By("Retries the destroy container command") Expect(gardenClient.DestroyCallCount()).To(Equal(retryCount)) By("Returns the error") Expect(err).To(Equal(destroyErr)) }) }) Context("when create fails", func() { var createErr = errors.New("nope")