// give the tests time to send signals, while the builder is "working" time.Sleep(2 * time.Second) }), ), ) }) JustBeforeEach(func() { session = setupBuilder() Eventually(session.Out, 30).Should(gbytes.Say("Staging process started ...")) }) Context("and builder is interrupted", func() { JustBeforeEach(func() { session.Interrupt() }) It("processes the signal and exits", func() { Eventually(session).Should(gexec.Exit(2)) }) }) Context("and docker is killed", func() { JustBeforeEach(func() { cmd := exec.Command("/usr/bin/killall", "docker") cmd.Env = os.Environ() err := cmd.Run() Expect(err).NotTo(HaveOccurred()) os.Remove("/var/run/docker.sock")