fix: deflake //rs/tests/node:guestos_no_failed_systemd_units#10037
Draft
basvandijk wants to merge 1 commit intomasterfrom
Draft
fix: deflake //rs/tests/node:guestos_no_failed_systemd_units#10037basvandijk wants to merge 1 commit intomasterfrom
basvandijk wants to merge 1 commit intomasterfrom
Conversation
Retry the nftables reload up to 5 times in reload_nftables.service to absorb transient failures (e.g. nss_icos hostname resolution hiccups, or nftables.service being momentarily restarting). Without a retry, a single transient failure leaves this oneshot unit stuck in the failed state until the orchestrator rewrites nftables.conf again, which only happens on content change. The guestos_no_failed_systemd_units test then panics because 'systemctl list-units --failed' reports reload_nftables.service.
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.
Root cause
In the last week,
//rs/tests/node:guestos_no_failed_systemd_unitsflaked twiceon master / PR branches. In both cases the assertion in
rs/tests/node/guestos_no_failed_systemd_units.rs:40panicked becausesystemctl list-units --failedon the GuestOS node reported:reload_nftables.serviceis a path-activatedType=oneshotunit that runsnft flush ruleset && systemctl reload nftables.servicewhenever theorchestrator-generated
/run/ic-node/nftables-ruleset/nftables.confchanges.A previous fix (#9857) added
After=nss-lookup.targetbecausenftresolves thehostoshostname via thenss_icosNSS plugin and wouldfail with "Could not resolve hostname" if name resolution wasn't ready yet.
That ordering is necessary but not sufficient: any transient failure of
systemctl reload nftables.service(e.g.nftables.servicemomentarilyrestarting, a brief
nss_icoshiccup) leaves this oneshot unit stuck in thefailedstate. Because the unit is purely path-activated and the orchestratoronly rewrites
nftables.confon content change, there is no automatic retry,so the failure persists until the next content change — long enough for the
test assertion to observe it.
Fix
Retry the reload up to 5 times with a 2s sleep in between. This absorbs
transient failures and lets the unit finish successfully without changing the
overall semantics (still
Type=oneshot, still triggered by the path unit).Verification
Ran 3 parallel iterations locally; all passed:
PR was created following the steps in
.claude/skills/fix-flaky-tests/SKILL.md.