예제 #1
0
			})

			It("sends an interrupt to the process", func() {
				Eventually(spawnedProcess.SignalCallCount).Should(Equal(1))
				Expect(spawnedProcess.SignalArgsForCall(0)).To(Equal(garden.SignalTerminate))
			})

			Context("when the process exits", func() {
				It("completes the perform without having sent kill", func() {
					Eventually(spawnedProcess.SignalCallCount).Should(Equal(1))

					waitExited <- (128 + 15)

					Eventually(performErr).Should(Receive(Equal(steps.ErrCancelled)))

					Expect(spawnedProcess.SignalCallCount()).To(Equal(1))
					Expect(spawnedProcess.SignalArgsForCall(0)).To(Equal(garden.SignalTerminate))
				})
			})

			Context("when the process does not exit after 10s", func() {
				It("sends a kill signal to the process", func() {
					Eventually(spawnedProcess.SignalCallCount).Should(Equal(1))

					fakeClock.Increment(steps.TERMINATE_TIMEOUT + 1*time.Second)

					Eventually(spawnedProcess.SignalCallCount).Should(Equal(2))
					Expect(spawnedProcess.SignalArgsForCall(1)).To(Equal(garden.SignalKill))

					waitExited <- (128 + 9)