aboutsummaryrefslogtreecommitdiffstats
path: root/test/rlx_discover_SUITE.erl
diff options
context:
space:
mode:
authorEric Merritt <[email protected]>2014-03-12 09:08:55 -0700
committerEric Merritt <[email protected]>2014-03-12 09:08:55 -0700
commite24b3822b95f750a1c01955c4d0404b5bc23afed (patch)
tree5a8985b28dcc7aecb5b7cd93bc6e53e4753c4f5b /test/rlx_discover_SUITE.erl
parent52a5b14b232a47d50de992388e64f1f086a96396 (diff)
parentf610a7efe07fe47bec1bbc86d82545b094514ad9 (diff)
downloadrelx-e24b3822b95f750a1c01955c4d0404b5bc23afed.tar.gz
relx-e24b3822b95f750a1c01955c4d0404b5bc23afed.tar.bz2
relx-e24b3822b95f750a1c01955c4d0404b5bc23afed.zip
Merge pull request #101 from konradkaplita/accelerate_discover_provider
Accelerate application discovery
Diffstat (limited to 'test/rlx_discover_SUITE.erl')
-rw-r--r--test/rlx_discover_SUITE.erl41
1 files changed, 37 insertions, 4 deletions
diff --git a/test/rlx_discover_SUITE.erl b/test/rlx_discover_SUITE.erl
index 0fb1ad7..8ea95c4 100644
--- a/test/rlx_discover_SUITE.erl
+++ b/test/rlx_discover_SUITE.erl
@@ -26,7 +26,9 @@
all/0,
normal_case/1,
no_beam_case/1,
- bad_ebin_case/1]).
+ bad_ebin_case/1,
+ shallow_app_discovery/1
+ ]).
-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
@@ -53,7 +55,7 @@ init_per_testcase(_, Config) ->
all() ->
- [normal_case, no_beam_case, bad_ebin_case].
+ [normal_case, no_beam_case, bad_ebin_case, shallow_app_discovery].
normal_case(Config) ->
LibDir1 = proplists:get_value(lib1, Config),
@@ -83,8 +85,7 @@ normal_case(Config) ->
lists:foreach(fun(App) ->
?assertMatch(true, lists:member(App, rlx_state:available_apps(State2)))
end, Apps2),
- Length = erlang:length(Apps2) +
- erlang:length(Apps2),
+ Length = erlang:length(Apps1) + erlang:length(Apps2),
?assertMatch(Length, erlang:length(rlx_state:available_apps(State2))).
no_beam_case(Config) ->
@@ -146,6 +147,38 @@ bad_ebin_case(Config) ->
?assertMatch([], [App || App <- rlx_state:available_apps(State2),
BadName =:= rlx_app_info:name(App)]).
+shallow_app_discovery(Config) ->
+ LibDir1 = proplists:get_value(lib1, Config),
+ Apps1 = [(fun({Name, Vsn}) ->
+ create_app(LibDir1, Name, Vsn)
+ end)(App)
+ ||
+ App <-
+ [{create_random_name("lib_app1_"), create_random_vsn()}
+ || _ <- lists:seq(1, 100)]],
+
+ LibDir2 = proplists:get_value(lib2, Config),
+ Apps2 = [(fun({Name, Vsn}) ->
+ create_app(LibDir2, Name, Vsn)
+ end)(App)
+ || App <-
+ [{create_random_name("lib_app2_"), create_random_vsn()}
+ || _ <- lists:seq(1, 100)]],
+ State0 = rlx_state:put(proplists:get_value(state, Config),
+ default_libs, false),
+ State1 = rlx_state:put(State0, enable_shallow_app_discovery, true),
+ {DiscoverProvider, {ok, State2}} = rlx_provider:new(rlx_prv_discover, State1),
+ {ok, State3} = rlx_provider:do(DiscoverProvider, State2),
+ lists:foreach(fun(App) ->
+ ?assertMatch(true, lists:member(App, rlx_state:available_apps(State3)))
+ end, Apps1),
+
+ lists:foreach(fun(App) ->
+ ?assertMatch(true, lists:member(App, rlx_state:available_apps(State3)))
+ end, Apps2),
+ Length = erlang:length(Apps1) + erlang:length(Apps2),
+ ?assertMatch(Length, erlang:length(rlx_state:available_apps(State3))).
+
%%%===================================================================
%%% Helper functions
%%%===================================================================