kvs_SUITE.erl 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. -module(kvs_SUITE).
  2. -include_lib("common_test/include/ct.hrl").
  3. -include_lib("kvs/include/entry.hrl").
  4. -compile(export_all).
  5. suite() -> [{timetrap,{seconds,30}}].
  6. all() -> [{group, feed},{group,acl}].
  7. groups() -> [{feed,[entry,comment,user]},
  8. {acl,[access]}].
  9. init_per_suite(Config) ->
  10. application:start(mnesia),
  11. application:start(kvs),
  12. application:set_env(kvs, schema, [kvs_user, kvs_acl, kvs_feed, kvs_subscription]),
  13. application:set_env(kvs, dba, store_mnesia),
  14. kvs:join(),
  15. kvs:init_db(),
  16. ct:log("-> Dir ~p~n",[kvs:dir()]),
  17. Config.
  18. end_per_suite(Config) ->
  19. kvs:destroy(),
  20. application:stop(kvs),
  21. ok.
  22. init_per_group(_Name, _Config) ->
  23. ok.
  24. end_per_group(_Name, _Config) ->
  25. ok.
  26. access(Config) -> ok.
  27. comment(Config) -> ok.
  28. user(Config) -> ok.
  29. entry(Config) ->
  30. Fid = 1,
  31. kvs:add(#entry{id={1,Fid},feed_id=Fid}),
  32. kvs:add(#entry{id={2,Fid},feed_id=Fid}),
  33. L = kvs:entries(kvs:get(feed,Fid),entry,undefined),
  34. List = [ Key || #entry{id=Key} <- L ],
  35. Length = length(List),
  36. 2 == Length,
  37. List == [{1,1},{2,1}],
  38. ct:log("-> List ~p~n", [List]),
  39. ok.