Skip to content

test: isolate the subprocess tests from the developer's LuCLI home - #28

Merged
bpamiri merged 2 commits into
wheelsfrom
peter/test-home-isolation
Oct 6, 2026
Merged

bpamiri merged 2 commits into
wheelsfrom
peter/test-home-isolation

Conversation

@bpamiri

@bpamiri bpamiri commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Fixes #25 (upstream: cybersonic#144)

What

ModuleArgBindingTest and McpCommandTest installed their fixture modules into LucliPaths.resolve().modulesDir(), which is the real ~/.lucli/modules by default. They then spawned dev-lucli.sh without passing a home, so the child resolved its own home from the account's user.home. That caused two problems:

  • mvn test compiled the fixtures into the real ~/.lucli/lucee-server.
  • With an isolated test home, the child couldn't find the fixtures: 17 tests failed.

Each class now has a static @TempDir LuCLI home. The fixture is installed there, and every child process gets that home as LUCLI_HOME through a small lucliProcess(...) helper. LUCLI_HOME also moves the child's Lucee context (configureLuceeDirectories), so nothing goes to ~/.lucli. Only test code changes.

Tests

  • New ModuleArgBindingTest.childRunsInTheTemporaryLucliHome: asserts that the child created its lucee-server under the temporary home. RED: with the child pointed at a different home, it fails with "the child must create its Lucee context under LUCLI_HOME".
  • mvn test -DargLine="-Duser.home=<empty dir>" with LUCLI_HOME unset: 788 tests, 0 failures (before: 17 failures). ~/.lucli had no files newer than the run's start. The child ran with the real user.home, so this checks the child, not just the test JVM.

🤖 Generated with Claude Code

bpamiri and others added 2 commits October 6, 2026 05:17
ModuleArgBindingTest and McpCommandTest installed their fixture modules
into LucliPaths' modules dir (the real ~/.lucli/modules by default) and
spawned dev-lucli.sh without passing a home. The child resolved its own
home from the account's user.home, so mvn test compiled the fixtures
into the real ~/.lucli/lucee-server, and with an isolated test home the
child couldn't find the fixtures (17 failures).

Each class now has a static @tempdir LuCLI home: the fixture is
installed there and every child gets it as LUCLI_HOME. Adds
childRunsInTheTemporaryLucliHome, which fails when the child runs in
any other home.

Fixes #25
Upstream: cybersonic#144

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Unit Tests (ubuntu-latest, Java 21)

 65 files   65 suites   2m 29s ⏱️
783 tests 777 ✅ 6 💤 0 ❌
788 runs  782 ✅ 6 💤 0 ❌

Results for commit 3b79b9c.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Integration Tests (ubuntu-latest, Java 21)

78 tests   78 ✅  2m 1s ⏱️
14 suites   0 💤
 1 files     0 ❌

Results for commit 3b79b9c.

@bpamiri

bpamiri commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author

rev1-r3 review @ 3b79b9c: APPROVE (final)

RED/GREEN in a clean home. I ran mvn test -Dtest='ModuleArgBindingTest,McpCommandTest' with a fresh sandbox (-DargLine="-Duser.home=<sandbox> -Dlucli.home=<sandbox>/.lucli"):

ModuleArgBindingTest McpCommandTest
base wheels 8 run, 8 failures 9 run, 4 failures + 5 errors
this branch 9/0/0 (including the new childRunsInTheTemporaryLucliHome) 9/0/0

The base failures are exactly the 17 known clean-home failures from #25, and this PR removes all of them.

No writes to the real home: find ~/.lucli ~/.wheels -newer <start-mark> after both runs shows nothing, even though the dev-lucli.sh children run with the real user.home, as the description says.

Code (test-only):

  • A static @TempDir lucliHome per class, so JUnit cleans it up.
  • The fixture is installed under lucliHome/modules, and every child ProcessBuilder gets LUCLI_HOME=lucliHome.
  • The now-unused LucliPaths import is removed.
  • The new test asserts the child creates its lucee-server context under the temp home.

Note, not blocking: each class now builds a fresh Lucee context on its first child run, so locally the two classes took about 49 s and 28 s instead of about 11 s each. That's a fair price for hermetic tests.

PR CI: 8 pass (Build ×3, Unit ×3, Integration ×2); APT smoke skipped. mergeStateStatus is CLEAN.

Ready to merge.

@bpamiri
bpamiri merged commit 959abb0 into wheels Oct 6, 2026
11 checks passed
@bpamiri
bpamiri deleted the peter/test-home-isolation branch October 6, 2026 12:22
bpamiri added a commit that referenced this pull request Oct 8, 2026
- pom.xml version 0.6.2.3 (the Windows file/product version follows
  ${project.version}); install-validation default 0.6.2.3.
- FORK.md: 'Next queue' becomes the 0.6.2.3 queue (rows 8-15: #19,
  #21-#24, #26-#28), with the row-8 compatibility note (Wheels 4.1.x
  stays at max 0.6.2.2: no __lucliMcpCall handling), and a new empty
  Next queue.
- CHANGELOG unchanged: fork entries stay under Unreleased, as for
  0.6.2.2.

Sandboxed mvn test (-Duser.home only): 788 run, 0 failures.

Signed-off-by: Peter Amiri <peter@alurium.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant