Repository navigation
feat(system-tests): boot nested VMs on the local backend - #11265
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Enables nested VM system tests on the local QEMU backend while preserving Farm behavior.
Changes:
- Adds local SetupOS boot, resource, networking, and NNS registration support.
- Provides local DNS/SNTP services required by SetupOS.
- Enables the registration test locally and adds safety around GPT image alignment.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
rs/tests/nested/src/util.rs |
Whitelists local nested-node registration traffic. |
rs/tests/nested/src/lib.rs |
Reduces local nested VM memory allocation. |
rs/tests/nested/BUILD.bazel |
Enables local registration testing and updates TODOs. |
rs/tests/driver/src/driver/test_env_api.rs |
Removes obsolete empty-disk URL helpers. |
rs/tests/driver/src/driver/serve_ntp_task.rs |
Implements and tests the local SNTP server. |
rs/tests/driver/src/driver/resource.rs |
Selects backend-appropriate empty disks. |
rs/tests/driver/src/driver/nested.rs |
Corrects the raw config-image extension. |
rs/tests/driver/src/driver/mod.rs |
Exposes the NTP task module. |
rs/tests/driver/src/driver/local_backend.rs |
Adds NTP DNS records and GPT-safe alignment. |
rs/tests/driver/src/driver/ic_images.rs |
Adds backend-aware SetupOS and empty-disk selection. |
rs/tests/driver/src/driver/group.rs |
Runs NTP as a supervised local task. |
rs/tests/driver/src/driver/bootstrap.rs |
Boots nested VMs locally and selects a reachable NNS URL. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
basvandijk
commented
Aug 21, 2026
basvandijk
commented
Aug 21, 2026
basvandijk
commented
Aug 22, 2026
basvandijk
commented
Aug 22, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.
Suppressed comments (1)
rs/tests/driver/src/driver/bootstrap.rs:586
- The Local branch panics before reaching the dummy fallback when no IC/NNS was created:
TopologySnapshot::root_subnet()callsroot_subnet_id(), which explicitly panics if the registry has no root subnet (test_env_api.rs:547-559). This breaks the existing//rs/tests/node:launch_single_host_localsetup, which starts onlyNestedNodesand intentionally creates no IC infrastructure. Guard the topology lookup (for example withenv.prep_dir("")) and use the dummy URL when no prep state exists.
SystemTestBackend::Local => env
.topology_snapshot()
.root_subnet()
.nodes()
.next()
basvandijk
changed the base branch from
master
to
bas/local-backend-gateway-cert
August 22, 2026 22:48
basvandijk
force-pushed
the
bas/local-backend-nested
branch
from
August 23, 2026 00:12
2476795 to
688f7e0
Compare
basvandijk
force-pushed
the
bas/local-backend-nested
branch
from
August 23, 2026 01:04
688f7e0 to
c237df4
Compare
basvandijk
marked this pull request as ready for review
August 24, 2026 13:29
The function had become functionally identical to the code it replaced (modulo extra logging), so restore the original inline block to keep the diff small, as requested in review. Co-Authored-By: Claude Fable 5 <[email protected]>
The `let mut ic` split only existed so the Local backend could insert `with_group_wide_firewall_whitelist()` before starting; that conditional went away when nested nodes started registering through the ic-gateway, so put the original method chain back. The file now matches master. Co-Authored-By: Claude Fable 5 <[email protected]>
frankdavid
suggested changes
Aug 26, 2026
Trim or delete the comments review flagged as bloat, rewrite the two nested BUILD.bazel TODOs to say plainly why the prebuilt-mainnet-image targets stay pinned to Farm, and read the GPT signature with read_exact_at instead of seek + read_exact. Co-Authored-By: Claude Fable 5 <[email protected]>
frankdavid
approved these changes
Aug 26, 2026
pull Bot
pushed a commit
to bit-cook/ic
that referenced
this pull request
Aug 26, 2026
…name (dfinity#11270) ## Problem On the local backend the ic-gateway served a **self-signed** certificate for **`<vm name>.local`**. Neither half is usable from inside the group, so every client papered over both — a `reqwest` resolve override plus `danger_accept_invalid_certs`. That works for driver-side clients and for nothing else. A *node* has no such knobs, which is why a nested node on this backend registers straight against a replica's `:8080` instead of going through the gateway as it does on Farm — and why it needs `with_group_wide_firewall_whitelist()` to get there. Both halves turn out to be fixable without touching any node. ## The domain `<vm name>.ic.net`, registered with the group's `dnsmasq` through `add_dns_record` — the same mechanism `setup_api_bn_local_playnet` already uses for `apibn-{idx}.ic.net`. The suffix becomes one shared constant. It could not have stayed under `.local`: GuestOS and HostOS resolve through systemd-resolved, which routes `*.local` to mDNS and never to the unicast `DNS=` servers `dnsmasq` answers on. No amount of dnsmasq configuration would make such a name resolve in a guest. Only the apex is registered — a hosts file has no wildcards, and nothing inside a VM resolves a canister subdomain today. A wildcard would mean `--address=/<domain>/<addr>` on dnsmasq's command line, which `SIGHUP` does not re-read. ## The certificate Issued by the **dev root CA** instead of self-signed. That CA is already in every *dev* IC-OS image's trust store — `ic-os/{guestos,hostos}/context/Dockerfile` installs `canister_http_test_ca.cert` and runs `update-ca-certificates`, in the `output_dev` stage only — and its private key is checked in beside it. This is how `canister_http` and `ckbtc` already serve HTTPS that nodes accept, and the `dev-certs/README.md` documents exactly this use. So a node reaches the gateway with no node side configuration: no config-image plumbing, no `CONFIG_VERSION` bump, no production code change. Production images are unaffected — the CA lives in the `output_dev` stage. This deliberately does **not** extend to the API boundary nodes, whose ephemeral CA stays as it is. `nns_delegation_manager` builds its root store from the compiled-in `webpki_roots` and never consults `/etc/ssl/certs`, which is precisely why `extra_api_boundary_node_trust_anchors_pem` exists; the client that reaches the *gateway* is a different one (the orchestrator's `ic-agent`, which goes through `rustls-platform-verifier` → the OS store). ## Driver side `uses_self_signed_cert` gives way to `root_certificate()`. `reqwest` *adds* an extra root to the platform's own rather than replacing them, so clients now verify the chain instead of skipping verification. `resolve_override_for_url` stays: the driver sits in the group's network namespace but reads the host's `/etc/resolv.conf`, whose nameserver is unreachable from there, so driver-side DNS is dead regardless of what `dnsmasq` knows. Fixing that means giving the driver a mount namespace, which is left for its own change. Two mechanical additions: `x509-parser` in `rcgen`'s features, for `CertificateParams::from_ca_cert_pem`; and `rsa`, to re-encode the checked-in PKCS#1 CA key as the PKCS#8 that `rcgen`'s `ring` backend requires. ## Verification `dfx_smoke_test_local` and `nns_dapp_test_local` both pass, fetching canister assets over `https://<canister id>.ic-gateway.ic.net` with the chain verified rather than accepted blindly. `dfx_smoke_test` and `nns_dapp_test` still pass on Farm. dfinity#11265 will be restacked on top of this, dropping its plain-HTTP nested path and the group-wide firewall whitelist that goes with it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
lwshang
approved these changes
Aug 26, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Aug 26, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Aug 26, 2026
AleDema
pushed a commit
to AleDema/ic
that referenced
this pull request
Oct 11, 2026
The local system-test backend now runs an NTS time server for each test group, so the VMs of `_local` system tests synchronize their clocks to the host, as Farm VMs do with the public time servers. # Why The VMs seed their clocks from QEMU's emulated RTC, which only has whole-second resolution, and their chrony can't reach any time server from the backend's network namespace. So nodes stay up to ~2s apart for the whole test. A node whose clock runs ahead has its block proposals deferred by its peers, which made `query_stats_above_threshold_local` flake (dfinity#11771). A plain NTP server is not enough. IC-OS's `chrony.conf` pairs 14 NTS servers with two plain pools. Under chrony's default `authselectmode mix`, the NTS sources then get the `require` option, so chrony only adjusts the clock while an NTS source is selectable. Names that never resolve count too. dfinity#11265 tried a plain server and reverted it for this reason ("Can't synchronise: no required source in selectable sources"). # How - `create_group` starts ntpd-rs, bound to the group's gateway address. It answers NTS key exchanges (tcp/4460) and NTP (udp/123) and serves the host's clock as stratum 1 (`local-stratum = 1`). It has no sources of its own, so it never adjusts the host clock. - It presents a certificate for `time.cloudflare.com`, the first NTS server in `chrony.conf`. The certificate is issued from the dev root CA, which dev GuestOS and HostOS images trust and which the backend already uses for the IC gateway's certificate. - The group's dnsmasq resolves `time.cloudflare.com` to the gateway (and answers its A query with an empty NOERROR). - `delete_group` stops the server and logs its log, which names every VM that completed a key exchange. That is the only record for VMs whose journals are not streamed, such as API boundary nodes and nested HostOS. - ntpd-rs comes from its 1.9.0 release `.deb` (amd64, so the target is x86_64-only), extracted like the OVMF firmware. # Limitations - **First sync takes ~30s after chronyd starts.** chronyd's first DNS lookup happens before GuestOS networking is up, and chrony only retries 28s later. Offsets under 1s are then slewed, which takes up to 12s more. A test whose setup is fast can therefore start before the clocks are in sync. This is why we still need dfinity#11771: `query_stats_above_threshold_local` can run its first queries before its nodes are in sync, so it keeps the larger `unit_delay` that tolerates the skew. - **Production images aren't covered.** Production IC-OS images don't trust the dev CA, so nodes booted from them stay unsynchronized as before. That includes the mainnet versions some upgrade and compatibility tests start from. SetupOS doesn't trust the dev CA either, but its NTP check is already skipped in test images. # Verification - chronyd 4.8 (the GuestOS version) with IC-OS's unmodified `chrony.conf` against this ntpd-rs configuration, in a private network namespace: the source was NTS-authenticated and selected 8s after start. - `//rs/tests/query_stats:query_stats_above_threshold_local`, run twice: all 5 nodes logged `Selected source <gateway> (time.cloudflare.com)`. At the end of the test, chrony reported a ~2µs offset on every node. - `//rs/tests/nested:registration_local`: the system node, the API boundary node and the nested HostOS completed NTS key exchanges. SetupOS failed the TLS handshake, as expected. # Side finding The same `authselectmode mix` rule applies in production: the "INSECURE POOL (FALLBACK)" in `chrony.conf` never acts as a fallback, because chrony won't adjust the clock from the pools while no NTS source is selectable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.
Problem
Nested system-tests (
rs/tests/nested) drive the whole node deployment chain: SetupOS installs HostOS onto a blank disk, HostOS boots a nested GuestOS VM, and that GuestOS registers with the NNS. All five non-bare-metal targets were pinned to Farm becausesetup_and_start_nested_vmswas not supported on the local backend.What was missing
Three things in the driver:
DiskImage::Urlwhose_URLvariablerun_systest.shnever sets under the local backend;setup_and_start_nested_vmsneeded itsLocalarm;NESTED_CONFIG_IMAGE_PATHclaimed.zstfor a file nothing compresses, which the local backend would have rununzstdover.The fourth — the nested node's NNS URL — is what #11270 is for. A node that is not in the registry yet cannot pass the replicas' firewall, so it registers through the ic-gateway; that needed the gateway to be reachable by name and trusted, which it now is on both backends.
nested_nns_urlis consequently backend-agnostic.Also:
pad_to_request_alignmentnow refuses a GPT image rather than silently displacing its backup header, and the nested VM drops from 32 GiB to 16 GiB — the floor, since the driver takes 8 GiB off and HostOS then takes 4 more, leaving the GuestOS the same 4 GiB every other node VM gets. That reduction applies on Farm too; all 20 Farm nested targets pass with it.The blocker: SetupOS halts because chrony can never synchronise
check-ntp.shis the one SetupOS check not gated onic.setupos.run_checks, sosetupos-disable-checksdoes not skip it. It waits 60s forNTPSynchronizedand then halts the installation forever —log_and_halt_installation_on_errorends insleep infinity.Serving NTP to the group ourselves does not fix it, and the first two commits here do exactly that before it is reverted. chrony's
authselectmodedefaults tomix, andsources.cthen marks the authenticated sourcesrequired as soon as both authenticated and unauthenticated sources are configured — precisely whatchrony.confdoes in pairing fourteenntsservers with two plain pools. Sources configured from names that never resolve still count. So the clock can only ever be synchronised from one of those fourteen NTS servers; the driver's SNTP server was polled every 64s for a whole run and never selected, with chronyd saying so in the node journals:Reproduced against chronyd 4.8 directly: given that config shape it polls a reachable plain server for 100s without selecting it, and selects it in 4s once
authselectmode ignoreis added. Satisfying the check for real would mean serving NTS under one of those fourteen hostnames with a certificate the guest trusts, which no test harness can arrange.So the check is gated instead, like the four that also need connectivity, and the reasoning is recorded on
check_ntp. Nothing is lost: every test VM takes its clock from the hypervisor via-rtc base=utc.Scope
registrationand both*_upgrade_smoke_testtargets are un-pinned, along with the_head_nnsvariantssystem_test_nnsgenerates from them —backendis per target definition. All six were run locally before dropping the pins.The two
*_from_latest_release_to_currenttargets stay pinned: they install from a prebuilt mainnet SetupOS image, of whichsetupos-disable-checkscan only rewrite the grub boot args, so theircheck-ntp.shpredates this gate.One thing for reviewers to weigh: this takes the non-manual nested
_localtargets from two to six, andsystem_tests.bzl:342reserves CPU only —ceil(cpus / cpus_oversubscription_factor)= 9 of the 27 these declare — with no accounting for memory or disk. Three can therefore run concurrently on a 32-core runner, for ~84 GiB of nominal VM memory and ~60 GiB of qcow2 overlays.cpus_oversubscription_factor = 1would serialise them if that turns out to matter; no target in the repo sets it today, so this is left at the default.🤖 Generated with Claude Code