mirror of
https://github.com/libssh2/libssh2.git
synced 2026-10-24 03:48:58 +03:00
tests: retry '(-43): Failed getting banner' flaky failures
Example:
```
1: libssh2_session_handshake failed (-43): Failed getting banner
1: ---- sshd log ----
1: No matching private key for certificate: /etc/ssh/ssh_host_mldsa44-ed25519_key-cert.pub
1: debug1: Set /proc/self/oom_score_adj from 0 to -1000
1: debug2: fd 6 setting O_NONBLOCK
1: debug1: Bind to port 22 on 0.0.0.0.
1: Server listening on 0.0.0.0 port 22.
1: debug2: fd 7 setting O_NONBLOCK
1: debug1: Bind to port 22 on ::.
1: Server listening on :: port 22.
1: ------------------
1: Command: docker image pull ghcr.io/libssh2/ci_tests_openssh_server:8d1fde1834077fddb9f9
1: Command: docker image tag ghcr.io/libssh2/ci_tests_openssh_server:8d1fde1834077fddb9f9 libssh2/openssh_server
1: Command: docker run --rm -d -p 22 libssh2/openssh_server
1: Command: docker inspect --format "{{ (index (index .NetworkSettings.Ports \"22/tcp\") 0).HostIp }}" a1f1a209001852fa7e3aba87c0f1198661c4fe07c34ddcbf2e76e264ef64b7b8
1: Command: docker inspect --format "{{ (index (index .NetworkSettings.Ports \"22/tcp\") 0).HostPort }}" a1f1a209001852fa7e3aba87c0f1198661c4fe07c34ddcbf2e76e264ef64b7b8
1: Command: docker logs a1f1a209001852fa7e3aba87c0f1198661c4fe07c34ddcbf2e76e264ef64b7b8
1: Command: docker stop a1f1a209001852fa7e3aba87c0f1198661c4fe07c34ddcbf2e76e264ef64b7b8
1/61 Test #1: test_aa_warmup .......................................***Failed 6.08 sec
libssh2_session_handshake failed (-43): Failed getting banner
```
Ref: https://github.com/libssh2/libssh2/actions/runs/37613324059/job/112765610280?pr=2659#step:25:133
Ref: 5bfa574460 #2603
Closes #2662
This commit is contained in:
@@ -34,15 +34,32 @@
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int exit_code = 1;
|
||||
int skipped, rc;
|
||||
LIBSSH2_SESSION *session = start_session_fixture(&skipped, &rc);
|
||||
if(session)
|
||||
exit_code = (test(session) == 0) ? 0 : 1;
|
||||
else if(skipped) {
|
||||
fprintf(stderr, "Test skipped.\n");
|
||||
exit_code = 0;
|
||||
}
|
||||
int exit_code;
|
||||
/* Retry tests to mitigate flaky failures */
|
||||
int retries = 2, retry = 0;
|
||||
|
||||
do {
|
||||
int skipped, rc;
|
||||
LIBSSH2_SESSION *session = start_session_fixture(&skipped, &rc);
|
||||
if(session)
|
||||
exit_code = (test(session) == 0) ? 0 : 1;
|
||||
else if(skipped) {
|
||||
fprintf(stderr, "Test skipped.\n");
|
||||
exit_code = 0;
|
||||
}
|
||||
else
|
||||
exit_code = 1;
|
||||
stop_session_fixture(exit_code);
|
||||
/* Retry:
|
||||
'libssh2_session_handshake failed (-43): Failed getting banner' */
|
||||
if(exit_code == 0 || rc != LIBSSH2_ERROR_SOCKET_RECV ||
|
||||
++retry > retries) {
|
||||
break;
|
||||
}
|
||||
fprintf(stderr, "Test failed (%d). Retrying... %d / %d\n",
|
||||
rc, retry, retries);
|
||||
} while(1);
|
||||
|
||||
stop_session_fixture(exit_code);
|
||||
return exit_code;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user