-
-
Notifications
You must be signed in to change notification settings - Fork 679
Closed
Description
go.mod
:
github.com/onsi/ginkgo/v2 v2.6.1
github.com/onsi/gomega v1.24.2
It("renders user tree with loose threads with CLI -d", func() {
By("creating a stray task with its own namespace...")
tidch := make(chan int)
done := make(chan struct{})
go func() {
defer GinkgoRecover()
// unix.Unshare will fail with err != nil
Expect(unix.Unshare(unix.CLONE_FS | unix.CLONE_NEWNS)).To(Succeed())
tidch <- unix.Gettid()
<-done
}()
tid := <-tidch
// ...
}
When running this test (as a non-root user) the expectation in the separate go routine will fail. However, the test node itself won't be aborted but instead will "hang" until the overall test watchdog barks and bites.
This is probably the, erm, expected behavior (pun intended). What is the proper way to correctly handle failed expectations while the original test node go routine is blocked on some channel read? Somehow I would imagine using a test context and then cancel this? Is there a convenient way to ensure that the context is only cancelled when GinkgoRecover actually meets with a failed expectation (panic)?
Metadata
Metadata
Assignees
Labels
No labels