It("starts the backend", func() { var err error tmpdir, err = ioutil.TempDir(os.TempDir(), "api-server-test") Ω(err).ShouldNot(HaveOccurred()) socketPath := path.Join(tmpdir, "api.sock") fakeBackend := new(fakes.FakeBackend) apiServer := server.New("unix", socketPath, 0, fakeBackend, logger) err = apiServer.Start() Ω(err).ShouldNot(HaveOccurred()) Ω(fakeBackend.StartCallCount()).Should(Equal(1)) }) It("destroys containers that have been idle for their grace time", func() { var err error tmpdir, err = ioutil.TempDir(os.TempDir(), "api-server-test") Ω(err).ShouldNot(HaveOccurred()) socketPath := path.Join(tmpdir, "api.sock") fakeBackend := new(fakes.FakeBackend) doomedContainer := new(fakes.FakeContainer) fakeBackend.ContainersReturns([]garden.Container{doomedContainer}, nil) fakeBackend.GraceTimeReturns(100 * time.Millisecond)