7a48aef805
After a reboot the installed system root probe can succeed before sshd is fully stable. Retry post-install file uploads and commands on transient handshake/setup errors, and suppress late ssh2 error events after a failed handshake so recoverable connection races do not crash the CLI.
26 lines
878 B
TypeScript
26 lines
878 B
TypeScript
import assert from "node:assert/strict"
|
|
import test from "node:test"
|
|
|
|
import { isTransientSshConnectionError } from "../../src/main/ssh"
|
|
|
|
test("isTransientSshConnectionError identifies reboot/sshd settling failures", () => {
|
|
assert.equal(isTransientSshConnectionError(new Error("Connection lost before handshake")), true)
|
|
assert.equal(
|
|
isTransientSshConnectionError(
|
|
new Error("SSH connection ended before the handshake completed.")
|
|
),
|
|
true
|
|
)
|
|
assert.equal(
|
|
isTransientSshConnectionError(
|
|
new Error("Timed out while waiting for SSH handshake after 15000 ms.")
|
|
),
|
|
true
|
|
)
|
|
})
|
|
|
|
test("isTransientSshConnectionError rejects command-level failures", () => {
|
|
assert.equal(isTransientSshConnectionError(new Error("Command failed with exit 1")), false)
|
|
assert.equal(isTransientSshConnectionError(new Error("permission denied")), false)
|
|
})
|