diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2015-02-11 20:06:49 +0000 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2015-02-11 21:57:58 +0000 |
commit | 6d8567a7edbf206a0f595c22ecd17af0c46acb87 (patch) | |
tree | 5a64739e117bd077345f815936a7168c2bb6d6ba /test/rebar_test_utils.erl | |
parent | 62dc8fa9c745cca60f45ad301e05c8b70517626c (diff) |
Support multiple app upgrade & lock tests
- Many apps is supported through and through
- Not mentioning any app upgrades all apps
- Locks are refreshed on disk and tested as such after an upgrade
Diffstat (limited to 'test/rebar_test_utils.erl')
-rw-r--r-- | test/rebar_test_utils.erl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/rebar_test_utils.erl b/test/rebar_test_utils.erl index 827d134..96200a6 100644 --- a/test/rebar_test_utils.erl +++ b/test/rebar_test_utils.erl @@ -103,6 +103,8 @@ create_random_vsn() -> check_results(AppDir, Expected) -> BuildDir = filename:join([AppDir, "_build", "lib"]), CheckoutsDir = filename:join([AppDir, "_checkouts"]), + LockFile = filename:join([AppDir, "rebar.lock"]), + Locks = lists:flatten(rebar_config:consult_file(LockFile)), Apps = rebar_app_discover:find_apps([AppDir]), InvalidApps = rebar_app_discover:find_apps([AppDir], invalid), ValidApps = rebar_app_discover:find_apps([AppDir], valid), @@ -153,6 +155,18 @@ check_results(AppDir, Expected) -> ?assertEqual(iolist_to_binary(Vsn), iolist_to_binary(rebar_app_info:original_vsn(App))) end + ; ({lock, Name}) -> + ct:pal("Name: ~p", [Name]), + ?assertNotEqual(false, lists:keyfind(iolist_to_binary(Name), 1, Locks)) + ; ({lock, Name, Vsn}) -> + ct:pal("Name: ~p, Vsn: ~p", [Name, Vsn]), + case lists:keyfind(iolist_to_binary(Name), 1, Locks) of + false -> + error({lock_not_found, Name}); + {_LockName, {_, _, {ref, LockVsn}}, _} -> + ?assertEqual(iolist_to_binary(Vsn), + iolist_to_binary(LockVsn)) + end end, Expected). write_src_file(Dir, Name) -> |