diff --git a/.travis.yml b/.travis.yml index 1f42a74..ad25a63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ sudo: false language: erlang otp_release: + - 20.1 - 19.2 - - 18.3 before_install: - ./ci before_install "${PWD:?}"/rebar3 install: diff --git a/rebar.config b/rebar.config index ac5bc63..79790f2 100644 --- a/rebar.config +++ b/rebar.config @@ -8,8 +8,7 @@ {deps_dir, "deps"}. {deps, [ - {cowboy, "1.0.4"}, - {ranch, "1.2.1"} + {cowboy, "2.1.0"} ] }. @@ -22,7 +21,7 @@ {deps, [ {katana_test, {git, "https://github.com/inaka/katana-test", {ref, "0.0.5"}}}, {mixer, {git, "https://github.com/inaka/mixer", {ref, "0.1.5"}}}, - {meck, "0.8.4"}, + {meck, "0.8.6"}, {xref_runner, {git, "https://github.com/inaka/xref_runner", {ref, "0.2.6"}}} ]} ]} diff --git a/src/trails.erl b/src/trails.erl index 283179a..fcf965c 100644 --- a/src/trails.erl +++ b/src/trails.erl @@ -262,9 +262,9 @@ servers() -> -spec host_matches(ranch:ref()) -> [route_match()]. host_matches(ServerRef) -> - Opts = lists:flatten(ets:match(ranch_server, {{opts, ServerRef}, '$1'})), - Env = proplists:get_value(env, Opts, []), - Dispatchs = proplists:get_value(dispatch, Env, []), + [Opts] = lists:flatten(ets:match(ranch_server, {{opts, ServerRef}, '$1'})), + Env = maps:get(env, Opts, #{}), + Dispatchs = maps:get(dispatch, Env, []), lists:flatten([Host || {Host, _, _} <- Dispatchs]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/test/trails_SUITE.erl b/test/trails_SUITE.erl index 2654b65..65c2d01 100644 --- a/test/trails_SUITE.erl +++ b/test/trails_SUITE.erl @@ -395,17 +395,13 @@ server_hostmatches(_Config) -> Routes2 = [{"hostmatch3", Trails3}], Dispatch2 = trails:compile(Routes2), - ListenerCount = 10, - RanchOptions1 = [{port, 8080}], CowboyOptions1 = make_cowboy_options(Dispatch1), - {ok, _} = - cowboy:start_http(server1, ListenerCount, RanchOptions1, CowboyOptions1), + {ok, _} = cowboy:start_clear(server1, RanchOptions1, CowboyOptions1), RanchOptions2 = [{port, 8081}], CowboyOptions2 = make_cowboy_options(Dispatch2), - {ok, _} = - cowboy:start_http(server2, ListenerCount, RanchOptions2, CowboyOptions2), + {ok, _} = cowboy:start_clear(server2, RanchOptions2, CowboyOptions2), Servers = trails:servers(), true = lists:member(server1, Servers) andalso lists:member(server2, Servers), @@ -459,13 +455,9 @@ get_trails3() -> ]. %% @private --spec make_cowboy_options(cowboy_router:dispatch_rules()) -> [tuple()]. +-spec make_cowboy_options(cowboy_router:dispatch_rules()) -> map(). make_cowboy_options(Dispatch) -> - [ - {env, - [ - {dispatch, Dispatch} - ]}, - {compress, true}, - {timeout, 12000} - ]. + #{ env => #{dispatch => Dispatch} + , compress => true + , timeout => 12000 + }. diff --git a/test/trails_meta_SUITE.erl b/test/trails_meta_SUITE.erl index 7f9c1b9..1e2d5fd 100644 --- a/test/trails_meta_SUITE.erl +++ b/test/trails_meta_SUITE.erl @@ -1,18 +1,23 @@ -module(trails_meta_SUITE). -include_lib("mixer/include/mixer.hrl"). --mixin([{ktn_meta_SUITE - , [ all/0 +-mixin([ { ktn_meta_SUITE + , [ all/0 , xref/1 , dialyzer/1 , elvis/1 - ] - }]). + ] + }]). --export([init_per_suite/1]). +-export([ init_per_suite/1 + , end_per_suite/1 + ]). -type config() :: [{atom(), term()}]. -spec init_per_suite(config()) -> config(). init_per_suite(Config) -> [ {application, trails} | Config]. + +-spec end_per_suite(config()) -> config(). +end_per_suite(Config) -> Config.