fix(terminal): skip PTY tests when no PTY can be allocated (VA-64) #68

Merged
nrupard merged 1 commit from fix/VA-64-pty-tests-skip-without-pty into main 2026-06-19 18:03:25 +02:00
Owner

Fixes the racy host::terminal PTY unit-test failures in CI (oci-build/check.Dockerfile RUN cargo test). See VA-64.

Problem

echo_through_cat_round_trips, close_kills_child_and_pushes_terminal_exit, and resize_does_not_error_on_live_session open a real PTY via portable-pty openpty. A docker build RUN sandbox does not reliably mount /dev/pts (unlike docker run / docker compose run), so openpty intermittently fails with Pty("No such file or directory"). The failure is racy - in one CI run the echo test passed while the other two panicked on .expect("spawn"), failing the whole build check and blocking unrelated PRs.

Fix

Add a pty_available() probe to the test module; the three PTY tests skip (early return, no assertion) when openpty cannot allocate, instead of failing. They still run and assert wherever a PTY is available (dev hosts, docker run). open_with_missing_program_returns_pty_error is unaffected (it expects a Pty error either way). Test-only change; no production code touched.

Verification

check.Dockerfile (fmt + clippy --deny warnings + build + cargo test --workspace --lib) passes. On a host with a PTY the three tests execute and pass; in the no-devpts sandbox they skip.

Fixes the racy `host::terminal` PTY unit-test failures in CI (`oci-build/check.Dockerfile` `RUN cargo test`). See VA-64. ## Problem `echo_through_cat_round_trips`, `close_kills_child_and_pushes_terminal_exit`, and `resize_does_not_error_on_live_session` open a real PTY via `portable-pty` `openpty`. A `docker build` RUN sandbox does not reliably mount `/dev/pts` (unlike `docker run` / `docker compose run`), so `openpty` intermittently fails with `Pty("No such file or directory")`. The failure is racy - in one CI run the echo test passed while the other two panicked on `.expect("spawn")`, failing the whole build check and blocking unrelated PRs. ## Fix Add a `pty_available()` probe to the test module; the three PTY tests skip (early `return`, no assertion) when `openpty` cannot allocate, instead of failing. They still run and assert wherever a PTY is available (dev hosts, `docker run`). `open_with_missing_program_returns_pty_error` is unaffected (it expects a `Pty` error either way). Test-only change; no production code touched. ## Verification `check.Dockerfile` (fmt + clippy `--deny warnings` + build + `cargo test --workspace --lib`) passes. On a host with a PTY the three tests execute and pass; in the no-devpts sandbox they skip.
fix(terminal): skip PTY tests when no PTY can be allocated
Some checks failed
Create release / Create release from merged PR (pull_request) Has been skipped
Check / clippy + fmt + tests (pull_request) Has been cancelled
8c805bcdee
The terminal tests that open a real PTY (echo_through_cat_round_trips, close_kills_child_and_pushes_terminal_exit, resize_does_not_error_on_live_session) panic with Pty("No such file or directory") in the check.Dockerfile build sandbox, which does not reliably mount /dev/pts (unlike docker run / compose run). The failure is racy: in one CI run the echo test passed while the other two failed, failing the whole check.

Add a pty_available() probe to the test module and skip (return early, no assertion) when openpty fails, instead of failing the build. The tests still run and assert wherever a PTY is available. open_with_missing_program_returns_pty_error is unaffected: it expects a Pty error and gets one whether openpty or exec fails.

#VA-64
nrupard deleted branch fix/VA-64-pty-tests-skip-without-pty 2026-06-19 18:03:25 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/vervain-agent!68
No description provided.