Skip to content

Commit 3d2d06a

Browse files
committed
Random name for unix socket cowboy listeners
1 parent 93db46e commit 3d2d06a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

test/katipo_SUITE.erl

+8-5
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ init_per_suite(Config) ->
2121
end_per_suite(_Config) ->
2222
ok = application:stop(katipo).
2323

24-
init_per_group(http, Config) ->
24+
init_per_group(curl, Config) ->
2525
application:ensure_all_started(cowboy),
2626
Filename = tempfile:name("katipo_test_"),
27+
Name = make_ref(),
2728
Dispatch = cowboy_router:compile([{'_', [{"/unix", get_handler, []}]}]),
28-
{ok, _} = cowboy:start_clear(unix_socket, [{ip, {local, Filename}},
29-
{port, 0}], #{env => #{dispatch => Dispatch}}),
30-
[{unix_socket_file, Filename} | Config];
29+
{ok, _} = cowboy:start_clear(Name, [{ip, {local, Filename}},
30+
{port, 0}], #{env => #{dispatch => Dispatch}}),
31+
[{unix_socket_file, Filename}, {unix_server_name, Name}] ++ Config;
3132
init_per_group(session, Config) ->
3233
application:ensure_all_started(katipo),
3334
Config;
@@ -46,9 +47,11 @@ init_per_group(http3, Config) ->
4647
init_per_group(_, Config) ->
4748
Config.
4849

49-
end_per_group(http, Config) ->
50+
end_per_group(curl, Config) ->
5051
Filename = ?config(unix_socket_file, Config),
52+
Name = ?config(unix_server_name, Config),
5153
_ = file:delete(Filename),
54+
ok = cowboy:stop_listener(Name),
5255
Config;
5356
end_per_group(pool, Config) ->
5457
application:stop(meck),

0 commit comments

Comments
 (0)