Eventually(creating).Should(BeClosed()) stopExited := make(chan struct{}) go func() { apiServer.Stop() close(stopExited) }() Consistently(stopExited).ShouldNot(BeClosed()) close(finishCreating) Eventually(stopExited).Should(BeClosed()) Eventually(created).Should(Receive()) err := apiClient.Ping() Ω(err).Should(HaveOccurred()) }) }) Context("when a Run request is in-flight", func() { It("does not wait for the request to complete", func(done Done) { fakeContainer := new(fakes.FakeContainer) fakeContainer.RunStub = func(spec garden.ProcessSpec, io garden.ProcessIO) (garden.Process, error) { process := new(fakes.FakeProcess) process.WaitStub = func() (int, error) { time.Sleep(time.Minute) return 0, nil }