Ejemplo n.º 1
0
				Context("if the handler panics", func() {
					BeforeEach(func() {
						signaller.SignalStub = func(pid int, signal syscall.Signal) error {
							panic("boom")
						}
					})

					It("converts the panic to an error", func() {
						Expect(handlerError).To(MatchError("container_daemon: recovered panic: boom"))
					})
				})
			})
		})

		Context("when listening fails", func() {
			It("returns an error", func() {
				listener.ListenReturns(errors.New("Banana foo"))

				err := daemon.Run(listener)
				Expect(err).To(MatchError("container_daemon: listening for connections: Banana foo"))
			})
		})
	})
})

func tmp() *os.File {
	f, err := ioutil.TempFile("", "")
	Expect(err).NotTo(HaveOccurred())
	return f
}