Pick-up test misses
There were some coverage misses in tests, so check in unit test coverage or remove branches not currently needed.
This commit is contained in:
parent
427b97873c
commit
f40ecdd529
6 changed files with 37 additions and 27 deletions
|
@ -866,12 +866,7 @@ get_opt(Key, Opts) ->
|
|||
get_opt(Key, Opts, Default) ->
|
||||
case proplists:get_value(Key, Opts) of
|
||||
undefined ->
|
||||
case application:get_env(?MODULE, Key) of
|
||||
{ok, Value} ->
|
||||
Value;
|
||||
undefined ->
|
||||
Default
|
||||
end;
|
||||
Default;
|
||||
Value ->
|
||||
Value
|
||||
end.
|
||||
|
|
|
@ -1682,18 +1682,29 @@ get_keys_byposition_manykeys_test() ->
|
|||
#cdb_options{binary_mode=false}),
|
||||
KVList = generate_sequentialkeys(KeyCount, []),
|
||||
lists:foreach(fun({K, V}) -> cdb_put(P1, K, V) end, KVList),
|
||||
SW1 = os:timestamp(),
|
||||
ok = cdb_roll(P1),
|
||||
% Should not return posiitons when rolling
|
||||
?assertMatch([], cdb_getpositions(P1, 10)),
|
||||
lists:foldl(fun(X, Complete) ->
|
||||
case Complete of
|
||||
true ->
|
||||
true;
|
||||
false ->
|
||||
case cdb_checkhashtable(P1) of
|
||||
true ->
|
||||
true;
|
||||
false ->
|
||||
timer:sleep(X),
|
||||
false
|
||||
end
|
||||
end end,
|
||||
false,
|
||||
lists:seq(1, 20)),
|
||||
?assertMatch(10, length(cdb_getpositions(P1, 10))),
|
||||
{ok, F2} = cdb_complete(P1),
|
||||
SW2 = os:timestamp(),
|
||||
io:format("CDB completed in ~w microseconds~n",
|
||||
[timer:now_diff(SW2, SW1)]),
|
||||
|
||||
{ok, P2} = cdb_open_reader(F2, #cdb_options{binary_mode=false}),
|
||||
SW3 = os:timestamp(),
|
||||
io:format("CDB opened for read in ~w microseconds~n",
|
||||
[timer:now_diff(SW3, SW2)]),
|
||||
PositionList = cdb_getpositions(P2, all),
|
||||
io:format("Positions fetched in ~w microseconds~n",
|
||||
[timer:now_diff(os:timestamp(), SW3)]),
|
||||
L1 = length(PositionList),
|
||||
?assertMatch(L1, KeyCount),
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ handle_info(_Info, State) ->
|
|||
terminate(normal, _State) ->
|
||||
ok;
|
||||
terminate(Reason, _State) ->
|
||||
leveled_log:log("IC001", Reason).
|
||||
leveled_log:log("IC001", [Reason]).
|
||||
|
||||
code_change(_OldVsn, State, _Extra) ->
|
||||
{ok, State}.
|
||||
|
@ -846,6 +846,7 @@ compact_singlefile_totwosmallfiles_test() ->
|
|||
coverage_cheat_test() ->
|
||||
{noreply, _State0} = handle_info(timeout, #state{}),
|
||||
{ok, _State1} = code_change(null, #state{}, null),
|
||||
{reply, not_supported, _State2} = handle_call(null, null, #state{}).
|
||||
{reply, not_supported, _State2} = handle_call(null, null, #state{}),
|
||||
terminate(error, #state{}).
|
||||
|
||||
-endif.
|
|
@ -908,10 +908,13 @@ empty_manifest_test() ->
|
|||
{ok, Ink1} = ink_start(#inker_options{root_path=RootPath,
|
||||
cdb_options=CDBopts}),
|
||||
?assertMatch(not_present, ink_fetch(Ink1, "Key1", 1)),
|
||||
|
||||
CheckFun = fun(L, K, SQN) -> lists:member({SQN, K}, L) end,
|
||||
?assertMatch(false, CheckFun([], "key", 1)),
|
||||
ok = ink_compactjournal(Ink1,
|
||||
[],
|
||||
fun(X) -> {X, 55} end,
|
||||
fun(L, K, SQN) -> lists:member({SQN, K}, L) end,
|
||||
CheckFun,
|
||||
5000),
|
||||
timer:sleep(1000),
|
||||
?assertMatch(1, length(ink_getmanifest(Ink1))),
|
||||
|
|
|
@ -68,7 +68,8 @@
|
|||
{"P0017",
|
||||
{info, "No L0 file found"}},
|
||||
{"P0018",
|
||||
{info, "Respone to push_mem of ~w ~s"}},
|
||||
{info, "Response to push_mem of ~w with "
|
||||
++ "L0 pending ~w and merge backlog ~w"}},
|
||||
{"P0019",
|
||||
{info, "Rolling level zero to filename ~s"}},
|
||||
{"P0020",
|
||||
|
|
|
@ -321,15 +321,14 @@ handle_call({push_mem, PushedTree}, From, State=#state{is_snapshot=Snap})
|
|||
%
|
||||
% Check the approximate size of the cache. If it is over the maximum size,
|
||||
% trigger a backgroun L0 file write and update state of levelzero_pending.
|
||||
case {State#state.levelzero_pending, State#state.work_backlog} of
|
||||
{true, _} ->
|
||||
leveled_log:log("P0018", [returned, "L-0 persist pending"]),
|
||||
case State#state.levelzero_pending or State#state.work_backlog of
|
||||
true ->
|
||||
leveled_log:log("P0018", [returned,
|
||||
State#state.levelzero_pending,
|
||||
State#state.work_backlog]),
|
||||
{reply, returned, State};
|
||||
{false, true} ->
|
||||
leveled_log:log("P0018", [returned, "Merge tree work backlog"]),
|
||||
{reply, returned, State};
|
||||
{false, false} ->
|
||||
leveled_log:log("P0018", [ok, "L0 memory updated"]),
|
||||
false ->
|
||||
leveled_log:log("P0018", [ok, false, false]),
|
||||
gen_server:reply(From, ok),
|
||||
{noreply, update_levelzero(State#state.levelzero_index,
|
||||
State#state.levelzero_size,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue