Repository navigation
tests: hermetic cello spawns, guardrail, pty and flake fixes - #81
Conversation
- common::cello_command / apply_hermetic_env / cello_binary: env_clear plus an explicit allowlist (PATH, TMPDIR, HOME in the fixture tempdir) plus per-test entries. - Documents why: CELLO_DEV_STATE, RUST_LOG, ambient proxies/TLS vars, and any stray CELLD_* (which makes cello refuse to start).
- Every TestNode::boot (and the two inline spawns plus the disk-full bash wrapper) builds its command with cleared env plus the test's explicit entries; behavior is otherwise unchanged. - The five files carrying local announced/forward_announce copies now share common/.
- Scans tests/*.rs for CARGO_BIN_EXE_cello outside common/; fails with the offending files and the helper to use.
- exec_rejects_pty_size_before_start and resize_refuses_non_pty_and_zero_dims reached asyncrt::timeout on their valid-size probes, which needs the process domain handle; they passed only when another test installed it first. - Both now call the shared ensure_domain installer, matching control_timeout_tests and lifecycle_tests.
- Import order and chain reflows only; no semantics.
- It scans the repo's own test sources on disk, not node storage; same allow as every other test file.
- refuse_renamed(vars) is pure over an env iterator; validate() passes std::env::vars_os(). - renamed_prefix_tests no longer touch process env, so parallel siblings and the harness env cannot race them.
- Removes the cfg(test) PROJECT_COUNT counter; the sharing test asserts Arc::ptr_eq plus node contents instead of exact global counts, which parallel tests inflated.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Security review record. Independent reviewer |
This closes the test-isolation Candidates.
tests/commongainscello_command, which runsenv_clear()and then applies an allowlist:PATH,TMPDIR, a per-projectHOME, plus explicit per-test env. All ~50 binary spawns in 40 test files now go through it.CELLD_FOO=1made the child refuse to start, andCELLO_DEV_STATEleaked writes outside the temp project.CELLD_X=1 CELLO_DEV_STATE=/tmp/x RUST_LOG=errorexported, and nothing writes outside the temp project.hermetic_spawn_guardrail.rsfails if any test outsidecommon/namesCARGO_BIN_EXE_cello.container::pty_testsorder dependency. Both tests now set up their own domain (ensure_domain). Each fails alone before the change (asyncrt::set_host_handle must run…) and passes alone after.env_vars::renamed_prefix_testsflake (from rename: celld → cello (crate, binary, CELLO_* env, paths, telemetry), v0.1.0 #79). The refusal check is now a purerefuse_renamed(vars), so the tests no longer mutate the process env. Before: 3/6 runs failed. After: 10/10 pass with a hostile env.PROJECT_COUNTflake. The globalcfg(test)counter is removed, and sharing is asserted withArc::ptr_eq. Before: it failed under a stress run (count 557550 vs 1).Verified: full
cargo test --profile release --locked --no-fail-fastunder the hostile env, all targets green; clippy-D warningsclean.Summary by CodeRabbit