Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More reliable tests for log transmission

Log messages can land in non-sequential order due to be the receive/send
routine. this fix makes it so we reorder all the messages received to
verify them first.
  • Loading branch information...
commit 58487de3c34bc6ca2ceab9b4691c69346b692bfc 1 parent 61c0ae6
Fred Hebert ferd authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 test/logplex_api_SUITE.erl
9 test/logplex_api_SUITE.erl
View
@@ -72,10 +72,13 @@ v2_canary_fetch(Config) ->
%% have 10, each with the right numbers, in order, at the last position
Body = proplists:get_value(body, Res),
Logs = string:tokens(Body, "\n"),
- 10 = length(Logs),
ct:pal("zips: ~p",[lists:zip(lists:seq(1,10),Logs)]),
- 10 = length([1 || {N,Log} <- lists:zip(lists:seq(1,10),Logs),
- lists:suffix(integer_to_list(N), Log)]),
+ 10 = length(Logs),
+ [1,2,3,4,5,6,7,8,9,10] = lists:sort(
+ [begin
+ {match, [N]} = re:run(Log, "[0-9]{1,2}$", [{capture,first,list}]),
+ list_to_integer(N)
+ end || Log <- Logs]),
Config.
%% Other helpers
Please sign in to comment.
Something went wrong with that request. Please try again.