add: captured OpenVPN fixtures and a loopback capture lab #90

Merged
mysticalsoap merged 2 commits from change/service-client into trunk 2026-08-20 12:53:18 -04:00
Owner

Problem

The OpenVPN parsing units' only test lines were typed from memory — the exact failure mode that let the 2.7 DCO device-line break go unnoticed until a live session ran (#26). No real captures existed for the management stream at all, since it travels over the socket and is never logged.

Fix

  • tests/fixtures/: real OpenVPN 2.7.6 output. DCO session and auth failure came from the service's own field log (server IPs swapped for TEST-NET); userspace session, ping-restart reconnect and auth-failure management-stream transcripts came from a new loopback capture lab.
  • tests/manual/ovpnlab/: the lab — a real 2.7.6 server+client pair over loopback inside unshare -rn, so no root, no VPN account, no network. Re-run after an OpenVPN upgrade and diff against the committed fixtures. Deterministic capture via management-hold with reactive release (the hold re-engages on every restart; an auth-failure session lives ~300ms).
  • The captures found one real gap: userspace mode announces the device a second time as lowercase tun/tap device [tun0] opened, which the case-sensitive regex missed — now re.IGNORECASE.
  • New tests replay the transcripts through mgmt.parse_event (event sequences per scenario, CRLF framing intact) and the session logs through parse_tun_device.

Verification

  • Full suite: 134 passed (the two test_mgmt socket tests need an unsandboxed run; unix sockets are blocked in the agent sandbox — not a code issue).
  • Lab re-run produces stable transcripts across runs; auth-failure >PASSWORD:Verification Failed: 'Auth' wording confirmed against the real interface, matching the parser's assumption.
  • Fixture regression: the lowercase device line fails the old regex and passes the new one.

Refs #26.

**Problem** The OpenVPN parsing units' only test lines were typed from memory — the exact failure mode that let the 2.7 DCO device-line break go unnoticed until a live session ran (#26). No real captures existed for the management stream at all, since it travels over the socket and is never logged. **Fix** - `tests/fixtures/`: real OpenVPN 2.7.6 output. DCO session and auth failure came from the service's own field log (server IPs swapped for TEST-NET); userspace session, ping-restart reconnect and auth-failure management-stream transcripts came from a new loopback capture lab. - `tests/manual/ovpnlab/`: the lab — a real 2.7.6 server+client pair over loopback inside `unshare -rn`, so no root, no VPN account, no network. Re-run after an OpenVPN upgrade and diff against the committed fixtures. Deterministic capture via `management-hold` with reactive release (the hold re-engages on every restart; an auth-failure session lives ~300ms). - The captures found one real gap: userspace mode announces the device a second time as lowercase `tun/tap device [tun0] opened`, which the case-sensitive regex missed — now `re.IGNORECASE`. - New tests replay the transcripts through `mgmt.parse_event` (event sequences per scenario, CRLF framing intact) and the session logs through `parse_tun_device`. **Verification** - Full suite: 134 passed (the two `test_mgmt` socket tests need an unsandboxed run; unix sockets are blocked in the agent sandbox — not a code issue). - Lab re-run produces stable transcripts across runs; auth-failure `>PASSWORD:Verification Failed: 'Auth'` wording confirmed against the real interface, matching the parser's assumption. - Fixture regression: the lowercase device line fails the old regex and passes the new one. Refs #26.
Real 2.7.6 stdout from the service's own log -- a DCO connect/disconnect
and an auth failure -- pins parse_tun_device against what OpenVPN
actually prints (issue #26). Server IPs swapped for TEST-NET addresses.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
add: a loopback capture lab and management-stream fixtures
All checks were successful
ci / test (pull_request) Successful in 39s
ci / test (push) Successful in 52s
f978b8af7a
tests/manual/ovpnlab runs a real OpenVPN 2.7.6 server+client pair over
loopback in an unprivileged namespace (no root, no VPN account) and
records the client's stdout and management stream; re-run it after an
OpenVPN upgrade and diff against the committed fixtures. Captured now:
a userspace session, a ping-restart reconnect and an auth failure,
replayed through parse_event in test_mgmt (issue #26).

The userspace capture showed a second, lowercase device announcement
("tun/tap device [tun0] opened") the device regex missed -- match
case-insensitively.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
mysticalsoap deleted branch change/service-client 2026-08-20 12:53:18 -04:00
Sign in to join this conversation.
No description provided.