Skip to content

Commit 4d2b6f3

Browse files
committed
Make test_epmd more robust by performing an actual query on epmd
test_epmd ensured that epmd is running on CI by trying to connect to it. However, in some cases, this connection test succeeded while epmd would not be ready yet and would close the socket when trying to register. See for example this run: https://github.com/pguyot/AtomVM/actions/runs/19780234793/job/56679370750 Replace test with querying for registered nodes to ensure epmd is indeed ready. Signed-off-by: Paul Guyot <pguyot@kallisys.net>
1 parent 80d41d8 commit 4d2b6f3

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

tests/libs/estdlib/test_epmd.erl

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,12 @@ ensure_epmd_connect_loop(0) ->
9999
io:format("Coult not connect to epmd\n"),
100100
exit(timeout);
101101
ensure_epmd_connect_loop(N) ->
102-
{ok, Socket} = socket:open(inet, stream, tcp),
103-
Result = socket:connect(Socket, #{addr => {127, 0, 0, 1}, port => ?EPMD_PORT, family => inet}),
104-
socket:close(Socket),
105-
case Result of
106-
ok ->
102+
case erl_epmd:names("127.0.0.1") of
103+
{ok, _} ->
107104
ok;
108-
{error, econnrefused} ->
109-
timer:sleep(100),
110-
ensure_epmd_connect_loop(N - 1);
111-
{error, closed} ->
112-
timer:sleep(100),
105+
{error, Reason} ->
106+
io:format("Coulld not connect to epmd -- error = ~p, retrying (N = ~p)\n", [Reason, N]),
107+
timer:sleep(500),
113108
ensure_epmd_connect_loop(N - 1)
114109
end.
115110

0 commit comments

Comments
 (0)