Skip to content

Commit

Permalink
Random name for unix socket cowboy listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
puzza007 committed Sep 20, 2019
1 parent 93db46e commit bee3c9a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/katipo_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ end_per_suite(_Config) ->
init_per_group(http, Config) ->
application:ensure_all_started(cowboy),
Filename = tempfile:name("katipo_test_"),
Name = make_ref(),
Dispatch = cowboy_router:compile([{'_', [{"/unix", get_handler, []}]}]),
{ok, _} = cowboy:start_clear(unix_socket, [{ip, {local, Filename}},
{port, 0}], #{env => #{dispatch => Dispatch}}),
[{unix_socket_file, Filename} | Config];
{ok, _} = cowboy:start_clear(Name, [{ip, {local, Filename}},
{port, 0}], #{env => #{dispatch => Dispatch}}),
[{unix_socket_file, Filename}, {unix_server_name, Name}] ++ Config;
init_per_group(session, Config) ->
application:ensure_all_started(katipo),
Config;
Expand All @@ -48,7 +49,9 @@ init_per_group(_, Config) ->

end_per_group(http, Config) ->
Filename = ?config(unix_socket_file, Config),
Name = ?config(unix_server_name, Config),
_ = file:delete(Filename),
ok = cowboy:stop_listener(Name),
Config;
end_per_group(pool, Config) ->
application:stop(meck),
Expand Down

0 comments on commit bee3c9a

Please sign in to comment.