Skip to content
Browse files

Merge pull request #38 from basho/adt-fix-eqc-test

Fix incorrect timeout and remove flaky counterexample code
  • Loading branch information...
2 parents 5ffdbe7 + a5c1da5 commit f5c2ef62dd84256975ee59214f6fbd265bb6df52 @Vagabond Vagabond committed
Showing with 5 additions and 17 deletions.
  1. +1 −14 test/bitcask_qc_expiry.erl
  2. +4 −3 test/bitcask_qc_fsm.erl
View
15 test/bitcask_qc_expiry.erl
@@ -36,20 +36,7 @@ qc(P) ->
qc(P, 100).
qc(P, NumTests) ->
- case last_counterexample() of
- undefined ->
- ?assert(eqc:quickcheck(?QC_OUT(eqc:numtests(NumTests, P))));
- C ->
- ?assert(eqc:check(?QC_OUT(P), C))
- end.
-
-last_counterexample() ->
- try
- eqc:current_counterexample()
- catch
- _:no_current_counterexample ->
- undefined
- end.
+ ?assert(eqc:quickcheck(?QC_OUT(eqc:numtests(NumTests, P)))).
keys() ->
eqc_gen:non_empty(list(eqc_gen:non_empty(binary()))).
View
7 test/bitcask_qc_fsm.erl
@@ -112,7 +112,8 @@ postcondition(_From,_To,_S,{call,_,_,_},_Res) ->
qc_test_() ->
{timeout, 120,
{setup, fun prepare/0, fun cleanup/1,
- [?_assertEqual(true, eqc:quickcheck(?QC_OUT(prop_bitcask())))]}}.
+ [{timeout, 120, ?_assertEqual(true,
+ eqc:quickcheck(?QC_OUT(prop_bitcask())))}]}}.
prepare() ->
application:load(bitcask),
@@ -177,8 +178,8 @@ truncate_hint(Seed, TruncBy0) ->
{ok, Fi} = file:read_file_info(Hint),
{ok, Fh} = file:open(Hint, [read, write]),
TruncBy = (1 + abs(TruncBy0)) rem (Fi#file_info.size+1),
- {ok, To} = file:position(Fh, {eof, -TruncBy}),
- %% io:format(user, "Truncating ~p by ~p to ~p\n", [Hint, TruncBy, To]),
+ {ok, _To} = file:position(Fh, {eof, -TruncBy}),
+ %% io:format(user, "Truncating ~p by ~p to ~p\n", [Hint, TruncBy, _To]),
file:truncate(Fh),
file:close(Fh)
end.

0 comments on commit f5c2ef6

Please sign in to comment.
Something went wrong with that request. Please try again.