summaryrefslogtreecommitdiff
path: root/test/rebar_upgrade_SUITE.erl
diff options
context:
space:
mode:
authorStuart Thackray <stuart.thackray@gmail.com>2018-12-11 08:53:29 +0200
committerStuart Thackray <stuart.thackray@gmail.com>2018-12-11 08:53:29 +0200
commitebfa797c1f5d038b99beaf658757d974412a15c7 (patch)
tree9765880a7f0119c265d85f8bac7afea8d9542080 /test/rebar_upgrade_SUITE.erl
parent71187514dabdd94aa333495d92df84a2e750099f (diff)
parent8e28561d4e14ea85d42d17ab5a0f17f5f1c696d2 (diff)
Update from Upstream
Diffstat (limited to 'test/rebar_upgrade_SUITE.erl')
-rw-r--r--test/rebar_upgrade_SUITE.erl489
1 files changed, 289 insertions, 200 deletions
diff --git a/test/rebar_upgrade_SUITE.erl b/test/rebar_upgrade_SUITE.erl
index 66e1fdf..c55456c 100644
--- a/test/rebar_upgrade_SUITE.erl
+++ b/test/rebar_upgrade_SUITE.erl
@@ -11,7 +11,8 @@ groups() ->
triplet_a, triplet_b, triplet_c,
tree_a, tree_b, tree_c, tree_c2, tree_cj, tree_ac, tree_all,
delete_d, promote, stable_lock, fwd_lock,
- compile_upgrade_parity, umbrella_config]},
+ compile_upgrade_parity, umbrella_config,
+ profiles, profiles_exclusion]},
{git, [], [{group, all}]},
{pkg, [], [{group, all}]}].
@@ -78,6 +79,23 @@ setup_project(Case=umbrella_config, Config0, Deps, UpDeps) ->
[{rebarconfig, TopConf},
{rebarumbrella, RebarConf},
{next_top_deps, rebar_test_utils:top_level_deps(UpDeps)} | Config];
+setup_project(Case, Config0, Deps, UpDeps) when Case == profiles;
+ Case == profiles_exclusion ->
+ DepsType = ?config(deps_type, Config0),
+ NameRoot = atom_to_list(Case)++"_"++atom_to_list(DepsType),
+ Config = rebar_test_utils:init_rebar_state(Config0, NameRoot++"_"),
+ AppDir = filename:join([?config(apps, Config), "apps", NameRoot]),
+ rebar_test_utils:create_app(AppDir, "Root", "0.0.0", [kernel, stdlib]),
+ [Top|ProfileDeps] = rebar_test_utils:top_level_deps(Deps),
+ RebarConf = rebar_test_utils:create_config(AppDir, [
+ {deps, [Top]},
+ {profiles, [{fake, [{deps, ProfileDeps}]}]}
+ ]),
+ [NextTop|NextPDeps] = rebar_test_utils:top_level_deps(UpDeps),
+ NextConfig = [{deps, [NextTop]},
+ {profiles, [{fake, [{deps, NextPDeps}]}]}],
+ [{rebarconfig, RebarConf},
+ {next_config, NextConfig} | Config];
setup_project(Case, Config0, Deps, UpDeps) ->
DepsType = ?config(deps_type, Config0),
Config = rebar_test_utils:init_rebar_state(
@@ -94,25 +112,25 @@ setup_project(Case, Config0, Deps, UpDeps) ->
upgrades(top_a) ->
%% Original tree
- {[{"A", "1", [{"B", [{"D", "1", []}]},
- {"C", [{"D", "2", []}]}]}
+ {[{"A", "1.0.0", [{"B", [{"D", "1.0.0", []}]},
+ {"C", [{"D", "2.0.0", []}]}]}
],
%% Updated tree
- [{"A", "1", [{"B", [{"D", "3", []}]},
- {"C", [{"D", "2", []}]}]}
+ [{"A", "1.0.0", [{"B", [{"D", "3.0.0", []}]},
+ {"C", [{"D", "2.0.0", []}]}]}
],
%% Modified apps, gobally
["A","B","D"],
%% upgrade vs. new tree
- {"A", [{"A","1"}, "B", "C", {"D","3"}]}};
+ {"A", [{"A","1.0.0"}, "B", "C", {"D","3.0.0"}]}};
upgrades(top_b) ->
%% Original tree
- {[{"A", "1", [{"B", [{"D", "1", []}]},
- {"C", [{"D", "2", []}]}]}
+ {[{"A", "1.0.0", [{"B", [{"D", "1.0.0", []}]},
+ {"C", [{"D", "2.0.0", []}]}]}
],
%% Updated tree
- [{"A", "1", [{"B", [{"D", "3", []}]},
- {"C", [{"D", "2", []}]}]}
+ [{"A", "1.0.0", [{"B", [{"D", "3.0.0", []}]},
+ {"C", [{"D", "2.0.0", []}]}]}
],
%% Modified apps, gobally
["A","B","D"],
@@ -120,12 +138,12 @@ upgrades(top_b) ->
{"B", {error, {rebar_prv_upgrade, {transitive_dependency, <<"B">>}}}}};
upgrades(top_c) ->
%% Original tree
- {[{"A", "1", [{"B", [{"D", "1", []}]},
- {"C", [{"D", "2", []}]}]}
+ {[{"A", "1.0.0", [{"B", [{"D", "1.0.0", []}]},
+ {"C", [{"D", "2.0.0", []}]}]}
],
%% Updated tree
- [{"A", "1", [{"B", [{"D", "3", []}]},
- {"C", [{"D", "2", []}]}]}
+ [{"A", "1.0.0", [{"B", [{"D", "3.0.0", []}]},
+ {"C", [{"D", "2.0.0", []}]}]}
],
%% Modified apps, gobally
["A","B","D"],
@@ -133,12 +151,12 @@ upgrades(top_c) ->
{"C", {error, {rebar_prv_upgrade, {transitive_dependency, <<"C">>}}}}};
upgrades(top_d1) ->
%% Original tree
- {[{"A", "1", [{"B", [{"D", "1", []}]},
- {"C", [{"D", "2", []}]}]}
+ {[{"A", "1.0.0", [{"B", [{"D", "1.0.0", []}]},
+ {"C", [{"D", "2.0.0", []}]}]}
],
%% Updated tree
- [{"A", "1", [{"B", [{"D", "3", []}]},
- {"C", [{"D", "2", []}]}]}
+ [{"A", "1.0.0", [{"B", [{"D", "3.0.0", []}]},
+ {"C", [{"D", "2.0.0", []}]}]}
],
%% Modified apps, gobally
["A","B","D"],
@@ -146,12 +164,12 @@ upgrades(top_d1) ->
{"D", {error, {rebar_prv_upgrade, {transitive_dependency, <<"D">>}}}}};
upgrades(top_d2) ->
%% Original tree
- {[{"A", "1", [{"B", [{"D", "1", []}]},
- {"C", [{"D", "2", []}]}]}
+ {[{"A", "1.0.0", [{"B", [{"D", "1.0.0", []}]},
+ {"C", [{"D", "2.0.0", []}]}]}
],
%% Updated tree
- [{"A", "1", [{"B", [{"D", "3", []}]},
- {"C", [{"D", "2", []}]}]}
+ [{"A", "1.0.0", [{"B", [{"D", "3.0.0", []}]},
+ {"C", [{"D", "2.0.0", []}]}]}
],
%% Modified apps, gobally
["A","B","D"],
@@ -159,302 +177,342 @@ upgrades(top_d2) ->
{"D", {error, {rebar_prv_upgrade, {transitive_dependency, <<"D">>}}}}};
upgrades(top_e) ->
%% Original tree
- {[{"A", "1", [{"B", [{"D", "1", []}]},
- {"C", [{"D", "2", []}]}]}
+ {[{"A", "1.0.0", [{"B", [{"D", "1.0.0", []}]},
+ {"C", [{"D", "2.0.0", []}]}]}
],
%% Updated tree
- [{"A", "1", [{"B", [{"D", "3", []}]},
- {"C", [{"D", "2", []}]}]}
+ [{"A", "1.0.0", [{"B", [{"D", "3.0.0", []}]},
+ {"C", [{"D", "2.0.0", []}]}]}
],
%% Modified apps, gobally
["A","B","D"],
%% upgrade vs. new tree
{"E", {error, {rebar_prv_upgrade, {unknown_dependency, <<"E">>}}}}};
upgrades(pair_a) ->
- {[{"A", "1", [{"C", "1", []}]},
- {"B", "1", [{"D", "1", []}]}
+ {[{"A", "1.0.0", [{"C", "1.0.0", []}]},
+ {"B", "1.0.0", [{"D", "1.0.0", []}]}
],
- [{"A", "2", [{"C", "2", []}]},
- {"B", "2", [{"D", "2", []}]}
+ [{"A", "2.0.0", [{"C", "2.0.0", []}]},
+ {"B", "2.0.0", [{"D", "2.0.0", []}]}
],
["A","B","C","D"],
- {"A", [{"A","2"},{"C","2"},{"B","1"},{"D","1"}]}};
+ {"A", [{"A","2.0.0"},{"C","2.0.0"},{"B","1.0.0"},{"D","1.0.0"}]}};
upgrades(pair_b) ->
- {[{"A", "1", [{"C", "1", []}]},
- {"B", "1", [{"D", "1", []}]}
+ {[{"A", "1.0.0", [{"C", "1.0.0", []}]},
+ {"B", "1.0.0", [{"D", "1.0.0", []}]}
],
- [{"A", "2", [{"C", "2", []}]},
- {"B", "2", [{"D", "2", []}]}
+ [{"A", "2.0.0", [{"C", "2.0.0", []}]},
+ {"B", "2.0.0", [{"D", "2.0.0", []}]}
],
["A","B","C","D"],
- {"B", [{"A","1"},{"C","1"},{"B","2"},{"D","2"}]}};
+ {"B", [{"A","1.0.0"},{"C","1.0.0"},{"B","2.0.0"},{"D","2.0.0"}]}};
upgrades(pair_ab) ->
- {[{"A", "1", [{"C", "1", []}]},
- {"B", "1", [{"D", "1", []}]}
+ {[{"A", "1.0.0", [{"C", "1.0.0", []}]},
+ {"B", "1.0.0", [{"D", "1.0.0", []}]}
],
- [{"A", "2", [{"C", "2", []}]},
- {"B", "2", [{"D", "2", []}]}
+ [{"A", "2.0.0", [{"C", "2.0.0", []}]},
+ {"B", "2.0.0", [{"D", "2.0.0", []}]}
],
["A","B","C","D"],
- {"A,B", [{"A","2"},{"C","2"},{"B","2"},{"D","2"}]}};
+ {"A,B", [{"A","2.0.0"},{"C","2.0.0"},{"B","2.0.0"},{"D","2.0.0"}]}};
upgrades(pair_c) ->
- {[{"A", "1", [{"C", "1", []}]},
- {"B", "1", [{"D", "1", []}]}
+ {[{"A", "1.0.0", [{"C", "1.0.0", []}]},
+ {"B", "1.0.0", [{"D", "1.0.0", []}]}
],
- [{"A", "2", [{"C", "2", []}]},
- {"B", "2", [{"D", "2", []}]}
+ [{"A", "2.0.0", [{"C", "2.0.0", []}]},
+ {"B", "2.0.0", [{"D", "2.0.0", []}]}
],
["A","B","C","D"],
{"C", {error, {rebar_prv_upgrade, {transitive_dependency, <<"C">>}}}}};
upgrades(pair_all) ->
- {[{"A", "1", [{"C", "1", []}]},
- {"B", "1", [{"D", "1", []}]}
+ {[{"A", "1.0.0", [{"C", "1.0.0", []}]},
+ {"B", "1.0.0", [{"D", "1.0.0", []}]}
],
- [{"A", "2", [{"C", "2", []}]},
- {"B", "2", [{"D", "2", []}]}
+ [{"A", "2.0.0", [{"C", "2.0.0", []}]},
+ {"B", "2.0.0", [{"D", "2.0.0", []}]}
],
["A","B","C","D"],
- {"", [{"A","2"},{"C","2"},{"B","2"},{"D","2"}]}};
+ {"", [{"A","2.0.0"},{"C","2.0.0"},{"B","2.0.0"},{"D","2.0.0"}]}};
upgrades(triplet_a) ->
- {[{"A", "1", [{"D",[]},
- {"E","3",[]}]},
- {"B", "1", [{"F","1",[]},
+ {[{"A", "1.0.0", [{"D",[]},
+ {"E","3.0.0",[]}]},
+ {"B", "1.0.0", [{"F","1.0.0",[]},
{"G",[]}]},
- {"C", "0", [{"H","3",[]},
+ {"C", "0.0.0", [{"H","3.0.0",[]},
{"I",[]}]}],
- [{"A", "1", [{"D",[]},
- {"E","2",[]}]},
- {"B", "1", [{"F","1",[]},
+ [{"A", "1.0.0", [{"D",[]},
+ {"E","2.0.0",[]}]},
+ {"B", "1.0.0", [{"F","1.0.0",[]},
{"G",[]}]},
- {"C", "1", [{"H","4",[]},
+ {"C", "1.0.0", [{"H","4.0.0",[]},
{"I",[]}]}],
["A","C","E","H"],
- {"A", [{"A","1"}, "D", {"E","2"},
- {"B","1"}, {"F","1"}, "G",
- {"C","0"}, {"H","3"}, "I"]}};
+ {"A", [{"A","1.0.0"}, "D", {"E","2.0.0"},
+ {"B","1.0.0"}, {"F","1.0.0"}, "G",
+ {"C","0.0.0"}, {"H","3.0.0"}, "I"]}};
upgrades(triplet_b) ->
- {[{"A", "1", [{"D",[]},
- {"E","3",[]}]},
- {"B", "1", [{"F","1",[]},
+ {[{"A", "1.0.0", [{"D",[]},
+ {"E","3.0.0",[]}]},
+ {"B", "1.0.0", [{"F","1.0.0",[]},
{"G",[]}]},
- {"C", "0", [{"H","3",[]},
+ {"C", "0.0.0", [{"H","3.0.0",[]},
{"I",[]}]}],
- [{"A", "2", [{"D",[]},
- {"E","2",[]}]},
- {"B", "1", [{"F","1",[]},
+ [{"A", "2.0.0", [{"D",[]},
+ {"E","2.0.0",[]}]},
+ {"B", "1.0.0", [{"F","1.0.0",[]},
{"G",[]}]},
- {"C", "1", [{"H","4",[]},
+ {"C", "1.0.0", [{"H","4.0.0",[]},
{"I",[]}]}],
["A","C","E","H"],
- {"B", [{"A","1"}, "D", {"E","3"},
- {"B","1"}, {"F","1"}, "G",
- {"C","0"}, {"H","3"}, "I"]}};
+ {"B", [{"A","1.0.0"}, "D", {"E","3.0.0"},
+ {"B","1.0.0"}, {"F","1.0.0"}, "G",
+ {"C","0.0.0"}, {"H","3.0.0"}, "I"]}};
upgrades(triplet_c) ->
- {[{"A", "1", [{"D",[]},
- {"E","3",[]}]},
- {"B", "1", [{"F","1",[]},
+ {[{"A", "1.0.0", [{"D",[]},
+ {"E","3.0.0",[]}]},
+ {"B", "1.0.0", [{"F","1.0.0",[]},
{"G",[]}]},
- {"C", "0", [{"H","3",[]},
+ {"C", "0.0.0", [{"H","3.0.0",[]},
{"I",[]}]}],
- [{"A", "2", [{"D",[]},
- {"E","2",[]}]},
- {"B", "1", [{"F","1",[]},
+ [{"A", "2.0.0", [{"D",[]},
+ {"E","2.0.0",[]}]},
+ {"B", "1.0.0", [{"F","1.0.0",[]},
{"G",[]}]},
- {"C", "1", [{"H","4",[]},
+ {"C", "1.0.0", [{"H","4.0.0",[]},
{"I",[]}]}],
["A","C","E","H"],
- {"C", [{"A","1"}, "D", {"E","3"},
- {"B","1"}, {"F","1"}, "G",
- {"C","1"}, {"H","4"}, "I"]}};
+ {"C", [{"A","1.0.0"}, "D", {"E","3.0.0"},
+ {"B","1.0.0"}, {"F","1.0.0"}, "G",
+ {"C","1.0.0"}, {"H","4.0.0"}, "I"]}};
upgrades(tree_a) ->
- {[{"A", "1", [{"D",[{"J",[]}]},
- {"E",[{"I","1",[]}]}]},
- {"B", "1", [{"F",[]},
+ {[{"A", "1.0.0", [{"D",[{"J",[]}]},
+ {"E",[{"I","1.0.0",[]}]}]},
+ {"B", "1.0.0", [{"F",[]},
{"G",[]}]},
- {"C", "1", [{"H",[]},
- {"I","2",[]}]}
+ {"C", "1.0.0", [{"H",[]},
+ {"I","2.0.0",[]}]}
],
- [{"A", "1", [{"D",[{"J",[]}]},
- {"E",[{"I","1",[]}]}]},
- {"B", "1", [{"F",[]},
+ [{"A", "1.0.0", [{"D",[{"J",[]}]},
+ {"E",[{"I","1.0.0",[]}]}]},
+ {"B", "1.0.0", [{"F",[]},
{"G",[]}]},
- {"C", "2", [{"H",[]}]}
+ {"C", "2.0.0", [{"H",[]}]}
],
["C"],
- {"A", [{"A","1"}, "D", "J", "E",
- {"B","1"}, "F", "G",
- {"C","1"}, "H", {"I","2"}]}};
+ {"A", [{"A","1.0.0"}, "D", "J", "E",
+ {"B","1.0.0"}, "F", "G",
+ {"C","1.0.0"}, "H", {"I","2.0.0"}]}};
upgrades(tree_b) ->
- {[{"A", "1", [{"D",[{"J",[]}]},
- {"E",[{"I","1",[]}]}]},
- {"B", "1", [{"F",[]},
+ {[{"A", "1.0.0", [{"D",[{"J",[]}]},
+ {"E",[{"I","1.0.0",[]}]}]},
+ {"B", "1.0.0", [{"F",[]},
{"G",[]}]},
- {"C", "1", [{"H",[]},
- {"I","2",[]}]}
+ {"C", "1.0.0", [{"H",[]},
+ {"I","2.0.0",[]}]}
],
- [{"A", "1", [{"D",[{"J",[]}]},
- {"E",[{"I","1",[]}]}]},
- {"B", "1", [{"F",[]},
+ [{"A", "1.0.0", [{"D",[{"J",[]}]},
+ {"E",[{"I","1.0.0",[]}]}]},
+ {"B", "1.0.0", [{"F",[]},
{"G",[]}]},
- {"C", "2", [{"H",[]}]}
+ {"C", "2.0.0", [{"H",[]}]}
],
["C"],
- {"B", [{"A","1"}, "D", "J", "E",
- {"B","1"}, "F", "G",
- {"C","1"}, "H", {"I","2"}]}};
+ {"B", [{"A","1.0.0"}, "D", "J", "E",
+ {"B","1.0.0"}, "F", "G",
+ {"C","1.0.0"}, "H", {"I","2.0.0"}]}};
upgrades(tree_c) ->
- {[{"A", "1", [{"D",[{"J",[]}]},
- {"E",[{"I","1",[]}]}]},
- {"B", "1", [{"F",[]},
+ {[{"A", "1.0.0", [{"D",[{"J",[]}]},
+ {"E",[{"I","1.0.0",[]}]}]},
+ {"B", "1.0.0", [{"F",[]},
{"G",[]}]},
- {"C", "1", [{"H",[]},
- {"I","2",[]}]}
+ {"C", "1.0.0", [{"H",[]},
+ {"I","2.0.0",[]}]}
],
- [{"A", "1", [{"D",[{"J",[]}]},
- {"E",[{"I","1",[]}]}]},
- {"B", "1", [{"F",[]},
+ [{"A", "1.0.0", [{"D",[{"J",[]}]},
+ {"E",[{"I","1.0.0",[]}]}]},
+ {"B", "1.0.0", [{"F",[]},
{"G",[]}]},
- {"C", "1", [{"H",[]}]}
+ {"C", "1.0.0", [{"H",[]}]}
],
["C","I"],
- {"C", [{"A","1"}, "D", "J", "E", {"I","1"},
- {"B","1"}, "F", "G",
- {"C","1"}, "H"]}};
+ {"C", [{"A","1.0.0"}, "D", "J", "E", {"I","1.0.0"},
+ {"B","1.0.0"}, "F", "G",
+ {"C","1.0.0"}, "H"]}};
upgrades(tree_c2) ->
- {[{"A", "1", [{"D",[{"J",[]}]},
- {"E",[{"I","1",[]}]}]},
- {"B", "1", [{"F",[]},
+ {[{"A", "1.0.0", [{"D",[{"J",[]}]},
+ {"E",[{"I","1.0.0",[]}]}]},
+ {"B", "1.0.0", [{"F",[]},
{"G",[]}]},
- {"C", "1", [{"H",[]},
- {"I","2",[]}]}
+ {"C", "1.0.0", [{"H",[]},
+ {"I","2.0.0",[]}]}
],
- [{"A", "1", [{"D",[{"J",[]}]},
- {"E",[{"I","1",[]}]}]},
- {"B", "1", [{"F",[]},
+ [{"A", "1.0.0", [{"D",[{"J",[]}]},
+ {"E",[{"I","1.0.0",[]}]}]},
+ {"B", "1.0.0", [{"F",[]},
{"G",[]}]},
- {"C", "1", [{"H",[{"K",[]}]},
- {"I","2",[]}]}
+ {"C", "1.0.0", [{"H",[{"K",[]}]},
+ {"I","2.0.0",[]}]}
],
["C", "H"],
- {"C", [{"A","1"}, "D", "J", "E",
- {"B","1"}, "F", "G",
- {"C","1"}, "H", {"I", "2"}, "K"]}};
+ {"C", [{"A","1.0.0"}, "D", "J", "E",
+ {"B","1.0.0"}, "F", "G",
+ {"C","1.0.0"}, "H", {"I", "2.0.0"}, "K"]}};
upgrades(tree_cj) ->
- {[{"A", "1", [{"D",[{"J", "1",[]}]},
- {"E",[{"I","1",[]}]}]},
- {"B", "1", [{"F",[]},
+ {[{"A", "1.0.0", [{"D",[{"J", "1.0.0",[]}]},
+ {"E",[{"I","1.0.0",[]}]}]},
+ {"B", "1.0.0", [{"F",[]},
{"G",[]}]},
- {"C", "1", [{"H",[]},
- {"I","1",[]}]}
+ {"C", "1.0.0", [{"H",[]},
+ {"I","1.0.0",[]}]}
],
- [{"A", "1", [{"D",[{"J", "2", []}]},
- {"E",[{"I","1",[]}]}]},
- {"B", "1", [{"F",[]},
+ [{"A", "1.0.0", [{"D",[{"J", "2.0.0", []}]},
+ {"E",[{"I","1.0.0",[]}]}]},
+ {"B", "1.0.0", [{"F",[]},
{"G",[]}]},
- {"C", "1", [{"H",[]},
- {"I","1",[]}]}
+ {"C", "1.0.0", [{"H",[]},
+ {"I","1.0.0",[]}]}
],
["C","J"],
- {"C", [{"A","1"}, "D", {"J", "1"}, "E", {"I","1"},
- {"B","1"}, "F", "G",
- {"C","1"}, "H"]}};
+ {"C", [{"A","1.0.0"}, "D", {"J", "1.0.0"}, "E", {"I","1.0.0"},
+ {"B","1.0.0"}, "F", "G",
+ {"C","1.0.0"}, "H"]}};
upgrades(tree_ac) ->
- {[{"A", "1", [{"D",[{"J",[]}]},
- {"E",[{"I","1",[]}]}]},
- {"B", "1", [{"F",[]},
+ {[{"A", "1.0.0", [{"D",[{"J",[]}]},
+ {"E",[{"I","1.0.0",[]}]}]},
+ {"B", "1.0.0", [{"F",[]},
{"G",[]}]},
- {"C", "1", [{"H",[]},
- {"I","2",[]}]}
+ {"C", "1.0.0", [{"H",[]},
+ {"I","2.0.0",[]}]}
],
- [{"A", "1", [{"D",[{"J",[]}]},
- {"E",[{"I","1",[]}]}]},
- {"B", "1", [{"F",[]},
+ [{"A", "1.0.0", [{"D",[{"J",[]}]},
+ {"E",[{"I","1.0.0",[]}]}]},
+ {"B", "1.0.0", [{"F",[]},
{"G",[]}]},
- {"C", "1", [{"H",[]}]}
+ {"C", "1.0.0", [{"H",[]}]}
],
["C","I"],
- {"C, A", [{"A","1"}, "D", "J", "E", {"I","1"},
- {"B","1"}, "F", "G",
- {"C","1"}, "H"]}};
+ {"C, A", [{"A","1.0.0"}, "D", "J", "E", {"I","1.0.0"},
+ {"B","1.0.0"}, "F", "G",
+ {"C","1.0.0"}, "H"]}};
upgrades(tree_all) ->
- {[{"A", "1", [{"D",[{"J",[]}]},
- {"E",[{"I","1",[]}]}]},
- {"B", "1", [{"F",[]},
+ {[{"A", "1.0.0", [{"D",[{"J",[]}]},
+ {"E",[{"I","1.0.0",[]}]}]},
+ {"B", "1.0.0", [{"F",[]},
{"G",[]}]},
- {"C", "1", [{"H",[]},
- {"I","2",[]}]}
+ {"C", "1.0.0", [{"H",[]},
+ {"I","2.0.0",[]}]}
],
- [{"A", "1", [{"D",[{"J",[]}]},
- {"E",[{"I","1",[]}]}]},
- {"B", "1", [{"F",[]},
+ [{"A", "1.0.0", [{"D",[{"J",[]}]},
+ {"E",[{"I","1.0.0",[]}]}]},
+ {"B", "1.0.0", [{"F",[]},
{"G",[]}]},
- {"C", "1", [{"H",[]}]}
+ {"C", "1.0.0", [{"H",[]}]}
],
["C","I"],
- {"", [{"A","1"}, "D", "J", "E", {"I","1"},
- {"B","1"}, "F", "G",
- {"C","1"}, "H"]}};
+ {"", [{"A","1.0.0"}, "D", "J", "E", {"I","1.0.0"},
+ {"B","1.0.0"}, "F", "G",
+ {"C","1.0.0"}, "H"]}};
upgrades(delete_d) ->
- {[{"A", "1", [{"B", [{"D", "1", []}]},
- {"C", [{"D", "2", []}]}]}
+ {[{"A", "1.0.0", [{"B", [{"D", "1.0.0", []}]},
+ {"C", [{"D", "2.0.0", []}]}]}
],
- [{"A", "2", [{"B", []},
+ [{"A", "2.0.0", [{"B", []},
{"C", []}]}
],
["A","B", "C"],
%% upgrade vs. new tree
- {"", [{"A","2"}, "B", "C"]}};
+ {"", [{"A","2.0.0"}, "B", "C"]}};
upgrades(promote) ->
- {[{"A", "1", [{"C", "1", []}]},
- {"B", "1", [{"D", "1", []}]}
+ {[{"A", "1.0.0", [{"C", "1.0.0", []}]},
+ {"B", "1.0.0", [{"D", "1.0.0", []}]}
],
- [{"A", "2", [{"C", "2", []}]},
- {"B", "2", [{"D", "2", []}]},
- {"C", "3", []}
+ [{"A", "2.0.0", [{"C", "2.0.0", []}]},
+ {"B", "2.0.0", [{"D", "2.0.0", []}]},
+ {"C", "3.0.0", []}
],
["A","B","C","D"],
- {"C", [{"A","1"},{"C","3"},{"B","1"},{"D","1"}]}};
+ {"C", [{"A","1.0.0"},{"C","3.0.0"},{"B","1.0.0"},{"D","1.0.0"}]}};
upgrades(stable_lock) ->
- {[{"A", "1", [{"C", "1", []}]},
- {"B", "1", [{"D", "1", []}]}
+ {[{"A", "1.0.0", [{"C", "1.0.0", []}]},
+ {"B", "1.0.0", [{"D", "1.0.0", []}]}
], % lock after this
- [{"A", "2", [{"C", "2", []}]},
- {"B", "2", [{"D", "2", []}]}
+ [{"A", "2.0.0", [{"C", "2.0.0", []}]},
+ {"B", "2.0.0", [{"D", "2.0.0", []}]}
],
[],
%% Run a regular lock and no app should be upgraded
- {"any", [{"A","1"},{"C","1"},{"B","1"},{"D","1"}]}};
+ {"any", [{"A","1.0.0"},{"C","1.0.0"},{"B","1.0.0"},{"D","1.0.0"}]}};
upgrades(fwd_lock) ->
- {[{"A", "1", [{"C", "1", []}]},
- {"B", "1", [{"D", "1", []}]}
+ {[{"A", "1.0.0", [{"C", "1.0.0", []}]},
+ {"B", "1.0.0", [{"D", "1.0.0", []}]}
],
- [{"A", "2", [{"C", "2", []}]},
- {"B", "2", [{"D", "2", []}]}
+ [{"A", "2.0.0", [{"C", "2.0.0", []}]},
+ {"B", "2.0.0", [{"D", "2.0.0", []}]}
],
["A","B","C","D"],
%% For this one, we should build, rewrite the lock
%% file to include the result post-upgrade, and then
%% run a regular lock to see that the lock file is respected
%% in deps.
- {"any", [{"A","2"},{"C","2"},{"B","2"},{"D","2"}]}};
+ {"any", [{"A","2.0.0"},{"C","2.0.0"},{"B","2.0.0"},{"D","2.0.0"}]}};
upgrades(compile_upgrade_parity) ->
- {[{"A", "1", [{"D",[{"J",[]}]},
- {"E",[{"I","1",[]}]}]},
- {"B", "1", [{"F",[]},
+ {[{"A", "1.0.0", [{"D",[{"J",[]}]},
+ {"E",[{"I","1.0.0",[]}]}]},
+ {"B", "1.0.0", [{"F",[]},
{"G",[]}]},
- {"C", "1", [{"H",[]},
- {"I","2",[]}]}
+ {"C", "1.0.0", [{"H",[]},
+ {"I","2.0.0",[]}]}
],
[],
[],
- {"", [{"A","1"}, "D", "J", "E", {"I","1"},
- {"B","1"}, "F", "G",
- {"C","1"}, "H"]}};
+ {"", [{"A","1.0.0"}, "D", "J", "E", {"I","1.0.0"},
+ {"B","1.0.0"}, "F", "G",
+ {"C","1.0.0"}, "H"]}};
upgrades(umbrella_config) ->
- {[{"A", "1", []}],
- [{"A", "2", []}],
+ {[{"A", "1.0.0", []}],
+ [{"A", "2.0.0", []}],
["A"],
- {"A", [{"A","2"}]}}.
+ {"A", [{"A","2.0.0"}]}};
+upgrades(profiles) ->
+ %% Ensure that we can unlock deps under a given profile;
+ %% B and C should both be in a custom profile
+ %% and must not be locked.
+ {[{"A", "1.0.0", [{"D",[]},
+ {"E","3.0.0",[]}]},
+ {"B", "1.0.0", [{"F","1.0.0",[]},
+ {"G",[]}]},
+ {"C", "0.0.0", [{"H","3.0.0",[]},
+ {"I",[]}]}],
+ [{"A", "2.0.0", [{"D",[]},
+ {"E","2.0.0",[]}]},
+ {"B", "2.0.0", [{"F","2.0.0",[]},
+ {"G",[]}]},
+ {"C", "1.0.0", [{"H","4.0.0",[]},
+ {"I",[]}]}],
+ ["A","B","C","E","F","H"],
+ {"C", [{"A","1.0.0"}, "D", {"E","3.0.0"},
+ {"B","2.0.0"}, {"F","2.0.0"}, "G",
+ {"C","1.0.0"}, {"H","4.0.0"}, "I"]}};
+upgrades(profiles_exclusion) ->
+ %% Ensure that we can unlock deps under a given profile;
+ %% B and C should both be in a custom profile
+ %% and must not be locked.
+ {[{"A", "1.0.0", [{"D",[]},
+ {"E","3.0.0",[]}]},
+ {"B", "1.0.0", [{"F","1.0.0",[]},
+ {"G",[]}]},
+ {"C", "0.0.0", [{"H","3.0.0",[]},
+ {"I",[]}]}],
+ [{"A", "2.0.0", [{"D",[]},
+ {"E","2.0.0",[]}]},
+ {"B", "2.0.0", [{"F","2.0.0",[]},
+ {"G",[]}]},
+ {"C", "1.0.0", [{"H","4.0.0",[]},
+ {"I",[]}]}],
+ ["A","B","C","E","F","H"],
+ {"A", [{"A","1.0.0"}, "D", {"E","3.0.0"},
+ {"B","2.0.0"}, {"F","2.0.0"}, "G",
+ {"C","1.0.0"}, {"H","4.0.0"}, "I"]}}.
%% TODO: add a test that verifies that unlocking files and then
%% running the upgrade code is enough to properly upgrade things.
@@ -613,6 +671,37 @@ umbrella_config(Config) ->
),
meck:unload(rebar_prv_upgrade).
+profiles(Config) ->
+ apply(?config(mock, Config), []),
+ {ok, TopConfig} = file:consult(?config(rebarconfig, Config)),
+ %% Install dependencies before re-mocking for an upgrade
+ rebar_test_utils:run_and_check(Config, TopConfig, ["lock"], {ok, []}),
+ %% Install test deps along with them
+ rebar_test_utils:run_and_check(Config, TopConfig, ["as","fake","lock"], {ok, []}),
+ {App, Unlocks} = ?config(expected, Config),
+ ct:pal("Upgrades: ~p -> ~p", [App, Unlocks]),
+ Expectation = case Unlocks of
+ {error, Term} -> {error, Term};
+ _ -> {ok, [T || T <- Unlocks,
+ element(1,T) == dep orelse
+ lists:member(element(2,T), ["A","D","E"])]}
+ end,
+
+ meck:new(rebar_prv_app_discovery, [passthrough]),
+ meck:expect(rebar_prv_app_discovery, do, fun(S) ->
+ apply(?config(mock_update, Config), []),
+ meck:passthrough([S])
+ end),
+ NewRebarConf = rebar_test_utils:create_config(?config(apps, Config),
+ ?config(next_config, Config)),
+ {ok, NewRebarConfig} = file:consult(NewRebarConf),
+ rebar_test_utils:run_and_check(
+ Config, NewRebarConfig, ["as","fake","upgrade", App], Expectation
+ ),
+ meck:unload(rebar_prv_app_discovery).
+
+profiles_exclusion(Config) -> profiles(Config).
+
run(Config) ->
apply(?config(mock, Config), []),
ConfigPath = ?config(rebarconfig, Config),