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.
This PR doesn't really make any major behavioral changes, but does some aggressive refactoring so we can properly test most of the client-server logic without pulling in the entire Mill codebase. We take advantage of this to flesh out ClientServerTests to cover a bunch more edge cases around the client-server interactions without needing to write slow and expensive integration tests.
There is definitely work we can do to improve the whole client/server setup behaviorally, but this PR intentionally avoids major changes. But the refactors and test fixtures we set up in this PR should make any future changes easier than they would have been otherwise, and should make it easier to reproduce/debug/fix any other issues we notice in the client-server interactions
Major Changes
Split the Mill-specific parts of the client-server code (in
runner.client
andrunner
) from the generic client-server parts (inmain.client
andmain.server
). All the generic code has theMill*
prefix removed, e.g.MillServerLauncher
is now justServerLauncher
Combined the classes of
MillServerMain
/Server
into justServer
Refactor the code in
ServerLauncher
, pulling commonly threaded parameters into constructor, renamingrunMain
to the more descriptiveacquireLocksAndRun
, and foldrunMillServer
intorun
Make the Mill server shut down when the folder gets deleted, to avoid leaking processes when you
rm -rf out/
Flesh out
ClientServerTests
: we now exercise all the code inServerLauncher
, rather than just therun
method. We also now exercise the run-multiple-servers-in-different-folders code path, the client-gets-killed-halfway code path, as well as the shut-down-when-server-folder-gets-deleted code path we just addedAdded a
server.log
file inside each of themill-worker-*
folders. This is used in tests to assert that the servers go through the code paths we expect, and will also be useful for debugging misbehaviors in future if we see a server process not doing what we expectMany other minor bugfixes and tweaks to allow testability (e.g. simulating client termination with an exception, stubbing out System.exit so the tests don't kill the test process, etc.)
Pull request: #3370