Skip to content

feat(LinuxTentacleE2E): Phase 12.M.L.B.1 — service install/uninstall happy path E2E

Placeholder ppxd requested to merge phase12.M.L.B.1-service-install-uninstall into main

Summary

First Section B test using the real Squid.Tentacle binary built by J.M.L.B.0's LinuxTentacleBinaryFixture. Drives the documented post-install operator workflow:

sudo squid-tentacle service install --service-name <unique>
sudo squid-tentacle service uninstall --service-name <unique>

Both scenarios in one test for ROI — install + uninstall share setup; uninstall is the natural cleanup of install.

Why ship-blocking

Without these E2E pins, regressions ship silently and only surface when an operator's first install fails to produce a running service:

  • Unit-file path drift (e.g. /etc/systemd/system/ → /lib/systemd/...) → operators can't find the unit
  • daemon-reload step removed → unit written but systemd doesn't see it
  • enable step regression → unit installed but doesn't start on boot; reboot kills the agent
  • ExecStart path drift → systemd 203/EXEC failure loop

Test mechanism

Aspect Choice
Service name GUID-suffixed (parallel-safe + cleanup-isolated)
Binary Real production (built by J.M.L.B.0 fixture) — Tier 🟢 H
Sudo wrapper Binary writes /etc/systemd/system/ + runs systemctl (needs root)
File checks SudoFileExists / SudoReadAllText (J.M.L.A.5.3 helpers)
Fall-back cleanup Dispose runs systemctl stop/disable/rm directly if production CLI uninstall path failed

Assertions

Install:

Assertion Pins
exitCode == 0 Whole install chain succeeded
stdout logs "Created /etc/systemd/system/<name>.service" Unit-file path contract
Unit file exists at expected path (sudo check) Production behaviour
Unit file contains [Service] + ExecStart= Unit content shape
systemctl is-enabled <name> returns 0 Service will run on boot

Uninstall:

Assertion Pins
exitCode == 0 Uninstall chain succeeded
Unit file does NOT exist after Cleanup contract

What's NOT asserted

systemctl is-active. The unit's ExecStart is squid-tentacle run which requires registered config we don't have in this test — systemd would either fail-fast or hang. is-enabled is the operator-meaningful "service will run on next boot" contract, which is what install must guarantee.

is-active checking is deferred until J.M.L.C.1 lands a register flow — once the agent has config, the service can actually start.

Fidelity tier

🟢 High (Rule 12.4): real production binary + real systemd + real /etc/systemd/system/ writes + real systemctl orchestration.

Test class is in LinuxTentacleHostStateCollection (serializes against upgrade + install + service-fixture + binary-smoke tests on shared host state).

Expected runtime: ~3-5s.

Test plan

  • Linux E2E workflow runs (manual workflow_dispatch after merge)
  • B1h_ServiceInstall_WritesUnitFileAndEnablesIt passes within ~10s
  • No regression on existing 28 Linux E2E tests
  • Cleanup matrix in Dispose runs cleanly even on assertion-failure paths

🤖 Generated with Claude Code

Merge request reports

Loading