Skip to content

Commit

Permalink
Add remote_ops_are_ignored_if_join_ref_does_not_match testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
arcusfelis committed Aug 2, 2023
1 parent 22722a8 commit 5a14046
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cets.erl
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,8 @@ handle_remote_op(From, RemoteJoinRef, Msg, #{join_ref := JoinRef}) ->
join_ref => JoinRef,
msg => Msg
}),

Check warning on line 541 in src/cets.erl

View check run for this annotation

Codecov / codecov/patch

src/cets.erl#L541

Added line #L541 was not covered by tests
%% We still need to reply to the remote process so it could stop waiting
reply_updated(From),
ok.

%% Apply operation for one local table only
Expand Down
13 changes: 13 additions & 0 deletions test/cets_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ all() ->
join_fails_in_check_fully_connected,
join_fails_because_join_refs_do_not_match_for_nodes_in_segment,
join_fails_because_pids_do_not_match_for_nodes_in_segment,
remote_ops_are_ignored_if_join_ref_does_not_match,
test_multinode,
test_multinode_remote_insert,
node_list_is_correct,
Expand Down Expand Up @@ -500,6 +501,18 @@ join_fails_because_pids_do_not_match_for_nodes_in_segment(Config) ->
{error, {error, check_fully_connected_failed, _}} =
cets_join:join(lock_name(Config), #{}, Pid1, Pid2, #{}).

remote_ops_are_ignored_if_join_ref_does_not_match(Config) ->
{ok, Pid1} = cets:start(make_name(Config, 1), #{}),
{ok, Pid2} = cets:start(make_name(Config, 2), #{}),
ok = cets_join:join(lock_name(Config), #{}, Pid1, Pid2, #{}),
#{join_ref := JoinRef} = cets:info(Pid1),
set_join_ref(Pid1, make_ref()),
cets:insert(Pid2, {1}),
%% fix and check again
set_join_ref(Pid1, JoinRef),
cets:insert(Pid2, {2}),
{ok, [{2}]} = cets:remote_dump(Pid1).

test_multinode(Config) ->
Node1 = node(),
[Node2, Node3, Node4] = proplists:get_value(nodes, Config),
Expand Down

0 comments on commit 5a14046

Please sign in to comment.