Skip to content

Commit 85ef200

Browse files
committed
Merge branch 'kuba/ssh/fix_flaky_ssh_connection_test' into maint
* kuba/ssh/fix_flaky_ssh_connection_test: ssh test: Fix flaky interrupted_send race condition
2 parents 0a96104 + 8248e88 commit 85ef200

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

lib/ssh/test/ssh_connection_SUITE.erl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,19 @@ do_interrupted_send(Config, SendSize, EchoSize, SenderResult) ->
769769
ct:log("~p:~p ~p - That's what we expect :)",
770770
[?MODULE,?LINE, SenderResult]),
771771
ok;
772+
{SenderPid, {error, closed}} ->
773+
%% We called ssh:close(ConnectionRef) above while
774+
%% the sender was still pushing data (10 MB send,
775+
%% only 4 MB echoed). The connection teardown can
776+
%% race with the ongoing send, causing it to return
777+
%% {error, closed} instead of ok. Both outcomes are
778+
%% valid — the test's purpose is to verify the
779+
%% listener received correct echo data, not that
780+
%% the sender completes the full 10 MB transfer.
781+
ct:log("~p:~p sender got {error,closed} after "
782+
"ssh:close - acceptable race",
783+
[?MODULE,?LINE]),
784+
ok;
772785
Msg ->
773786
ct:log("~p:~p Not expected send result: ~p",[?MODULE,?LINE,Msg]),
774787
{fail, "Not expected msg"}

0 commit comments

Comments
 (0)