Repository navigation
ci: run the confined tests on Linux, and fail rather than skip - #18
Conversation
The confined launch tests and the live mount tests return early when the host has no unprivileged namespaces or no FUSE. They then pass, and the run does not show that they did not run. On CI (the CI variable is set) such a test now fails and says why. Elsewhere it still says that it skipped. The ledger tests do the same for PostgreSQL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ubuntu's AppArmor lets an unprivileged process create a user namespace but not map its uid in it. So the confined tests could not run on the runner, and CI skipped them without a message: the previous commit makes all four confined launch tests fail there. The check and coverage jobs now set kernel.apparmor_restrict_unprivileged_userns to 0 before the tests, as the harness spikes workflow does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comment said that a laptop allows unprivileged user namespaces. Stock Ubuntu does not: a laptop installs the amem profile in packaging/apparmor. The tests probe with unshare, not with amem, so the profile does not apply to them, and the runner turns the restriction off. The doc comment of the projection test now says that on CI a render is a failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The change is a small, well-reasoned test-and-CI adjustment that mirrors the established ledger CI-gating pattern, is backed by CI run evidence, and introduces no objective issues.
No open issues 🎉
What changed in this PR
This PR makes the Linux confined-launch and live-mount tests actually run on GitHub's CI instead of silently skipping. On ubuntu-latest, AppArmor blocks unprivileged uid mapping in a user namespace, so namespaces_available() returned false and four confined tests returned early and were reported as ok, meaning the Linux sandbox backend was never exercised in CI. The change turns a skip into a hard failure when the CI variable is set, and lowers the AppArmor sysctl in CI so the tests can run. This mirrors the existing pattern used by the ledger's PostgreSQL tests (crates/ledger/src/testing.rs), keeping test behavior consistent across the workspace.
Changes:
- Test helpers now assert (fail) when the capability is missing and
CIis set, while still skipping with a message locally:fuse_available()inlive.rs,namespaces_available()and the projection live-mount check inlaunch.rs. - CI
check (linux)andcoveragejobs runsysctl -w kernel.apparmor_restrict_unprivileged_userns=0before the tests. - Comment corrections in the touched files.
| File | Description |
|---|---|
crates/mount/tests/live.rs |
Adds fuse_available() which skips locally but fails on CI when FUSE is missing; both live tests now call it. |
crates/memory/tests/launch.rs |
namespaces_available() asserts on CI when namespaces are unavailable; the projection test fails on CI if it falls back to a render instead of a live mount. |
.github/workflows/ci.yml |
Lowers the AppArmor unprivileged-userns restriction in the check and coverage jobs so confined tests run. |
Review effort: Balanced
There was a problem hiding this comment.
🟢 Approval recommended
The change is a small, well-evidenced test and CI-config adjustment that follows the existing ledger skip-or-fail-on-CI convention, touches no production code, and contains no identified defects.
No open issues 🎉
Review effort: Balanced
On GitHub's Linux runner, the confined launch tests did not run. They passed only because they returned early. This PR makes them run, and makes them fail on CI when they cannot run.
The problem
Ubuntu's AppArmor lets an unprivileged process create a user namespace, but not map its uid in it. So on
ubuntu-latest,namespaces_available()incrates/memory/tests/launch.rsreturned false. Four confined launch tests printed "skipping" and passed. libtest reports such a test asok, so no CI run showed it. No CI job ran our Linux backend.The change
4e28991): a confined launch test or a live mount test now fails when theCIvariable is set and it cannot run. Elsewhere it prints that it skipped, as before. The ledger tests already do the same for PostgreSQL.d1faf0e): thecheck (linux)andcoveragejobs setkernel.apparmor_restrict_unprivileged_userns=0before the tests, as the harness spikes workflow does.Evidence
CI on commit 1 (run 40103433889): both Linux jobs failed. The cause was four confined launch tests, each with "unprivileged namespaces are not available, and on CI the confined tests must run":
confined_launch_has_no_network_and_no_host_homea_file_read_inside_the_sandbox_is_a_get_the_memory_servesa_session_s_projection_holds_its_own_render_and_nothing_another_lefta_launch_that_fails_after_rendering_leaves_no_render_behindSo these tests were skipped on every earlier CI run.
CI on commit 2 (run 40104400462): all checks passed. The confined tests ran, and so did the projection test, as a live mount, in both jobs.
Coverage rose from 91.63% to 91.86% of the same 41481 lines.
make checklocally: 620 tests, 620 passed.The live mount tests (
crates/mount/tests/live.rs) already ran on CI: FUSE is available there, and the sysctl does not affect it. Their change is only a guard for later.Adversarial pass
A fresh agent attacked
d1faf0e. It found nothing broken. It made each new assertion fail by removing what the test needs:unshareexited 1, andfusermountwas not on PATH. Its other findings:ci.ymlwas not accurate. Fixed in commit 3.mainand run CI again before they merge.dm_sandbox::linux::availability()) with no CI check. Those branches get the same check in a commit of their own.CI,CI=falseincluded, counts as CI. The ledger tests do the same. I kept it.unshare, notamem. So a laptop with the amem AppArmor profile and the restriction on skips the tests, althoughamemwould confine. This was already so before this PR, and a separate issue can track it.Posted by Claude on behalf of @sstriker