From 6d674d84019b47ae5fae85a51a15d8273740087c Mon Sep 17 00:00:00 2001 From: Micah Warren Date: Mon, 8 Dec 2014 15:59:08 -0600 Subject: [PATCH] Added check for last_fullsync_completed in stats. --- tests/replication_stats.erl | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/tests/replication_stats.erl b/tests/replication_stats.erl index 2fdcde99a..3888b19ec 100644 --- a/tests/replication_stats.erl +++ b/tests/replication_stats.erl @@ -78,17 +78,18 @@ fullsync_enabled_and_started() -> {FullTime, _} = timer:tc(repl_util, start_and_wait_until_fullsync_complete, [LeaderA, undefined, Me]), - lager:info("Fullsync completed in ~p", [FullTime]) + lager:info("Fullsync completed in ~p", [FullTime]), + Me ! fullsync_completed end), - Result = receive + StartedResult = receive fullsync_started -> lager:info("Fullsync started!"), case rpc:call(LeaderA, riak_repl_console, fs_remotes_status, []) of {badrpc, _} -> - fail; + badrpc; Stats -> ?assertEqual(Stats, [{fullsync_enabled, "B"}, @@ -96,10 +97,25 @@ fullsync_enabled_and_started() -> pass end after 60000 -> - fail + timeout end, + ?assertEqual(pass, StartedResult), + + _ = receive + fullsync_completed -> ok + after 60000 -> + ?assert(timeout) + end, + + FullStats = rpc:call(AFirst, riak_repl_console, status, [quiet]), + CoordinatorStats = proplists:get_value(fullsync_coordinator, FullStats, []), + BStats = proplists:get_value("B", CoordinatorStats, []), + LastFullsyncValue = proplists:get_value(last_fullsync_completed, BStats, no_exists), + + ?assertMatch({{_Year, _Month, _Day}, {_Hour, _Minute, _Second}}, LastFullsyncValue), + rt:clean_cluster(ANodes), rt:clean_cluster(BNodes), - Result. + StartedResult.