You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.4 KiB

пре 10 година
  1. -module(rebar_resource_SUITE).
  2. -compile(export_all).
  3. -include_lib("common_test/include/ct.hrl").
  4. -include_lib("eunit/include/eunit.hrl").
  5. all() -> [{group, git}, {group, pkg}, {group, hg}].
  6. groups() ->
  7. [{all, [], [change_type_upgrade]},
  8. {git, [], [{group, all}]},
  9. {pkg, [], [{group, all}]},
  10. {hg, [], [{group, all}]}].
  11. init_per_group(all, Config) ->
  12. State = rebar_state:resources(rebar_state:new(), [{git, rebar_git_resource},
  13. {pkg, rebar_pkg_resource},
  14. {hg, rebar_hg_resource}]),
  15. [{state, State} | Config];
  16. init_per_group(Name, Config) ->
  17. [{type, Name},
  18. {resource, {Name, "https://example.org/user/app", "vsn"}} | Config].
  19. end_per_group(_, _Config) ->
  20. ok.
  21. %% Changing the resource type is seen as an upgrade
  22. init_per_testcase(change_type_upgrade, Config) ->
  23. Type = ?config(type, Config),
  24. TypeStr = atom_to_list(Type),
  25. DirName = filename:join([?config(priv_dir, Config), "resource_"++TypeStr]),
  26. ec_file:mkdir_path(DirName),
  27. [{path, DirName} | Config].
  28. end_per_testcase(_, Config) ->
  29. Config.
  30. change_type_upgrade(Config) ->
  31. ?assert(rebar_fetch:needs_update(?config(path, Config),
  32. ?config(resource, Config),
  33. ?config(state, Config))).