Permalink
Browse files

Breaking up validate_broadcast to handle many bcasts.

This is done to test things like health check service recovery.
Such a recovery would have both a down and an up, so the state
progression and conresponding broadchast messages should be checked.
  • Loading branch information...
1 parent d0bc513 commit c748deb14c2b5b7b622b5e6db1e8c5dd9a1a91ec @lordnull lordnull committed Oct 4, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 test/node_watcher_qc.erl
View
@@ -323,6 +323,9 @@ deep_validate(S) ->
validate_broadcast(S0, Sfinal, Op) ->
Bcasts = broadcasts(),
+ validate_broadcast(S0, Sfinal, Op, Bcasts).
+
+validate_broadcast(S0, Sfinal, Op, Bcasts) ->
Transition = {is_node_up(node(), S0), is_node_up(node(), Sfinal), Op},
ExpPeers = Sfinal#state.peers,
case Transition of
@@ -342,6 +345,18 @@ validate_broadcast(S0, Sfinal, Op) ->
end,
true.
+validate_broadcasts(States, Op) ->
+ Bcasts = broadcasts(),
+ ?assertEqual(length(Bcasts) + 1, length(States)),
+ validate_broadcasts(States, Op, Bcasts).
+
+validate_broadcasts([S0, Sfinal], Op, [Bcast]) ->
+ validate_broadcast(S0, Sfinal, Op, [Bcast]);
+
+validate_broadcasts([S0, Sfinal | STail], Op, [Bcast | BTail]) ->
+ true = validate_broadcast(S0, Sfinal, Op, [Bcast]),
+ validate_broadcasts([Sfinal | STail], Op, BTail).
+
%% ====================================================================
%% Generators

0 comments on commit c748deb

Please sign in to comment.