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())
		Expect(err).ToNot(HaveOccurred())

		Expect(fakeContainerPool.DestroyedContainers).To(ContainElement(container))
	})

	It("unregisters the container", func() {
		err := linuxBackend.Destroy(container.Handle())
		Expect(err).ToNot(HaveOccurred())

		_, err = linuxBackend.Lookup(container.Handle())
		Expect(err).To(HaveOccurred())
		Expect(err).To(Equal(linux_backend.UnknownHandleError{container.Handle()}))
	})

	Context("when the container does not exist", func() {
Example #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())
}