Debian Codegraph @

tests/tunnels.py

raw
1 """What the two fake-`ssh` test modules share about a tunnel that will not open."""
2
3 from __future__ import annotations
4
5 from harlequin.exception import HarlequinSshError
6
7
8 def ssh_child_exited(error: BaseException) -> bool:
9 """Whether `start()` failed because the child exited, rather than timing out.
10
11 Losing a bind race looks like this: `ExitOnForwardFailure=yes` makes a
12 child that cannot take its port exit, so the port is worth retrying. A
13 readiness timeout is `SshTunnel.timeout` long and means something else, so
14 it is the one failure a retry must not multiply.
15 """
16 return isinstance(error, HarlequinSshError) and "exited with code" in str(error)