|
@@ -36,6 +36,7 @@
|
|
|
single_node_join_and_monitor/1,
|
|
|
single_node_join_and_leave/1,
|
|
|
single_node_join_errors/1,
|
|
|
+ single_node_groups_count/1,
|
|
|
single_node_publish/1,
|
|
|
single_node_multicall/1,
|
|
|
single_node_multicall_with_custom_timeout/1,
|
|
@@ -45,6 +46,7 @@
|
|
|
-export([
|
|
|
two_nodes_join_monitor_and_unregister/1,
|
|
|
two_nodes_local_members/1,
|
|
|
+ two_nodes_groups_count/1,
|
|
|
two_nodes_publish/1,
|
|
|
two_nodes_local_publish/1,
|
|
|
two_nodes_multicall/1,
|
|
@@ -94,8 +96,10 @@ all() ->
|
|
|
groups() ->
|
|
|
[
|
|
|
{single_node_groups, [shuffle], [
|
|
|
+ single_node_join_and_monitor,
|
|
|
single_node_join_and_leave,
|
|
|
single_node_join_errors,
|
|
|
+ single_node_groups_count,
|
|
|
single_node_publish,
|
|
|
single_node_multicall,
|
|
|
single_node_multicall_with_custom_timeout,
|
|
@@ -105,6 +109,7 @@ groups() ->
|
|
|
{two_nodes_groups, [shuffle], [
|
|
|
two_nodes_join_monitor_and_unregister,
|
|
|
two_nodes_local_members,
|
|
|
+ two_nodes_groups_count,
|
|
|
two_nodes_publish,
|
|
|
two_nodes_local_publish,
|
|
|
two_nodes_multicall,
|
|
@@ -297,6 +302,31 @@ single_node_join_errors(_Config) ->
|
|
|
{error, not_in_group} = syn:leave(GroupName, Pid2),
|
|
|
{error, not_alive} = syn:join(GroupName, Pid2).
|
|
|
|
|
|
+single_node_groups_count(_Config) ->
|
|
|
+ %% start
|
|
|
+ ok = syn:start(),
|
|
|
+ %% start processes
|
|
|
+ Pid = syn_test_suite_helper:start_process(),
|
|
|
+ Pid2 = syn_test_suite_helper:start_process(),
|
|
|
+ Pid3 = syn_test_suite_helper:start_process(),
|
|
|
+ PidUnjoined = syn_test_suite_helper:start_process(),
|
|
|
+ %% join
|
|
|
+ ok = syn:join({"group-1"}, Pid),
|
|
|
+ ok = syn:join({"group-1"}, Pid2),
|
|
|
+ ok = syn:join({"group-1"}, Pid3),
|
|
|
+ ok = syn:join({"group-2"}, Pid2),
|
|
|
+ %% count
|
|
|
+ 2 = syn:groups_count(),
|
|
|
+ 2 = syn:groups_count(node()),
|
|
|
+ %% kill & unregister
|
|
|
+ ok = syn:leave({"group-1"}, Pid),
|
|
|
+ syn_test_suite_helper:kill_process(Pid2),
|
|
|
+ syn_test_suite_helper:kill_process(Pid3),
|
|
|
+ timer:sleep(100),
|
|
|
+ %% count
|
|
|
+ 0 = syn:groups_count(),
|
|
|
+ 0 = syn:groups_count(node()).
|
|
|
+
|
|
|
single_node_publish(_Config) ->
|
|
|
GroupName = "my group",
|
|
|
Message = {test, message},
|
|
@@ -586,6 +616,37 @@ two_nodes_local_members(Config) ->
|
|
|
[] = rpc:call(SlaveNode, syn, get_local_members, [GroupName]),
|
|
|
[] = rpc:call(SlaveNode, syn, get_local_members, [GroupName, with_meta]).
|
|
|
|
|
|
+two_nodes_groups_count(Config) ->
|
|
|
+ %% get slave
|
|
|
+ SlaveNode = proplists:get_value(slave_node, Config),
|
|
|
+ %% start
|
|
|
+ ok = syn:start(),
|
|
|
+ ok = rpc:call(SlaveNode, syn, start, []),
|
|
|
+ timer:sleep(100),
|
|
|
+ %% start processes
|
|
|
+ LocalPid = syn_test_suite_helper:start_process(),
|
|
|
+ RemotePid = syn_test_suite_helper:start_process(SlaveNode),
|
|
|
+ RemotePidRegRemote = syn_test_suite_helper:start_process(SlaveNode),
|
|
|
+ _PidUnjoined = syn_test_suite_helper:start_process(),
|
|
|
+ %% join
|
|
|
+ ok = syn:join(<<"local group">>, LocalPid),
|
|
|
+ ok = syn:join(<<"remote group">>, RemotePid),
|
|
|
+ ok = rpc:call(SlaveNode, syn, join, [<<"remote group join_remote">>, RemotePidRegRemote]),
|
|
|
+ timer:sleep(500),
|
|
|
+ %% count
|
|
|
+ 3 = syn:groups_count(),
|
|
|
+ 1 = syn:groups_count(node()),
|
|
|
+ 2 = syn:groups_count(SlaveNode),
|
|
|
+ %% kill & unregister processes
|
|
|
+ syn_test_suite_helper:kill_process(LocalPid),
|
|
|
+ ok = syn:leave(<<"remote group">>, RemotePid),
|
|
|
+ syn_test_suite_helper:kill_process(RemotePidRegRemote),
|
|
|
+ timer:sleep(100),
|
|
|
+ %% count
|
|
|
+ 0 = syn:groups_count(),
|
|
|
+ 0 = syn:groups_count(node()),
|
|
|
+ 0 = syn:groups_count(SlaveNode).
|
|
|
+
|
|
|
two_nodes_publish(Config) ->
|
|
|
GroupName = "my group",
|
|
|
Message = {test, message},
|