Added more tests & functionality. (failing join table, create_table_test with force)

This commit is contained in:
Jonatan Pålsson 2011-02-17 10:04:54 +01:00
parent 654aa837dd
commit 391af1a96a
2 changed files with 31 additions and 7 deletions

View file

@ -14,3 +14,20 @@ stop_test() ->
ggs_coordinator:stop("Terminate now"), % Send stop message
timer:sleep(100), % Wait for cleaning..
?assert((erlang:process_info(Coord) == undefined)). % Did it stop?
join_bad_table_test() ->
{ok, _Coord} = ggs_coordinator:start_link(),
Response = ggs_coordinator:join_table("Nonexistant table"),
ggs_coordinator:stop(""),
timer:sleep(100),
?assert(Response == {error, no_such_table}).
create_table_test() ->
{ok, _Coord} = ggs_coordinator:start_link(),
% Forcibly create a table. This functionality should be disabled
% in the production system, but is pretty nice for testing.
Response = ggs_coordinator:create_table({force, 1337}),
ggs_coordinator:stop(""),
timer:sleep(100),
?assert(Response == {ok, 1337}).