anchor.diff:  -compile(export_all).
   
   all() -> [{group, overflow},
  -          {group, drain_buf}].
  +          {group, drain_buf},
  +          close_max_ttl].
   
   groups() -> [{overflow, [], [full_buffer_success, full_buffer_fail,
                                full_buffer_temp_fail, full_stack]},
  
positive.code:         1000 ->
              erlang:exit("process took more than 1s to exit")
      end.
  
negative.code:     %% The buffer was resized
      wait_for_mocked_call(logplex_drain_buffer, resize_msg_buffer, ['_',Val], 1, 1000).
  
  close_max_ttl(Config) ->
      ChannelId = ?config(channel, Config),
      Client = ?config(client, Config),
      client_call_status(Client, 200),
      logplex_channel:post_msg({channel, ChannelId}, fake_msg("mymsg1")),
      wait_for_mocked_call(logplex_http_client, raw_request, '_', 1, 50),
      timer:sleep(40),
      logplex_channel:post_msg({channel, ChannelId}, fake_msg("mymsg2")),
      wait_for_mocked_call(logplex_http_client, raw_request, '_', 2, 50),
      timer:sleep(40),
      Hist = meck:history(logplex_http_client),
      [First, Second] =
        [iolist_to_binary(IoData) ||
         {_Pid, {_Mod, raw_request, [_Ref, IoData, _TimeOut]}, _Res} <- Hist],
      %% ensure idle drain is closed
      wait_for_mocked_call(logplex_http_client, close, '_', 1, 20),
      {match, _} = re:run(First, "mymsg1"),
      {match, _} = re:run(Second, "mymsg2").
  
  %%% HELPERS
  wait_for_mocked_call(Mod, Fun, Args, NumCalls, Time) ->
      wait_for_mocked_call(Mod,Fun,Args, NumCalls, Time*1000,os:timestamp()).
  