Skip to content

test(ssh): add proxy-jump (--jump-host) interop test (#1882) - #3542

Merged
oferchen merged 1 commit into
masterfrom
test/ssh-proxy-jump-interop-1882
May 2, 2026
Merged

oferchen merged 1 commit into
masterfrom
test/ssh-proxy-jump-interop-1882

Conversation

@oferchen

@oferchen oferchen commented May 1, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #1882 by adding integration tests that exercise the SSH proxy-jump
(--jump-host) propagation introduced in #1881.

The new file tests/ssh_proxy_jump.rs verifies that
--jump-host=<value> becomes -J <value> on the spawned SSH child's
argv in the correct position (after SSH options, before the destination
operand). A POSIX shell-script wrapper named exactly ssh is dropped
into a tempfile::TempDir, set as the remote shell via --rsh=<path>,
and records its argv before exiting 255. Each test asserts on the
recorded argv, so we exercise the full CLI parser → SSH spawn pipeline
without standing up two real sshd instances.

Hops exercised

End-to-end transfer

end_to_end_proxy_jump_through_localhost is included but marked
#[ignore] because a real two-hop topology requires a running sshd
plus an installed rsync on the remote side; CI workers vary in
availability. The test loops the jump through localhost so it can be
run on any machine that has key-based SSH access to itself:

cargo nextest run --test ssh_proxy_jump -- --ignored end_to_end

Skip conditions

  • Windows: whole module is #[cfg(unix)] (the recorder relies on a
    Bourne shell wrapper). OpenSSH's path semantics on Windows differ
    enough that we keep that out of scope here.
  • End-to-end test silently skips when ssh localhost true or
    remote rsync are unreachable.
  • The four wire-level tests do not need a network or sshd; they only
    need /bin/sh and a writable tempdir.

Notes

  • The --jump-host flag has no -J short alias - upstream rsync
    3.4.1 reserves -J for --omit-link-times, and oc-rsync mirrors
    that (see crates/cli/src/frontend/command_builder/sections/transfer_behavior_options.rs).
    The -J <value> we assert on is the OpenSSH child argv, not the
    oc-rsync CLI argv.
  • The SSH command builder only injects -J when the configured remote
    shell program's basename is ssh or ssh.exe. The recorder script
    is named ssh precisely so this gate fires.

Test plan

  • CI: fmt+clippy
  • CI: nextest stable on Linux/macOS/Windows musl
  • CI: Interop validation
  • Local (optional): cargo nextest run --test ssh_proxy_jump
  • Local (manual, requires sshd+rsync on localhost):
    cargo nextest run --test ssh_proxy_jump -- --ignored

@github-actions github-actions Bot added the test label May 1, 2026
@oferchen
oferchen force-pushed the test/ssh-proxy-jump-interop-1882 branch 2 times, most recently from f4f6d99 to d9ec650 Compare May 1, 2026 22:15
Verifies that --jump-host=<value> propagates as `-J <value>` to the
spawned SSH subprocess in the correct argv position (before the
destination operand). A POSIX shell-script wrapper named `ssh` records
its argv to a temp file and exits 255 so we can assert the wire-level
contract without standing up a real two-hop sshd topology.

Scenarios covered:
- single hop: --jump-host=bastion.example.com
- multi-hop chain: --jump-host=alice@a,bob@b
- host with port:  --jump-host=user@bastion:2200
- absent flag:     no -J emitted
- empty value:     no -J emitted

An end-to-end test that exercises a real two-hop SSH transfer through
localhost is included but marked #[ignore] (requires sshd + remote
rsync). The whole module is #[cfg(unix)] - the recorder relies on a
Bourne shell wrapper. Closes #1882; references #1881 (implementation).
@oferchen
oferchen force-pushed the test/ssh-proxy-jump-interop-1882 branch from d9ec650 to b69aa5d Compare May 2, 2026 01:27
@oferchen
oferchen merged commit 22fcfac into master May 2, 2026
35 checks passed
@oferchen
oferchen deleted the test/ssh-proxy-jump-interop-1882 branch May 2, 2026 03:49
oferchen added a commit that referenced this pull request May 5, 2026
Verifies that --jump-host=<value> propagates as `-J <value>` to the
spawned SSH subprocess in the correct argv position (before the
destination operand). A POSIX shell-script wrapper named `ssh` records
its argv to a temp file and exits 255 so we can assert the wire-level
contract without standing up a real two-hop sshd topology.

Scenarios covered:
- single hop: --jump-host=bastion.example.com
- multi-hop chain: --jump-host=alice@a,bob@b
- host with port:  --jump-host=user@bastion:2200
- absent flag:     no -J emitted
- empty value:     no -J emitted

An end-to-end test that exercises a real two-hop SSH transfer through
localhost is included but marked #[ignore] (requires sshd + remote
rsync). The whole module is #[cfg(unix)] - the recorder relies on a
Bourne shell wrapper. Closes #1882; references #1881 (implementation).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant