Codebase list golang-gomega / cdfab82
split checking not waiting for exit into different test Jatin Naik 7 years ago
1 changed file(s) with 40 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
132132 })
133133
134134 Describe("kill", func() {
135 It("should kill all the started sessions, and not wait", func() {
135 It("should kill all the started sessions", func() {
136136 session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
137137 Ω(err).ShouldNot(HaveOccurred())
138138
143143 Ω(err).ShouldNot(HaveOccurred())
144144
145145 Kill()
146 Ω(session1).ShouldNot(Exit(), "Should not exit immediately...")
147 Ω(session2).ShouldNot(Exit(), "Should not exit immediately...")
148 Ω(session3).ShouldNot(Exit(), "Should not exit immediately...")
149146
150147 Eventually(session1).Should(Exit(128 + 9))
151148 Eventually(session2).Should(Exit(128 + 9))
152149 Eventually(session3).Should(Exit(128 + 9))
153150 })
154151
152 It("should not wait for exit", func() {
153 session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
154 Ω(err).ShouldNot(HaveOccurred())
155
156 Kill()
157 Ω(session1).ShouldNot(Exit(), "Should not exit immediately...")
158
159 Eventually(session1).Should(Exit(128 + 9))
160 })
161
155162 It("should not track unstarted sessions", func() {
156163 _, err := Start(exec.Command("does not exist", "10000000"), GinkgoWriter, GinkgoWriter)
157164 Ω(err).Should(HaveOccurred())
163170 Ω(err).ShouldNot(HaveOccurred())
164171
165172 Kill()
166 Ω(session2).ShouldNot(Exit(), "Should not exit immediately...")
167 Ω(session3).ShouldNot(Exit(), "Should not exit immediately...")
168173
169174 Eventually(session2).Should(Exit(128 + 9))
170175 Eventually(session3).Should(Exit(128 + 9))
191196 })
192197
193198 Describe("terminate", func() {
194 It("should terminate all the started sessions, and not wait", func() {
199 It("should terminate all the started sessions", func() {
195200 session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
196201 Ω(err).ShouldNot(HaveOccurred())
197202
202207 Ω(err).ShouldNot(HaveOccurred())
203208
204209 Terminate()
205
206 Ω(session1).ShouldNot(Exit(), "Should not exit immediately...")
207 Ω(session2).ShouldNot(Exit(), "Should not exit immediately...")
208 Ω(session3).ShouldNot(Exit(), "Should not exit immediately...")
209210
210211 Eventually(session1).Should(Exit(128 + 15))
211212 Eventually(session2).Should(Exit(128 + 15))
212213 Eventually(session3).Should(Exit(128 + 15))
213214 })
215
216 It("should not wait for exit", func() {
217 session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
218 Ω(err).ShouldNot(HaveOccurred())
219
220 Terminate()
221
222 Ω(session1).ShouldNot(Exit(), "Should not exit immediately...")
223 })
214224 })
215225
216226 Describe("terminateAndWait", func() {
233243 })
234244
235245 Describe("signal", func() {
236 It("should signal all the started sessions, and not wait", func() {
246 It("should signal all the started sessions", func() {
237247 session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
238248 Ω(err).ShouldNot(HaveOccurred())
239249
244254 Ω(err).ShouldNot(HaveOccurred())
245255
246256 Signal(syscall.SIGABRT)
247
248 Ω(session1).ShouldNot(Exit(), "Should not exit immediately...")
249 Ω(session2).ShouldNot(Exit(), "Should not exit immediately...")
250 Ω(session3).ShouldNot(Exit(), "Should not exit immediately...")
251257
252258 Eventually(session1).Should(Exit(128 + 6))
253259 Eventually(session2).Should(Exit(128 + 6))
254260 Eventually(session3).Should(Exit(128 + 6))
255261 })
262
263 It("should not wait", func() {
264 session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
265 Ω(err).ShouldNot(HaveOccurred())
266
267 Signal(syscall.SIGABRT)
268
269 Ω(session1).ShouldNot(Exit(), "Should not exit immediately...")
270 })
256271 })
257272
258273 Describe("interrupt", func() {
267282 Ω(err).ShouldNot(HaveOccurred())
268283
269284 Interrupt()
270
271 Ω(session1).ShouldNot(Exit(), "Should not exit immediately...")
272 Ω(session2).ShouldNot(Exit(), "Should not exit immediately...")
273 Ω(session3).ShouldNot(Exit(), "Should not exit immediately...")
274285
275286 Eventually(session1).Should(Exit(128 + 2))
276287 Eventually(session2).Should(Exit(128 + 2))
277288 Eventually(session3).Should(Exit(128 + 2))
289 })
290
291 It("should not wait", func() {
292 session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
293 Ω(err).ShouldNot(HaveOccurred())
294
295 Interrupt()
296
297 Ω(session1).ShouldNot(Exit(), "Should not exit immediately...")
278298 })
279299 })
280300 })