summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/rebar_pkg_SUITE.erl14
-rw-r--r--test/rebar_pkg_alias_SUITE.erl6
-rw-r--r--test/rebar_upgrade_SUITE.erl9
3 files changed, 18 insertions, 11 deletions
diff --git a/test/rebar_pkg_SUITE.erl b/test/rebar_pkg_SUITE.erl
index 8003b10..7fdf55e 100644
--- a/test/rebar_pkg_SUITE.erl
+++ b/test/rebar_pkg_SUITE.erl
@@ -103,7 +103,7 @@ good_uncached(Config) ->
{Pkg,Vsn} = ?config(pkg, Config),
State = ?config(state, Config),
?assertEqual({ok, true},
- rebar_pkg_resource:download(Tmp, {pkg, Pkg, Vsn, undefined}, State)),
+ rebar_pkg_resource:download(Tmp, {pkg, Pkg, Vsn, ?good_checksum}, State)),
Cache = ?config(cache_dir, Config),
?assert(filelib:is_regular(filename:join(Cache, <<Pkg/binary, "-", Vsn/binary, ".tar">>))).
@@ -116,7 +116,7 @@ good_cached(Config) ->
?assert(filelib:is_regular(CachedFile)),
{ok, Content} = file:read_file(CachedFile),
?assertEqual({ok, true},
- rebar_pkg_resource:download(Tmp, {pkg, Pkg, Vsn, undefined}, State)),
+ rebar_pkg_resource:download(Tmp, {pkg, Pkg, Vsn, ?good_checksum}, State)),
{ok, Content} = file:read_file(CachedFile).
badindexchk(Config) ->
@@ -124,7 +124,7 @@ badindexchk(Config) ->
{Pkg,Vsn} = ?config(pkg, Config),
State = ?config(state, Config),
?assertMatch({bad_registry_checksum, _Path},
- rebar_pkg_resource:download(Tmp, {pkg, Pkg, Vsn, undefined}, State)),
+ rebar_pkg_resource:download(Tmp, {pkg, Pkg, Vsn, ?good_checksum}, State)),
%% The cached file is there for forensic purposes
Cache = ?config(cache_dir, Config),
?assert(filelib:is_regular(filename:join(Cache, <<Pkg/binary, "-", Vsn/binary, ".tar">>))).
@@ -134,7 +134,7 @@ badpkg(Config) ->
{Pkg,Vsn} = ?config(pkg, Config),
State = ?config(state, Config),
?assertMatch({bad_download, _Path},
- rebar_pkg_resource:download(Tmp, {pkg, Pkg, Vsn, undefined}, State)),
+ rebar_pkg_resource:download(Tmp, {pkg, Pkg, Vsn, ?good_checksum}, State)),
%% The cached file is there for forensic purposes
Cache = ?config(cache_dir, Config),
?assert(filelib:is_regular(filename:join(Cache, <<Pkg/binary, "-", Vsn/binary, ".tar">>))).
@@ -148,7 +148,7 @@ bad_to_good(Config) ->
?assert(filelib:is_regular(CachedFile)),
{ok, Contents} = file:read_file(CachedFile),
?assertEqual({ok, true},
- rebar_pkg_resource:download(Tmp, {pkg, Pkg, Vsn, undefined}, State)),
+ rebar_pkg_resource:download(Tmp, {pkg, Pkg, Vsn, ?good_checksum}, State)),
%% Cache has refreshed
?assert({ok, Contents} =/= file:read_file(CachedFile)).
@@ -161,7 +161,7 @@ good_disconnect(Config) ->
?assert(filelib:is_regular(CachedFile)),
{ok, Content} = file:read_file(CachedFile),
?assertEqual({ok, true},
- rebar_pkg_resource:download(Tmp, {pkg, Pkg, Vsn, undefined}, State)),
+ rebar_pkg_resource:download(Tmp, {pkg, Pkg, Vsn, ?good_checksum}, State)),
{ok, Content} = file:read_file(CachedFile).
bad_disconnect(Config) ->
@@ -169,7 +169,7 @@ bad_disconnect(Config) ->
{Pkg,Vsn} = ?config(pkg, Config),
State = ?config(state, Config),
?assertEqual({fetch_fail, Pkg, Vsn},
- rebar_pkg_resource:download(Tmp, {pkg, Pkg, Vsn, undefined}, State)).
+ rebar_pkg_resource:download(Tmp, {pkg, Pkg, Vsn, ?good_checksum}, State)).
pkgs_provider(Config) ->
Config1 = rebar_test_utils:init_rebar_state(Config),
diff --git a/test/rebar_pkg_alias_SUITE.erl b/test/rebar_pkg_alias_SUITE.erl
index fef2310..8915357 100644
--- a/test/rebar_pkg_alias_SUITE.erl
+++ b/test/rebar_pkg_alias_SUITE.erl
@@ -55,7 +55,7 @@ diff_alias(Config) ->
Config, RebarConfig, ["lock"],
{ok, [{lock, "fakelib"},{dep, "fakelib"}]}
),
- {ok, [LockData]} = file:consult(Lockfile),
+ {ok, [{_Vsn, LockData}|_]} = file:consult(Lockfile),
?assert(lists:any(fun({<<"fakelib">>,{pkg,<<"goodpkg">>,_},_}) -> true
; (_) -> false end, LockData)),
%% An second run yields the same
@@ -63,13 +63,13 @@ diff_alias(Config) ->
Config, RebarConfig, ["lock"],
{ok, [{lock, "fakelib"},{dep, "fakelib"}]}
),
- {ok, [LockData]} = file:consult(Lockfile),
+ {ok, [{_Vsn, LockData}|_]} = file:consult(Lockfile),
%% So does an upgrade
rebar_test_utils:run_and_check(
Config, RebarConfig, ["upgrade"],
{ok, [{lock, "fakelib"},{dep, "fakelib"}]}
),
- {ok, [LockData]} = file:consult(Lockfile).
+ {ok, [{_Vsn, LockData}|_]} = file:consult(Lockfile).
diff_alias_vsn(Config) -> diff_alias(Config).
diff --git a/test/rebar_upgrade_SUITE.erl b/test/rebar_upgrade_SUITE.erl
index cfe1d8a..22fb14d 100644
--- a/test/rebar_upgrade_SUITE.erl
+++ b/test/rebar_upgrade_SUITE.erl
@@ -610,7 +610,14 @@ novsn_pkg(Config) ->
rewrite_locks({ok, Expectations}, Config) ->
AppDir = ?config(apps, Config),
LockFile = filename:join([AppDir, "rebar.lock"]),
- {ok, [Locks]} = file:consult(LockFile),
+ Locks = case ?config(deps_type, Config) of
+ git ->
+ {ok, [LockData]} = file:consult(LockFile),
+ LockData;
+ pkg ->
+ {ok, [{_Vsn, LockData}|_]} = file:consult(LockFile),
+ LockData
+ end,
ExpLocks = [{list_to_binary(Name), Vsn}
|| {lock, Name, Vsn} <- Expectations],
NewLocks = lists:foldl(