summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-12-06 14:54:45 -0500
committerFred Hebert <mononcqc@ferd.ca>2015-12-06 14:54:45 -0500
commitbc7ba735eb800a679119795df2fe7cd11e68b225 (patch)
treefee097526d7727e3e6a00d6f3a82113de2c7c2db
parentd76b25e62dd3a0c575cc2b4353aad3dbbb934c0a (diff)
parent540f2ebb0f8be681d342536ec5fb1f94ac392698 (diff)
Merge branch 'tup_umerge' of https://github.com/tsloughter/rebar3 into tsloughter-tup_umerge
-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),