Repository navigation
evetest: hold the purge end state across a reboot - #6280
Conversation
8302b68 to
e83ae8d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6280 +/- ##
==========================================
+ Coverage 26.15% 26.46% +0.31%
==========================================
Files 514 524 +10
Lines 94703 96419 +1716
==========================================
+ Hits 24771 25522 +751
- Misses 68021 68803 +782
- Partials 1911 2094 +183 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
4d56974 to
9f206f8
Compare
9f206f8 to
3c4f8d7
Compare
3c4f8d7 to
6499f39
Compare
6499f39 to
a1d30eb
Compare
e37c364 to
45adfdb
Compare
|
Claude finished @rene's task in 3m 19s —— View job Review complete
I reviewed the diff against Overall: solid, well-documented test code. The I posted two minor inline notes (no correctness bugs found):
Neither is blocking. The clock-sync assumption in the reboot-evidence predicate matches the existing |
| // Subscribe before the node goes down, so the first post-boot info message | ||
| // cannot be missed while the controller-reboot variant waits for it. | ||
| devUpdates, stopDevWatch := device.WatchDeviceInfo() | ||
| defer stopDevWatch() |
There was a problem hiding this comment.
Minor: this watcher is only consumed in the controller-reboot branch, but it's set up unconditionally. In the power-cycle branch devUpdates is never read, so its 100-slot channel fills and the forwarding goroutine (plus the underlying admin HTTP info stream) sits blocked until the deferred stopDevWatch() at the very end of the test.
Per-subscription isolation in adam.go means it can't stall the other subscribers, and at the ZiDevice publish rate it won't actually overflow, so this is benign — but it's needless for the power-cycle path. Cleaner to scope the subscribe/defer inside the powerCutControllerReboot case where it's the only consumer.
There was a problem hiding this comment.
Fixed — the subscribe and its defer are now inside the controller-reboot case.
| // toProto generates the raw disk image, publishes it on the image server and | ||
| // converts the reference into EVE protobuf ContentTree + DatastoreConfig. | ||
| func (image LocalRawDiskImage) toProto(th *TestHarness, log *logrus.Entry, |
There was a problem hiding this comment.
LocalRawDiskImage has no caller in this PR (acknowledged in the description), so its toProto path — the raw-disk generation, MaxDownloadBytes/SHA wiring, and delegation to HTTPStorage — is only checked by the compiler, never actually driven against a device. Adding unused harness API tends to bit-rot before its first real user. Given it's independent of the purge fix and you already offered to drop it, I'd suggest landing it in the PR that first uses it rather than as speculative groundwork here.
There was a problem hiding this comment.
@eriknordmark Agree with Claude. Let's remove it if not used or move it to another PR where it belongs.
There was a problem hiding this comment.
Dropped — the LocalRawDiskImage commit is out of this PR, so the diff is now just the test and its helper. It will come back in the PR that first uses it (the power-loss purge test).
A purge submitted while the node is down is already covered up to the moment it settles. The field failure that coverage comes from has a second half: a further reboot adds another copy of the volume without removing the first, so reaching the right end state once is not the same as holding it. The node is now rebooted again once the purge has settled, and the end-state assertions run again unchanged. Reusing them is the point -- the decisive check on the kube path, exactly one VMIRS named for the new generation, is what a resurrected generation would break, and the purge counter must not have moved either. A POWER_CUT_METHOD parameter also selects how the node is taken down while the purge is submitted. Alongside the existing power cut, controller-reboot uses a reboot command from the controller: zedagent stops parsing a configuration as soon as it sees a new reboot counter, so a purge submitted after that command is deferred to the next boot just as an outage defers it. That reaches the same window through configuration parsing rather than by pulling the power, and so also covers a purge deferred by an orderly reboot. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
45adfdb to
49909cc
Compare
|
Rebased on master. On the red Eden job: the failing script is |
|
The |
Description
A purge submitted while the node is down is already covered by
TestVMAppPurgeAfterPowerCycle(#6257), but only up to the moment it settles.The field failure that coverage comes from has a second half: a further reboot
adds another copy of the volume without removing the first. Reaching the right
end state once is not the same as holding it across a boot, and nothing
currently checks the difference.
evetest: hold the purge end state across a rebootadds a phase thatreboots the node once the purge has settled and re-runs the existing end-state
assertions unchanged. Re-using them rather than writing new ones is the point:
the decisive check on the kube path — exactly one VMIRS named for the new
generation — is precisely what a resurrected generation would break, and the
persisted purge counter must not have moved either.
The same commit adds a
POWER_CUT_METHODparameter selecting how the node istaken down while the purge is submitted. Alongside the existing power cut,
controller-rebootuses a reboot command from the controller: zedagent stopsparsing a configuration as soon as it sees a new reboot counter, so a purge
submitted after that command is deferred to the next boot just as an outage
defers it. That reaches the same window through configuration parsing rather
than by pulling the power, so it also covers a purge deferred by an orderly
reboot rather than by a crash.
controller-rebootis the stronger of the two methodsWorth knowing when deciding which method CI should run. On the power-cycle
path, the phase-5 waits are satisfied by state cached from before the outage —
WaitForClusterNodeIsReadyreturns on itsGetClusterInfo()pre-check andWaitUntilAppIsRunningon its snapshot replay — so both return within a secondof the node coming back and assert nothing. A controller reboot is orderly, so
the newest state the controller holds is
HALTED, and the same waits genuinelyhave to observe the app return.
That makes phase 5's doc comment ("a purge wedged on a volume-ref removal never
gets past this point, so the wait is itself an assertion") true on the
controller-reboot path and aspirational on the power-cycle one. It also moves
where the time is spent: the purge assertions that follow take about four
minutes of a five-minute budget after a power cut, and three seconds after a
controller reboot, because in the latter case phase 5 has already absorbed the
convergence.
Notes for review
assertNoOrphanedPVCsis commented out on Kubevirt inmaster, becausesweepStaleGenerationsdeletes the old VMIRS and its pod but not its PVC. Thereboot phase added here does not depend on that assertion, but a stale PVC is
the other half of the same story and is still uncovered.
The reboot phase gets its own budget,
postRebootEndStateTimeout, rather thanreusing
purgeEndStateTimeout. It has to clear pillar's boot-retry interval(
timer.boot.retry, default ten minutes): a reboot can land domainmgr'sworkload create before kubevirt's virt-api is serving, and the validating
webhook then refuses the connection, which marks the domain
BootFailed.maybeRetryBootleaves it that way until the interval elapses, so a budgetbelow ten minutes reports that transient race as a purge that did not hold.
This was observed once on a device — the app sat
BROKENwithBootFailed=trueandTriedCount=1for the full five minutes the old budgetallowed. Whether domainmgr should react to an unreachable webhook faster than
the generic boot-retry timer is a separate question, and this test only needs
to not misreport it.
How to test and validate this PR
GOWORK=off go vet ./tests/...andGOWORK=off go test -count=1 -run '^$' ./tests/...fromevetest/. (go build ./tests/...compiles nothing there —every package under
tests/is test-files-only.)On a device,
make evetest NAME=TestVMAppPurgeAfterPowerCycle, or the wholeNAME=TestAppsSuite, where it already runs last. AddPOWER_CUT_METHOD=controller-rebootfor the new deferral path.Run on amd64 against
0.0.0-master-baseline-f9408900, a master build carrying#6257:
POWER_CUT_METHODMargins on that hardware, against the budgets in
purge_helpers_test.go:the controller reboot was observed at 141 s and 175 s against
deviceRebootTimeout's five minutes, which is the tightest of the new budgets;the reboot in the new phase at 74–86 s; the new phase's assertions at 86 s.
Two limits on what those runs establish. The image is 70 commits behind current
master, ten of them on the purge and kubevirt paths, so it does not exercisetoday's code on those paths. And
postRebootEndStateTimeoutis sized fromtimer.boot.retryrather than validated against the failure it exists for: thewebhook race did not recur on the passing run, which therefore says nothing
about the raised budget. Not run on arm64.
Changelog notes
No user-facing change — test and test-harness only.
PR Backports
Not applicable.
Checklist
Reasons for the unchecked boxes: no documentation change — this is test and
harness code only. Not run on arm64.