Skip to content

fix: deflake //rs/tests/consensus/upgrade:upgrade_downgrade_unassigned_nodes_test - #11412

Merged
pierugo-dfinity merged 2 commits into
masterfrom
ai/deflake-upgrade_downgrade_unassigned_nodes_test-2026-09-01
Sep 4, 2026
Merged

fix: deflake //rs/tests/consensus/upgrade:upgrade_downgrade_unassigned_nodes_test#11412
pierugo-dfinity merged 2 commits into
masterfrom
ai/deflake-upgrade_downgrade_unassigned_nodes_test-2026-09-01

Conversation

@basvandijk

@basvandijk basvandijk commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

This PR slightly rewrites the upgrade system tests code to reuse duplicated constants and sets the same timeout to all of them. In particular, upgrade_downgrade_unassigned_nodes_test now has the same timeout as its siblings upgrade_downgrade_{app,nns}_subnet_test. This deflakes the former as it was occasionally timing out.

🤖 Generated with Claude Code
👨 Revised by @pierugo-dfinity

…d_nodes_test

The test performs two sequential GuestOS upgrades of the unassigned node,
each polled with a 600s retry budget, but sets no driver timeouts, so the
SystemTestGroup default per-test timeout of 10 minutes applies: a single
exhausted poll alone eats the whole budget by design. The bazel test_timeout
also defaulted to "long" (900s), leaving ~700s for setup + test + teardown.

Give the test explicit driver timeouts covering its own worst case
(25min per test / 30min overall) and set test_timeout = "eternal" on both
targets sharing the binary, like the upgrade_downgrade_*_subnet_test
siblings in this package.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The timeout hierarchy is consistent with sibling upgrade tests and safely covers both polling budgets.

Pull request overview

Extends timeout budgets to prevent legitimate dual GuestOS upgrades from exceeding test limits.

Changes:

  • Adds 30-minute overall and 25-minute per-test driver timeouts.
  • Sets related Bazel targets to the eternal timeout class.
File summaries
File Description
rs/tests/consensus/upgrade/upgrade_downgrade_unassigned_nodes_test.rs Configures explicit driver timeouts.
rs/tests/consensus/upgrade/BUILD.bazel Extends Bazel timeouts for both variants.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

pull Bot pushed a commit to mikeyhodl/ic that referenced this pull request Sep 2, 2026
…-hook socket (dfinity#11413)

# Why

While root-causing a flake of
`//rs/tests/consensus/upgrade:upgrade_downgrade_unassigned_nodes_test_head_nns`
(2026-08-28 17:40 UTC), the unassigned GuestOS node turned out to have
**no working DNS for its entire ~11-minute life**:

* 443 × enforced SELinux denials in its journal:
  ```
avc: denied { connectto } for comm="systemd-resolve"
path="/run/systemd/resolve.hook/io.systemd.Network"
scontext=...:systemd_resolved_t:... tcontext=...:systemd_networkd_t:...
tclass=unix_stream_socket permissive=0
  ```
* 790 × `Failed to start query: Permission denied` from systemd-resolved
— every DNS lookup failed;
* consequently, all 58 of the orchestrator's attempts to download the
elected GuestOS upgrade image failed within ~2 ms (`error sending
request`), zero bytes ever fetched, and the test timed out.

systemd-resolved connects to systemd-networkd's varlink "resolve hook"
socket (`/run/systemd/resolve.hook/io.systemd.Network`) to obtain
per-link DNS configuration. Our policy does not allow that `connectto`,
so the denial fires on **every** boot (a single `Failed to connect to
resolve.hook: Permission denied` appears in healthy boots too). Usually
resolved still ends up with working DNS through other paths;
nondeterministically — as in this run — it does not recover and the node
is left without name resolution, with no self-healing for the rest of
the boot. SSH/IP-based connectivity keeps working, which is why the node
looks healthy to the test driver while every DNS-dependent operation
(such as upgrade-image downloads) is dead.

## Fix

Allow the connection in the `systemd-fixes` policy module:

```
allow systemd_resolved_t systemd_networkd_t : unix_stream_socket { connectto };
```

(The sock-file write permission is evidently already granted — the
denial fires on the final `connectto` check.)

## Validation

* `bazel build //ic-os/guestos/envs/dev:rootfs-tree.tar` — pass (this is
the action that compiles the SELinux policy modules via the refpolicy
devel Makefile, so it validates the new rule);
`//ic-os/components:check_unused_components_test` — pass.
(`dev_component_file_references_test` fails identically on unmodified
master on this machine — a local `UnicodeDecodeError` reading the
`open_rootfs_dev` binary — so it is left to CI.)

Found while root-causing the `//rs/tests/consensus/upgrade:...`
flakiness following `.claude/skills/fix-flaky-tests/SKILL.md`. The
tightened driver/bazel timeouts for the affected test are in dfinity#11412.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@basvandijk
basvandijk marked this pull request as ready for review September 3, 2026 07:16
@basvandijk
basvandijk requested a review from a team as a code owner September 3, 2026 07:16
@basvandijk
basvandijk enabled auto-merge September 3, 2026 07:16

@pierugo-dfinity pierugo-dfinity left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Bas for looking into it. Maybe we could tell Claude to yap less in PR descriptions. To me, just saying

This aligns the test with its siblings in this package (upgrade_downgrade_{app,nns}_subnet_test set 30–35 min driver timeouts and test_timeout = "eternal")

was enough of a justification, the precise timeout numbers don't matter much. The Note on an independent bug and the whole Validation paragraph could also be trimmed out.

Comment thread rs/tests/consensus/upgrade/upgrade_downgrade_unassigned_nodes_test.rs Outdated
@basvandijk
basvandijk disabled auto-merge September 3, 2026 07:36
@pierugo-dfinity
pierugo-dfinity added this pull request to the merge queue Sep 4, 2026
Merged via the queue into master with commit f5e9f99 Sep 4, 2026
43 checks passed
@pierugo-dfinity
pierugo-dfinity deleted the ai/deflake-upgrade_downgrade_unassigned_nodes_test-2026-09-01 branch September 4, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants