split checking not waiting for exit into different test
diff --git a/gexec/session_test.go b/gexec/session_test.go
index f8018b8..b7841a0 100644
--- a/gexec/session_test.go
+++ b/gexec/session_test.go
@@ -133,7 +133,7 @@
})
Describe("kill", func() {
- It("should kill all the started sessions, and not wait", func() {
+ It("should kill all the started sessions", func() {
session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
Ω(err).ShouldNot(HaveOccurred())
@@ -144,15 +144,22 @@
Ω(err).ShouldNot(HaveOccurred())
Kill()
- Ω(session1).ShouldNot(Exit(), "Should not exit immediately...")
- Ω(session2).ShouldNot(Exit(), "Should not exit immediately...")
- Ω(session3).ShouldNot(Exit(), "Should not exit immediately...")
Eventually(session1).Should(Exit(128 + 9))
Eventually(session2).Should(Exit(128 + 9))
Eventually(session3).Should(Exit(128 + 9))
})
+ It("should not wait for exit", func() {
+ session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
+ Ω(err).ShouldNot(HaveOccurred())
+
+ Kill()
+ Ω(session1).ShouldNot(Exit(), "Should not exit immediately...")
+
+ Eventually(session1).Should(Exit(128 + 9))
+ })
+
It("should not track unstarted sessions", func() {
_, err := Start(exec.Command("does not exist", "10000000"), GinkgoWriter, GinkgoWriter)
Ω(err).Should(HaveOccurred())
@@ -164,8 +171,6 @@
Ω(err).ShouldNot(HaveOccurred())
Kill()
- Ω(session2).ShouldNot(Exit(), "Should not exit immediately...")
- Ω(session3).ShouldNot(Exit(), "Should not exit immediately...")
Eventually(session2).Should(Exit(128 + 9))
Eventually(session3).Should(Exit(128 + 9))
@@ -192,7 +197,7 @@
})
Describe("terminate", func() {
- It("should terminate all the started sessions, and not wait", func() {
+ It("should terminate all the started sessions", func() {
session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
Ω(err).ShouldNot(HaveOccurred())
@@ -204,14 +209,19 @@
Terminate()
- Ω(session1).ShouldNot(Exit(), "Should not exit immediately...")
- Ω(session2).ShouldNot(Exit(), "Should not exit immediately...")
- Ω(session3).ShouldNot(Exit(), "Should not exit immediately...")
-
Eventually(session1).Should(Exit(128 + 15))
Eventually(session2).Should(Exit(128 + 15))
Eventually(session3).Should(Exit(128 + 15))
})
+
+ It("should not wait for exit", func() {
+ session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
+ Ω(err).ShouldNot(HaveOccurred())
+
+ Terminate()
+
+ Ω(session1).ShouldNot(Exit(), "Should not exit immediately...")
+ })
})
Describe("terminateAndWait", func() {
@@ -234,7 +244,7 @@
})
Describe("signal", func() {
- It("should signal all the started sessions, and not wait", func() {
+ It("should signal all the started sessions", func() {
session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
Ω(err).ShouldNot(HaveOccurred())
@@ -246,14 +256,19 @@
Signal(syscall.SIGABRT)
- Ω(session1).ShouldNot(Exit(), "Should not exit immediately...")
- Ω(session2).ShouldNot(Exit(), "Should not exit immediately...")
- Ω(session3).ShouldNot(Exit(), "Should not exit immediately...")
-
Eventually(session1).Should(Exit(128 + 6))
Eventually(session2).Should(Exit(128 + 6))
Eventually(session3).Should(Exit(128 + 6))
})
+
+ It("should not wait", func() {
+ session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
+ Ω(err).ShouldNot(HaveOccurred())
+
+ Signal(syscall.SIGABRT)
+
+ Ω(session1).ShouldNot(Exit(), "Should not exit immediately...")
+ })
})
Describe("interrupt", func() {
@@ -269,14 +284,19 @@
Interrupt()
- Ω(session1).ShouldNot(Exit(), "Should not exit immediately...")
- Ω(session2).ShouldNot(Exit(), "Should not exit immediately...")
- Ω(session3).ShouldNot(Exit(), "Should not exit immediately...")
-
Eventually(session1).Should(Exit(128 + 2))
Eventually(session2).Should(Exit(128 + 2))
Eventually(session3).Should(Exit(128 + 2))
})
+
+ It("should not wait", func() {
+ session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
+ Ω(err).ShouldNot(HaveOccurred())
+
+ Interrupt()
+
+ Ω(session1).ShouldNot(Exit(), "Should not exit immediately...")
+ })
})
})