split checking not waiting for exit into different test
Jatin Naik
7 years ago
132 | 132 | }) |
133 | 133 | |
134 | 134 | Describe("kill", func() { |
135 | It("should kill all the started sessions, and not wait", func() { | |
135 | It("should kill all the started sessions", func() { | |
136 | 136 | session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) |
137 | 137 | Ω(err).ShouldNot(HaveOccurred()) |
138 | 138 | |
143 | 143 | Ω(err).ShouldNot(HaveOccurred()) |
144 | 144 | |
145 | 145 | 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...") | |
149 | 146 | |
150 | 147 | Eventually(session1).Should(Exit(128 + 9)) |
151 | 148 | Eventually(session2).Should(Exit(128 + 9)) |
152 | 149 | Eventually(session3).Should(Exit(128 + 9)) |
153 | 150 | }) |
154 | 151 | |
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 | ||
155 | 162 | It("should not track unstarted sessions", func() { |
156 | 163 | _, err := Start(exec.Command("does not exist", "10000000"), GinkgoWriter, GinkgoWriter) |
157 | 164 | Ω(err).Should(HaveOccurred()) |
163 | 170 | Ω(err).ShouldNot(HaveOccurred()) |
164 | 171 | |
165 | 172 | Kill() |
166 | Ω(session2).ShouldNot(Exit(), "Should not exit immediately...") | |
167 | Ω(session3).ShouldNot(Exit(), "Should not exit immediately...") | |
168 | 173 | |
169 | 174 | Eventually(session2).Should(Exit(128 + 9)) |
170 | 175 | Eventually(session3).Should(Exit(128 + 9)) |
191 | 196 | }) |
192 | 197 | |
193 | 198 | Describe("terminate", func() { |
194 | It("should terminate all the started sessions, and not wait", func() { | |
199 | It("should terminate all the started sessions", func() { | |
195 | 200 | session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) |
196 | 201 | Ω(err).ShouldNot(HaveOccurred()) |
197 | 202 | |
202 | 207 | Ω(err).ShouldNot(HaveOccurred()) |
203 | 208 | |
204 | 209 | 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...") | |
209 | 210 | |
210 | 211 | Eventually(session1).Should(Exit(128 + 15)) |
211 | 212 | Eventually(session2).Should(Exit(128 + 15)) |
212 | 213 | Eventually(session3).Should(Exit(128 + 15)) |
213 | 214 | }) |
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 | }) | |
214 | 224 | }) |
215 | 225 | |
216 | 226 | Describe("terminateAndWait", func() { |
233 | 243 | }) |
234 | 244 | |
235 | 245 | Describe("signal", func() { |
236 | It("should signal all the started sessions, and not wait", func() { | |
246 | It("should signal all the started sessions", func() { | |
237 | 247 | session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) |
238 | 248 | Ω(err).ShouldNot(HaveOccurred()) |
239 | 249 | |
244 | 254 | Ω(err).ShouldNot(HaveOccurred()) |
245 | 255 | |
246 | 256 | 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...") | |
251 | 257 | |
252 | 258 | Eventually(session1).Should(Exit(128 + 6)) |
253 | 259 | Eventually(session2).Should(Exit(128 + 6)) |
254 | 260 | Eventually(session3).Should(Exit(128 + 6)) |
255 | 261 | }) |
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 | }) | |
256 | 271 | }) |
257 | 272 | |
258 | 273 | Describe("interrupt", func() { |
267 | 282 | Ω(err).ShouldNot(HaveOccurred()) |
268 | 283 | |
269 | 284 | 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...") | |
274 | 285 | |
275 | 286 | Eventually(session1).Should(Exit(128 + 2)) |
276 | 287 | Eventually(session2).Should(Exit(128 + 2)) |
277 | 288 | 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...") | |
278 | 298 | }) |
279 | 299 | }) |
280 | 300 | }) |