Skip to content

Commit 9a0402d

Browse files
committed
wip
1 parent 7b0cfe5 commit 9a0402d

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

test/simple_tx_get.erl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,3 +942,22 @@ filter_node_cb([_ | _] = Path, _NodeProps) ->
942942
lists:last(Path) =:= baz;
943943
filter_node_cb(_Path, _NodeProps) ->
944944
false.
945+
946+
options_are_correctly_filtered_in_auto_txs_test_() ->
947+
{setup,
948+
fun() -> test_ra_server_helpers:setup(?FUNCTION_NAME) end,
949+
fun(Priv) -> test_ra_server_helpers:cleanup(Priv) end,
950+
[?_assertEqual(
951+
{ok,
952+
{error, ?khepri_error(node_not_found, #{node_name => foo,
953+
node_path => [foo],
954+
node_is_target => true})}},
955+
begin
956+
Fun = fun() ->
957+
khepri_tx:get([foo])
958+
end,
959+
khepri:transaction(
960+
?FUNCTION_NAME, Fun, auto, #{async => true,
961+
protect_against_dups => true,
962+
reply_from => leader})
963+
end)]}.

test/simple_tx_put.erl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,3 +440,21 @@ invalid_compare_and_swap_call_test_() ->
440440
end,
441441
khepri:transaction(?FUNCTION_NAME, Fun, rw)
442442
end)]}.
443+
444+
options_are_correctly_filtered_in_auto_txs_test_() ->
445+
{setup,
446+
fun() -> test_ra_server_helpers:setup(?FUNCTION_NAME) end,
447+
fun(Priv) -> test_ra_server_helpers:cleanup(Priv) end,
448+
[?_assertEqual(
449+
{ok, ok},
450+
begin
451+
Fun = fun() ->
452+
khepri_tx:create([foo], foo_value)
453+
end,
454+
khepri:transaction(
455+
?FUNCTION_NAME, Fun, auto, #{condition => {applied, {1, 1}},
456+
favor => consistency})
457+
end),
458+
?_assertEqual(
459+
{ok, foo_value},
460+
khepri:get(?FUNCTION_NAME, [foo]))]}.

0 commit comments

Comments
 (0)