diff options
author | Eric Meadows-Jönsson <eric.meadows.jonsson@gmail.com> | 2018-12-29 15:57:19 +0100 |
---|---|---|
committer | Eric Meadows-Jönsson <eric.meadows.jonsson@gmail.com> | 2018-12-30 16:06:58 +0100 |
commit | 6a5ad07bc49a366ecc81ea87feb2de77c825771a (patch) | |
tree | 3b6ca817d2a97665314305f32b3682e7f881f664 /test | |
parent | 968458b43592ee112ea85addc674af3beb476da6 (diff) |
Update hex_core and add mirror_of repo config
Diffstat (limited to 'test')
-rw-r--r-- | test/rebar_pkg_SUITE.erl | 22 | ||||
-rw-r--r-- | test/rebar_pkg_alias_SUITE.erl | 14 |
2 files changed, 18 insertions, 18 deletions
diff --git a/test/rebar_pkg_SUITE.erl b/test/rebar_pkg_SUITE.erl index ee74af5..ad06abd 100644 --- a/test/rebar_pkg_SUITE.erl +++ b/test/rebar_pkg_SUITE.erl @@ -99,7 +99,7 @@ init_per_testcase(bad_disconnect=Name, Config0) -> Config = mock_config(Name, Config1), meck:expect(hex_repo, get_tarball, fun(_, _, _) -> {error, econnrefused} - end), + end), Config; init_per_testcase(Name, Config0) -> Config = [{good_cache, false}, @@ -252,7 +252,7 @@ mock_config(Name, Config) -> CacheRoot = filename:join([Priv, "cache", atom_to_list(Name)]), TmpDir = filename:join([Priv, "tmp", atom_to_list(Name)]), Tid = ets:new(registry_table, [public]), - AllDeps = [ + AllDeps = [ {{<<"badindexchk">>,<<"1.0.0">>}, [[], ?bad_checksum, [<<"rebar3">>]]}, {{<<"goodpkg">>,<<"1.0.0">>}, [[], ?good_checksum, [<<"rebar3">>]]}, {{<<"goodpkg">>,<<"1.0.1">>}, [[], ?good_checksum, [<<"rebar3">>]]}, @@ -267,7 +267,7 @@ mock_config(Name, Config) -> ok = ets:tab2file(Tid, filename:join([CacheDir, "registry"])), catch ets:delete(?PACKAGE_TABLE), - rebar_packages:new_package_table(), + rebar_packages:new_package_table(), lists:foreach(fun({{N, Vsn}, [Deps, Checksum, _]}) -> case ets:member(?PACKAGE_TABLE, {ec_cnv:to_binary(N), Vsn, <<"hexpm">>}) of false -> @@ -279,18 +279,18 @@ mock_config(Name, Config) -> ok end end, AllDeps), - + meck:new(hex_repo, [passthrough]), - meck:expect(hex_repo, get_package, + meck:expect(hex_repo, get_package, fun(_Config, PkgName) -> Matches = ets:match_object(Tid, {{PkgName,'_'}, '_'}), - Releases = + Releases = [#{checksum => Checksum, version => Vsn, - dependencies => Deps} || + dependencies => Deps} || {{_, Vsn}, [Deps, Checksum, _]} <- Matches], - {ok, {200, #{}, #{releases => Releases}}} + {ok, {200, #{}, Releases}} end), %% The state returns us a fake registry @@ -321,7 +321,7 @@ mock_config(Name, Config) -> %% Cache fetches are mocked -- we assume the server and clients are %% correctly used. GoodCache = ?config(good_cache, Config), - {Pkg,Vsn} = ?config(pkg, Config), + {Pkg,Vsn} = ?config(pkg, Config), PkgFile = <<Pkg/binary, "-", Vsn/binary, ".tar">>, {ok, PkgContents} = file:read_file(filename:join(?config(data_dir, Config), PkgFile)), @@ -329,8 +329,8 @@ mock_config(Name, Config) -> {ok, {304, #{<<"etag">> => ?good_etag}, <<>>}}; (_, _, _) -> {ok, {200, #{<<"etag">> => ?good_etag}, PkgContents}} - end), - + end), + [{cache_root, CacheRoot}, {cache_dir, CacheDir}, {tmp_dir, TmpDir}, diff --git a/test/rebar_pkg_alias_SUITE.erl b/test/rebar_pkg_alias_SUITE.erl index 079a3fd..1ef5a34 100644 --- a/test/rebar_pkg_alias_SUITE.erl +++ b/test/rebar_pkg_alias_SUITE.erl @@ -224,7 +224,7 @@ mock_config(Name, Config) -> meck:expect(rebar_prv_update, do, fun(State) -> {ok, State} end), catch ets:delete(?PACKAGE_TABLE), - rebar_packages:new_package_table(), + rebar_packages:new_package_table(), lists:foreach(fun({{N, Vsn}, [Deps, Checksum, _]}) -> case ets:member(?PACKAGE_TABLE, {ec_cnv:to_binary(N), Vsn, <<"hexpm">>}) of @@ -238,11 +238,11 @@ mock_config(Name, Config) -> end; ({_N, _Vsns}) -> ok - - end, AllDeps), + + end, AllDeps), meck:new(hex_repo, [passthrough]), - meck:expect(hex_repo, get_package, + meck:expect(hex_repo, get_package, fun(_Config, PkgName) -> Matches = ets:match_object(Tid, {{PkgName,'_'}, '_'}), Releases = @@ -251,13 +251,13 @@ mock_config(Name, Config) -> dependencies => [{DAppName, {pkg, DN, DV, undefined}} || {DN, DV, _, DAppName} <- Deps]} || {{_, Vsn}, [Deps, Checksum, _]} <- Matches], - {ok, {200, #{}, #{releases => Releases}}} + {ok, {200, #{}, Releases}} end), meck:expect(hex_repo, get_tarball, fun(_, _, _) -> {ok, {304, #{<<"etag">> => EtagGood}, <<>>}} - end), - + end), + %% Move all packages to cache NewConf = [{cache_root, CacheRoot}, {cache_dir, CacheDir}, |