Skip to content

Commit

Permalink
Inermittent unit test failures
Browse files Browse the repository at this point in the history
When setting up the sink for a test it might receive a heartbeat before the transport has been setup - soingore the heartbeat in this case.  This only seems to be tiggered on Travis CI.

In riak_repl2_rtq tests intermittently the Seq2 might race with Seq1?  Other such events ahve a sleep in-between of 1200, so added here.
  • Loading branch information
martinsumner committed May 12, 2020
1 parent 466ace6 commit 927e0cd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/riak_core_cluster_conn.erl
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ handle_sync_event(current_state, _From, StateName, State) ->
Reply = {StateName, State},
{reply, Reply, StateName, State};
handle_sync_event(force_stop, _From, _StateName, State) ->
ok = lager:debug("Stopping because I was asked nicely to."),
% ok = lager:debug("Stopping because I was asked nicely to."),
{stop, normal, ok, State};
handle_sync_event(_Event, _From, StateName, State) ->
Reply = ok,
Expand Down
3 changes: 3 additions & 0 deletions src/riak_repl2_rtsink_conn.erl
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ terminate(_Reason, State) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.

send_heartbeat(undefined, _Socket) ->
lager:warning("Heartbeat received but transport undefined"),
ok;
send_heartbeat(Transport, Socket) ->
Transport:send(Socket, riak_repl2_rtframe:encode(heartbeat, undefined)).

Expand Down
1 change: 1 addition & 0 deletions test/riak_repl2_rtq_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ overload_test_() ->
% msg queue = 0, totol objects dropped = 5
riak_repl2_rtq:push(1, term_to_binary([<<"object">>])),
Seq1 = pull(5),
timer:sleep(1200),
Seq2 = pull(1),
?assertEqual(Seq1 + 1 + 5, Seq2),
Status = riak_repl2_rtq:status(),
Expand Down

0 comments on commit 927e0cd

Please sign in to comment.