leveled_cdb eunit test failures
martinsumner opened this issue · 4 comments
martinsumner commented
Why has this started happening?
.....................F........
Failures:
1) leveled_cdb:get_keys_byposition_manykeys_test_/0
Failure/Error: ?assertMatch([ ], cdb_getpositions ( P1 , 10 ))
expected: = [ ]
got: [65534,62042,69170,58406,37886,66398,60710,49442,46454,70826]
russelldb commented
Running git bisect
now, will report back, should at least answer "when" it started.
martinsumner commented
And on another machine:
..............F......F......F.
Failures:
1) leveled_cdb:activewrite_singlewrite_test/0
Failure/Error: {error,
{case_clause,{error,einval}},
[{leveled_cdb,read_next_item,2,
[{file,
"/Users/martinsumner/dbroot/leveled/_build/test/lib/leveled/src/leveled_cdb.erl"},
{line,1360}]},
{leveled_cdb,safe_read_next_keyint,2,
[{file,
"/Users/martinsumner/dbroot/leveled/_build/test/lib/leveled/src/leveled_cdb.erl"},
{line,1345}]},
{leveled_cdb,saferead_keyvalue,1,
[{file,
"/Users/martinsumner/dbroot/leveled/_build/test/lib/leveled/src/leveled_cdb.erl"},
{line,1305}]},
{leveled_cdb,scan_over_file,5,
[{file,
"/Users/martinsumner/dbroot/leveled/_build/test/lib/leveled/src/leveled_cdb.erl"},
{line,1252}]},
{leveled_cdb,startup_scan_over_file,2,
[{file,
"/Users/martinsumner/dbroot/leveled/_build/test/lib/leveled/src/leveled_cdb.erl"},
{line,1227}]},
{leveled_cdb,open_active_file,1,
[{file,
"/Users/martinsumner/dbroot/leveled/_build/test/lib/leveled/src/leveled_cdb.erl"},
{line,873}]},
{leveled_cdb,activewrite_singlewrite_test,0,
[{file,
"/Users/martinsumner/dbroot/leveled/_build/test/lib/leveled/src/leveled_cdb.erl"},
{line,2066}]}]}
2) leveled_cdb:get_keys_byposition_manykeys_test_/0
Failure/Error: ?assertMatch([ ], cdb_getpositions ( P1 , 10 ))
expected: = [ ]
got: [31820,11998,14990,15636,20226,6762,23592,10128,25734,8734]
%% /Users/martinsumner/dbroot/leveled/_build/test/lib/leveled/src/leveled_cdb.erl:2239:in `leveled_cdb:get_keys_byposition_manykeys_test_to/0`
3) leveled_cdb:safe_read_test/0
Failure/Error: {error,
{case_clause,{error,einval}},
[{leveled_cdb,read_next_item,2,
[{file,
"/Users/martinsumner/dbroot/leveled/_build/test/lib/leveled/src/leveled_cdb.erl"},
{line,1360}]},
{leveled_cdb,safe_read_next_keyint,2,
[{file,
"/Users/martinsumner/dbroot/leveled/_build/test/lib/leveled/src/leveled_cdb.erl"},
{line,1345}]},
{leveled_cdb,saferead_keyvalue,1,
[{file,
"/Users/martinsumner/dbroot/leveled/_build/test/lib/leveled/src/leveled_cdb.erl"},
{line,1305}]},
{leveled_cdb,'-safe_read_test/0-fun-1-',3,
[{file,
"/Users/martinsumner/dbroot/leveled/_build/test/lib/leveled/src/leveled_cdb.erl"},
{line,2456}]},
{lists,foreach,2,[{file,"lists.erl"},{line,1338}]},
{leveled_cdb,safe_read_test,0,
[{file,
"/Users/martinsumner/dbroot/leveled/_build/test/lib/leveled/src/leveled_cdb.erl"},
{line,2472}]}]}
martinsumner commented
The failure in leveled_cdb:get_keys_byposition_manykeys_test_/0
is asa result of a race. It can be mitigated by loading the targeted loser in the race with more work.
I'm still not clear why on one machine I'm seeing {error, einval} being thrown - whereas elsewhere I'm seeing {error, badarg}. I've made the catch more general here - as this is inline with the intention of safe_Reading. To implement this without losing 100% code coverage, some refactoring work has been done - which I think makes this (safe reading) a bit cleaner.
martinsumner commented