Resolve coverage gaps
logs should always at least have a log_level defined which is in the ?LOG_LEVELS - so the final case of `-is_active_level([] , _, _) -> false.` is unnecessary (even if a bad log level is passed in). correct Bucket and Key definition to hit expected eunit test cases in leveled_pmem
This commit is contained in:
parent
672cfd4fcd
commit
7a876066e2
2 changed files with 8 additions and 4 deletions
|
@ -489,8 +489,7 @@ should_i_log(LogLevel, Levels, LogRef) ->
|
||||||
|
|
||||||
is_active_level([L|_], L, _) -> true;
|
is_active_level([L|_], L, _) -> true;
|
||||||
is_active_level([L|_], _, L) -> false;
|
is_active_level([L|_], _, L) -> false;
|
||||||
is_active_level([_|T], C, L) -> is_active_level(T, C, L);
|
is_active_level([_|T], C, L) -> is_active_level(T, C, L).
|
||||||
is_active_level([] , _, _) -> false.
|
|
||||||
|
|
||||||
log_timer(LogReference, Subs, StartTime) ->
|
log_timer(LogReference, Subs, StartTime) ->
|
||||||
log_timer(LogReference, Subs, StartTime, ?LOG_LEVELS).
|
log_timer(LogReference, Subs, StartTime, ?LOG_LEVELS).
|
||||||
|
@ -572,4 +571,9 @@ shouldilog_test() ->
|
||||||
ok = set_loglevel(info),
|
ok = set_loglevel(info),
|
||||||
?assertMatch(false, should_i_log(debug, ?LOG_LEVELS, "D0001")).
|
?assertMatch(false, should_i_log(debug, ?LOG_LEVELS, "D0001")).
|
||||||
|
|
||||||
|
badloglevel_test() ->
|
||||||
|
% Set a bad log level - and everything logs
|
||||||
|
?assertMatch(true, is_active_level(?LOG_LEVELS, debug, unsupported)),
|
||||||
|
?assertMatch(true, is_active_level(?LOG_LEVELS, critical, unsupported)).
|
||||||
|
|
||||||
-endif.
|
-endif.
|
||||||
|
|
|
@ -264,10 +264,10 @@ generate_randomkeys(_Seqn, 0, Acc, _BucketLow, _BucketHigh) ->
|
||||||
generate_randomkeys(Seqn, Count, Acc, BucketLow, BRange) ->
|
generate_randomkeys(Seqn, Count, Acc, BucketLow, BRange) ->
|
||||||
BNumber =
|
BNumber =
|
||||||
lists:flatten(
|
lists:flatten(
|
||||||
io_lib:format("K~4..0B",
|
io_lib:format("~4..0B",
|
||||||
[BucketLow + leveled_rand:uniform(BRange)])),
|
[BucketLow + leveled_rand:uniform(BRange)])),
|
||||||
KNumber =
|
KNumber =
|
||||||
lists:flatten(io_lib:format("K~4..0B", [leveled_rand:uniform(1000)])),
|
lists:flatten(io_lib:format("~4..0B", [leveled_rand:uniform(1000)])),
|
||||||
{K, V} = {{o, "Bucket" ++ BNumber, "Key" ++ KNumber, null},
|
{K, V} = {{o, "Bucket" ++ BNumber, "Key" ++ KNumber, null},
|
||||||
{Seqn, {active, infinity}, null}},
|
{Seqn, {active, infinity}, null}},
|
||||||
generate_randomkeys(Seqn + 1,
|
generate_randomkeys(Seqn + 1,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue