test(phase-2): add ssh2.Server test harness and end-to-end SSH, ProxyJump, key rotation, and monitoring tests

This commit is contained in:
tyuXX 2026-11-26 18:57:07 +00:00
parent 75b969f044
commit 4ac7b5d1b4
5 changed files with 1026 additions and 0 deletions

View file

@ -329,9 +329,23 @@ export class SSHPool {
}
const out: Buffer[] = [];
const errBuf: Buffer[] = [];
const timer = setTimeout(() => {
try {
stream.close();
} catch {
// Ignore close error
}
reject(new Error('Verification command timed out'));
}, 10_000);
stream.stdin.end();
stream.on('data', (d: Buffer) => out.push(d));
stream.stderr.on('data', (d: Buffer) => errBuf.push(d));
stream.on('error', (streamErr: Error) => {
clearTimeout(timer);
reject(streamErr);
});
stream.on('close', (exitCode: number | null) => {
clearTimeout(timer);
resolve({
stdout: Buffer.concat(out).toString('utf8'),
stderr: Buffer.concat(errBuf).toString('utf8'),