Test bdb:del within a transaction, then abort.

This commit is contained in:
Gregory Burd 2011-11-28 16:22:08 -05:00
parent 7ff11a42a8
commit 05b81cdc3b

View file

@ -45,7 +45,9 @@ all() ->
get_should_return_a_value_when_getting_a_valid_record,
put_should_succeed_with_manual_transaction,
put_should_rollback_with_failed_manual_transaction,
% del_should_remove_a_value, %TODO: why is this disabled
% TODO: Why do these two cause everything to lock up?!
% del_should_remove_a_value,
% aborted_del_should_not_remove_a_value,
transaction_should_commit_on_success,
transaction_should_abort_on_exception,
transaction_should_abort_on_user_abort,
@ -141,6 +143,16 @@ del_should_remove_a_value(Config) ->
ok = bdberl:del(Db, mykey),
not_found = bdberl:get(Db, mykey).
aborted_del_should_not_remove_a_value(Config) ->
Db = ?config(db, Config),
ok = bdberl:put(Db, mykey, avalue),
{ok, avalue} = bdberl:get(Db, mykey),
ok = bdberl:txn_begin(),
ok = bdberl:del(Db, mykey),
not_found = bdberl:get(Db, mykey),
ok = bdberl:txn_abort(),
{ok, avalue} = bdberl:get(Db, mykey).
transaction_should_commit_on_success(Config) ->
Db = ?config(db, Config),
F = fun() -> bdberl:put(Db, mykey, avalue) end,