_, err := linuxBackend.Create(backend.ContainerSpec{})
			Expect(err).To(HaveOccurred())

			containers, err := linuxBackend.Containers()
			Expect(err).ToNot(HaveOccurred())

			Expect(containers).To(BeEmpty())
		})
	})
})

var _ = Describe("Destroy", func() {
	var fakeContainerPool *fake_container_pool.FakeContainerPool
	var linuxBackend *linux_backend.LinuxBackend

	var container backend.Container

	BeforeEach(func() {
		fakeContainerPool = fake_container_pool.New()
		linuxBackend = linux_backend.New(fakeContainerPool, "")

		newContainer, err := linuxBackend.Create(backend.ContainerSpec{})
		Expect(err).ToNot(HaveOccurred())

		container = newContainer
	})

	It("removes the given container from the pool", func() {
		Expect(fakeContainerPool.DestroyedContainers).To(BeEmpty())

		err := linuxBackend.Destroy(container.Handle())
Exemple #2
0
func (s *WardenServer) reapContainer(container backend.Container) {
	log.Printf("reaping %s (idle for %s)\n", container.Handle(), container.GraceTime())
	s.backend.Destroy(container.Handle())
}