summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/rebar_release_SUITE.erl69
1 files changed, 64 insertions, 5 deletions
diff --git a/test/rebar_release_SUITE.erl b/test/rebar_release_SUITE.erl
index f6fe8ff..e0fa5a0 100644
--- a/test/rebar_release_SUITE.erl
+++ b/test/rebar_release_SUITE.erl
@@ -4,11 +4,13 @@
-include_lib("eunit/include/eunit.hrl").
all() -> [release,
- dev_mode_release,
- profile_dev_mode_override_release,
- tar,
- extend_release,
- user_output_dir].
+ dev_mode_release,
+ profile_dev_mode_override_release,
+ tar,
+ profile_ordering_sys_config_extend,
+ profile_ordering_sys_config_extend_3_tuple_merge,
+ extend_release,
+ user_output_dir].
init_per_testcase(Case, Config0) ->
Config = rebar_test_utils:init_rebar_state(Config0),
@@ -111,6 +113,63 @@ extend_release(Config) ->
{ok, [{release, extended, Vsn, false}]}
).
+%% Ensure proper ordering of sys_config and extended releases in profiles
+profile_ordering_sys_config_extend(Config) ->
+ AppDir = ?config(apps, Config),
+ Name = ?config(name, Config),
+ Vsn = "1.0.0",
+ TestSysConfig = filename:join(AppDir, "test.config"),
+ OtherSysConfig = filename:join(AppDir, "other.config"),
+ ok = file:write_file(TestSysConfig, "[]."),
+ ok = file:write_file(OtherSysConfig, "[{some, content}]."),
+ {ok, RebarConfig} =
+ file:consult(rebar_test_utils:create_config(AppDir,
+ [{relx, [{release, {list_to_atom(Name), Vsn},
+ [list_to_atom(Name)]},
+ {sys_config, OtherSysConfig},
+ {lib_dirs, [AppDir]}]},
+ {profiles, [{extended,
+ [{relx, [
+ {sys_config, TestSysConfig}]}]}]}])),
+ rebar_test_utils:run_and_check(
+ Config, RebarConfig,
+ ["as", "extended", "release"],
+ {ok, [{release, list_to_atom(Name), Vsn, false}]}
+ ),
+
+ ReleaseDir = filename:join([AppDir, "./_build/extended/rel/", Name, "releases", Vsn]),
+ {ok, [[]]} = file:consult(filename:join(ReleaseDir, "sys.config")).
+
+%% test that tup_umerge works with tuples of different sizes
+profile_ordering_sys_config_extend_3_tuple_merge(Config) ->
+ AppDir = ?config(apps, Config),
+ Name = ?config(name, Config),
+ Vsn = "1.0.0",
+ TestSysConfig = filename:join(AppDir, "test.config"),
+ OtherSysConfig = filename:join(AppDir, "other.config"),
+ ok = file:write_file(TestSysConfig, "[]."),
+ ok = file:write_file(OtherSysConfig, "[{some, content}]."),
+ {ok, RebarConfig} =
+ file:consult(rebar_test_utils:create_config(AppDir,
+ [{relx, [{release, {list_to_atom(Name), Vsn},
+ [list_to_atom(Name)]},
+ {sys_config, OtherSysConfig},
+ {lib_dirs, [AppDir]}]},
+ {profiles, [{extended,
+ [{relx, [
+ {release, {extended, Vsn, {extend, list_to_atom(Name)}},
+ []},
+ {sys_config, TestSysConfig}]}]}]}])),
+
+ rebar_test_utils:run_and_check(
+ Config, RebarConfig,
+ ["as", "extended", "release", "-n", Name],
+ {ok, [{release, list_to_atom(Name), Vsn, false}]}
+ ),
+
+ ReleaseDir = filename:join([AppDir, "./_build/extended/rel/", Name, "releases", Vsn]),
+ {ok, [[]]} = file:consult(filename:join(ReleaseDir, "sys.config")).
+
user_output_dir(Config) ->
AppDir = ?config(apps, Config),
Name = ?config(name, Config),