windows: CI gives the SSH test's sshd its privilege separation

The job runs as root in the runner's container, where sshd separates
privileges and needs /var/empty (root's, not writable by others) and the
sshd user; the image lacks the directory, so the test's sshd exited and
an_ssh_tunnel failed. A step makes both. The test now waits for its sshd
and, should it exit, says why.

Checked as root in docker.gitea.com/runner-images:ubuntu-24.04: the
end-to-end tests pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 5.5 committed 2026-10-27 15:35:49 +03:00
1 parent 8d9705cd3a
commit 69e70d6f74
2 files changed
+22 -2

No files matched your search

+9 -1
View File
@@ -230,7 +230,15 @@ fn an_ssh_tunnel() {
),
)
.unwrap();
let _sshd = Kill(Command::new(&sshd).args(["-D", "-e", "-f"]).arg(dir.join("sshd_config")).stderr(std::fs::File::create(dir.join("sshd.log")).unwrap()).spawn().unwrap());
let mut sshd = Kill(Command::new(&sshd).args(["-D", "-e", "-f"]).arg(dir.join("sshd_config")).stderr(std::fs::File::create(dir.join("sshd.log")).unwrap()).spawn().unwrap());
// One that cannot start says why, here (as root it needs its privilege separation: the
// directory /var/empty and the user sshd).
wait_for("sshd", Duration::from_secs(10), || {
if let Ok(Some(status)) = sshd.0.try_wait() {
panic!("sshd exited ({status}):\n{}", std::fs::read_to_string(dir.join("sshd.log")).unwrap_or_default());
}
std::net::TcpStream::connect(("127.0.0.1", ssh_port)).is_ok()
});
let state = dir.join("state");
std::fs::create_dir_all(&state).unwrap();