Feature: GinkgoHelperGo - #1664
Merged
Merged
Conversation
Signed-off-by: thediveo <thediveo@gmx.eu>
Signed-off-by: thediveo <thediveo@gmx.eu>
thediveo
force-pushed
the
feature/halt-and-catch-fire
branch
from
May 13, 2026 20:52
27ecbe1 to
ab1f7af
Compare
Owner
|
hey thanks @thediveo - i'm away the next couple days but will try to take a look over the weekend! |
Owner
|
I like it! Looks good to me :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Based on discussion #1660 this implements a new
GinkgoHelperGo(not to be confused withGinkgoHelper) that runs a helper function on a separate Go routine, waiting for it to either terminate successfully or fail. The typical usage is envisioned to be that the helper function runs a spec-supplied function on the new Go routine. A concrete example is running a test helper for remounting the Linux /sysfs inside mount and network namespaces different from those of the test binary. Because of the way mount namespaces work in Linux, a spec cannot do this "inline" but needs to carry out the /sysfs remount from a separate Go routine with its own locked OS-level thread that has been partly detached in terms of certain filesystem-related thread/process properties.GinkgoHelperGois Gomega-agnostic in that it passes a helper "Fail" instead of a helper "Gomega", yet Gomega is easily roped in.I've simplified passing the outcome from the separate Go routine to the spec's Go routine, dropping the need for the discriminate "union" by simply using a
chan anyand passing either values of typeuserPanicked(string) or typehelperPanicked(string), and an implicitnilby just closing the channel without sending anything as the success signal.PR
GinkgoHelperGo-- I'm open to better naming ideas.GinkgoHelperGois placed in a dedicatedhelpergo_dsl.gobut I'll happily move it intocore_dsl.goor other places, just tell me.GinkgoHelperGo.