-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature idea: Before Fork/ After fork callbacks #25
Comments
should be doable since we control the workers directly, PR welcome, but I'm most likely not going to work on that since I don't have a use for it ... |
I've been looking into implementing this and I wanted to share my notes/findings. I don't consider this a feature proposal yet. I'm curious to hear your high-level thoughts on these findings. I'm looking for any potential alternatives you could think of for implementation. I'm also looking for a temperature reading of how 👍 👎 you might be on something like this example implementation. Problem with implementing before/after split semanticsTo be able to enable before/after semantics, we need to read that code into memory. Usually, people expect to put their test config into This blocks an easy addition of Extra conditionsIn addition to being able to have before/after semantics, I also want any interface for parallel_split_test to degrade gracefully. Meaning if someone calls A viable workaround needsTo have all these conditions met we need:
Possible way forward
For exampleInside of require_relative "parallel_split_config.rb"
Inside of the file could look like this: require "parallel_split_test"
require "cutlass"
JVM_BUILDPACK = Cutlass::LocalBuildpack.new(directory: test_dir.join("meta-buildpacks/java"))
ParallelSplitTest.before_split do
JVM_BUILDPACK.setup
end
ParallelSplitTest.after_split do
JVM_BUILDPACK.teardown
end If this is invoked multiple times it only runs on first invocation (due to require_relative semantics). Forked processes should have access to this memory. Running cases with/without parallel_split_test:
AlternativesWe could perhaps default to making that "special config file" simply AnalysisIt's a bit more round-about than I was originally hoping for (interface-wise). But the main process not reading in the rspec code at all is a fairly major constraint on configuration options. This is the only way I can find to satisfy all my requirements. We could move logic around a bit, but I think the need to read in a stand-alone file is strong. I would say my overall temperature on this implementation is somewhat cool at this moment in time. I think it would work and satisfy my criteria but it seems like it could be difficult to understand what's being done and why when there's a bug in the test setup/teardown. |
Alternative idea: Extra config file: sounds like a much simpler approach and would allow opt-in for people that need the feature, could be something that can be easily merged and played with, so I'd appreciate a PR that explores this. |
I've got a check that ensures my tests didn't leak into my ENV using before and after suite. I needed something similar for checking I'm not leaking docker images as well, but it looks like before and after suite executes at the end of the process rather than when all processes are joined together.
What ends up happening is process 1 finishes while process 2 is still running and hasn't cleaned up yet. The check fires in process 1 and it sees there's a leaked image, even though it will be cleaned up before process 2 exits. If I could delay the check until all processes are finished, then I can get rid of my race condition.
The text was updated successfully, but these errors were encountered: