Install round-trip tests (systemd / launchd / Windows SCM)#82
Merged
hyperpolymath merged 1 commit intoMay 24, 2026
Merged
Conversation
Complements install-tests.yml (lint-only) with three drivers that
actually install→activate→stop→uninstall the service on the platform's
real service manager:
tests/install/roundtrip-linux.sh systemctl --user enable --now;
also kills MainPID and asserts
Restart=on-failure respawns
tests/install/roundtrip-macos.sh launchctl bootstrap gui/$UID
with stub PATH= patched into the
plist (launchd ignores user env)
tests/install/roundtrip-windows.ps1 creates a throwaway local user,
installs non-interactively via a
new -Credential param on
wsl-bolt-udp-forward.ps1, asserts
SCM state, uninstalls, removes
user in finally{}
tests/install/stubs/{mix,deno} are sleep-forever stand-ins so the
spawned units satisfy systemd/launchd's "Active" check without needing
the full Elixir/Deno toolchain in CI. Drivers all clean up after
themselves (trap EXIT preserves real exit code with `ec=$?` capture
before cleanup; try/finally on the Windows side).
scripts/wsl-bolt-udp-forward.ps1: new -Credential [PSCredential]
parameter on -Install. When supplied (CI), skips the Get-Credential
prompt. When omitted (default, human use), behaviour is unchanged.
.github/workflows/install-roundtrip.yml: three-OS matrix —
ubuntu-latest (with `loginctl enable-linger $USER` so user-systemd
starts without a login session), macos-14, windows-latest. Same
path-filter as install-tests.yml.
run.sh's shellcheck pass now covers the new round-trip drivers too;
caught the SC2154 false positive on `trap 'ec=$?; ...'` (disabled
inline) and the unset-$USER bug surfaced under `set -u` on stripped
containers.
f99ff3a
into
claude/dreamy-carson-mTifq
17 of 21 checks passed
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.
Stacks on #81. Adds the round-trip tests that #81's README documented as "next step".
What's in this PR
Three platform-specific drivers that actually install → activate → stop → uninstall the service on the real service manager, complementing the lint-only checks in #81:
tests/install/roundtrip-linux.shsystemctl --user enable --nowround-trip. Also kills the unit'sMainPIDand assertsRestart=on-failurerespawns it withinRestartSec=5.tests/install/roundtrip-macos.shlaunchctl bootstrap gui/$UID/bootoutround-trip. Patches stubPATH=into the plist (launchd ignores user shell env).tests/install/roundtrip-windows.ps1burble-ci-test) with random password, installs Windows Service non-interactively, asserts SCM state, uninstalls, removes user infinally{}.Supporting bits
tests/install/stubs/{mix,deno}— sleep-forever stand-ins so spawned units satisfy systemd/launchd's "Active" check without needing the full Elixir/Deno toolchain in CI.scripts/wsl-bolt-udp-forward.ps1— new-Credential [PSCredential]parameter on-Installthat skips theGet-Credentialprompt when supplied. Human-interactive behaviour unchanged when omitted. This is what makes the Windows round-trip testable in CI at all..github/workflows/install-roundtrip.yml— three-OS matrix:ubuntu-latest(withloginctl enable-linger $USERso user-systemd starts without a login session)macos-14(Apple Silicon)windows-latestPath-filtered to install-machinery changes only, same as Add cross-platform background-service install (systemd/launchd/Windows) #81's
install-tests.yml.Safety
All drivers clean up after themselves on failure:
trap 'ec=$?; cleanup; exit $ec' EXIT(captures real exit code before cleanup runs)try { … } finally { Remove-LocalUser … }Safe to run locally if you don't mind a brief service install on your box.
Things found while writing this
set -u+ unset$USERkilled the script on a stripped container — falls back toid -unnowtrap 'cleanup' EXITwas swallowing the preflight'sexit 2— fixed withec=$?captureec=$?pattern inside the trap (disabled inline with a comment)Test plan
install-roundtripworkflowinstall-testsworkflow (the new round-trip ps1 + sh files are now in its shellcheck/PSScriptAnalyzer scope too)tests/install/roundtrip-linux.shshould pass once yousudo loginctl enable-linger $USER && sleep 2. From elevated Windows PowerShell,tests\install\roundtrip-windows.ps1should pass standalone (creates + removes its own user).Out of scope (still NOT tested)
mix phx.serveritself comes up clean under systemd/launchd (covered byelixir-ci.yml, not the install machinery).https://claude.ai/code/session_016BNGnVKCbN5FBXcTXRpDXy
Generated by Claude Code