test(e2e): run the e2e host agent under systemd, not bare docker exec - #237
test(e2e): run the e2e host agent under systemd, not bare docker exec#237sebastian-pf9 wants to merge 2 commits into
Conversation
spinUpByoHosts starts the agent via a plain attached `docker exec`, which the self-upgrade mechanism's os.Exit(0)-then-relaunch (ADR §2.2 step 5) depends on systemd's Restart=always to catch -- something that path never exercises. Adds spinUpByoHostsWithSystemdAgent, which installs the real service/pf9-byohostagent.service unit and starts the agent under it instead, plus a small spec proving the mechanism actually works: kill the agent PID directly, assert systemd relaunches it with a new PID in the same container. Needed three real fixes found by actually running this against docker/KIND before it passed: a repo-root-relative path (ginkgo's CLI runs the compiled suite with cwd set to the package dir, not the repo root), the unit's `--label "$REGION"` requiring key=value format, and docker's exec-attach stream being multiplexed (stdcopy framing) when Tty isn't set -- parsing it raw silently corrupted MainPID/ActiveState reads. Verified with a real GINKGO_FOCUS="AgentUpgradeHarness" run (1 Passed, 0 Failed). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
(Claude, prompted by Sebastian) Honest take: this PR is only partially worth its cost as submitted — it mixes genuinely necessary new coverage with redundant and unfinished parts. Worth keeping: the core premise is correct — Not worth it as-is:
Net: keep the rollout spec + systemd installer, cut the harness spec, resolve |
|
(Claude, prompted by Sebastian) Follow-up to my comment above — I left out something relevant to the actual reason this review got triggered: the overarching goal of making this repo independent of Platform9 by dropping the This PR doesn't advance that goal, and it goes slightly the other direction: it hardcodes several more Separately, worth noting for that rename effort specifically: every upgrade this PR exercises is a version bump of the identical package identity (old/new binaries both install as |
- Cut agent_upgrade_harness_test.go's [AgentUpgradeHarness] spec: it kill -9's the agent directly (production never does that -- it calls os.Exit(0) after a successful install) and only proves systemd's Restart=always fires, which the rollout spec already proves as a side effect of the real self-upgrade path (its own PID-change assertions). mainPID moved to agent_upgrade_systemd_helper_test.go, still used there. - Dropped buildFixtureAgentDeb's postinstFails parameter -- dead scaffolding for the not-yet-written halt-on-failure scenario (PR 3), only ever called with false. - Factored spinUpByoHostsCommon out of spinUpByoHosts/ spinUpByoHostsWithSystemdAgent, which duplicated the ByoHostRunner setup and container-leak-safe append ordering almost verbatim; the two functions now differ only in how they start the agent process (docker exec vs systemd unit install). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Actually do a rollout of upgrades. All hand-crafted systemd calls. Also doesn't validate of upgrade from older version actually works
not sure about this one