Skip to content

Commit

Permalink
Add unit test for handoff bytes format
Browse files Browse the repository at this point in the history
  • Loading branch information
martinsumner committed Nov 26, 2020
1 parent aa29261 commit e71f5de
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/riak_core_handoff_status.erl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

-include("riak_core_handoff.hrl").

-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
-endif.

-export([handoff_summary/3,
handoff_details/3,
collect_node_transfer_data/0]).
Expand Down Expand Up @@ -389,3 +393,18 @@ maybe_add_down_nodes(DownNodes, Output) ->
NodesDown = clique_status:alert([clique_status:list("(unreachable)", DownNodes)]),
Output ++ [NodesDown]
end.



%% ===================================================================
%% EUnit tests
%% ===================================================================
-ifdef(TEST).

transfer_bytes_test() ->
?assertMatch("1.00 B", format_transfer_size({1, bytes})),
?assertMatch("976.56 KB", format_transfer_size({1000000, bytes})),
?assertMatch("1.00 MB", format_transfer_size({1048576, bytes})),
?assertMatch("1.86 GB", format_transfer_size({2000000000, bytes})).

-endif.

0 comments on commit e71f5de

Please sign in to comment.