Share a single bloop daemon per .bats file to speed up E2E tests #357
Labels
No labels
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli#357
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Each of the 6
.batsfiles that setXDG_DATA_HOMEto a temp dir currently creates a freshmktemp -dper test insetup(). When a test invokes./iw-run→scala-cli, a new bloop daemon cold-starts under that temp XDG — one daemon per test, ~3–5 s startup overhead each time.The orphan-daemon leak itself was fixed in
7d3ce1f(Option 2: pkill in teardown), but the performance cost of cold-starting a JVM build server per test remains.Proposal
Refactor the 6 affected test files to use BATS
setup_file/teardown_file:setup_file(): Create a singleFILE_TEST_DIRwith its ownXDG_DATA_HOME. This becomes the shared bloop data dir for the whole.batsfile.setup(): Create a per-testTEST_DIRfor test-specific state (plugin dirs, git repos, configs). SetIW_PLUGIN_DIRSor create plugin dirs under$XDG_DATA_HOME/iw/plugins/— but clean them each test to maintain isolation.teardown(): Remove per-testTEST_DIRonly.teardown_file(): Callstop_test_bloopand removeFILE_TEST_DIR.This way one bloop daemon serves all tests in a file, and
stop_test_bloopkills it once at the end.Affected files
test/plugin-discovery.batstest/plugin-commands-list.batstest/plugin-commands-describe.batstest/plugin-commands-execute.batstest/plugin-hooks.batstest/version-check.batsComplexity
The main challenge is that several tests create plugins inside
$XDG_DATA_HOME/iw/plugins/and expect test-to-test isolation. Each test's plugin state must be cleaned or namespaced so tests don't contaminate each other.Expected benefit
~20–30 fewer bloop cold-starts per full E2E run, saving roughly 1–2 minutes of wall time.
Closing as superseded by Phase 3 of the test-rebalance plan (docs/plans/2026-06-03-test-rebalance.md). The bloop cold-start cost was eliminated at the root rather than by sharing daemons: phase 3.1, 3.5, and 3.6 dropped the dead
cp -r core/+./mill show core.jar+stop_test_bloopsetup from BATS files that never actually invoked scala-cli. Per-test bloop daemons are no longer the bottleneck — most affected files now complete in <2s. Where scala-cli IS legitimately needed, the four-testtest/contract/scala_cli_contract.batscovers it in ~2s aggregate.