Browse Source

Add random kill in registry's concurrency test.

Roberto Ostinelli 3 years ago
parent
commit
eeb3f5f8cc
2 changed files with 8 additions and 0 deletions
  1. 2 0
      test/syn_pg_SUITE.erl
  2. 6 0
      test/syn_registry_SUITE.erl

+ 2 - 0
test/syn_pg_SUITE.erl

@@ -1673,10 +1673,12 @@ four_nodes_concurrency(Config) ->
             %% loop
             %% loop
             RandomMeta = rand:uniform(99999),
             RandomMeta = rand:uniform(99999),
             ok = syn:join(scope_all, <<"concurrent-scope">>, Pid, RandomMeta),
             ok = syn:join(scope_all, <<"concurrent-scope">>, Pid, RandomMeta),
+            %% random leave
             case rand:uniform(5) of
             case rand:uniform(5) of
                 1 -> syn:leave(scope_all, <<"concurrent-scope">>, Pid);
                 1 -> syn:leave(scope_all, <<"concurrent-scope">>, Pid);
                 _ -> ok
                 _ -> ok
             end,
             end,
+            %% random sleep
             RndTime = rand:uniform(30),
             RndTime = rand:uniform(30),
             timer:sleep(RndTime)
             timer:sleep(RndTime)
         end, lists:seq(1, Iterations)),
         end, lists:seq(1, Iterations)),

+ 6 - 0
test/syn_registry_SUITE.erl

@@ -1488,6 +1488,12 @@ four_nodes_concurrency(Config) ->
                             syn:register(scope_all, <<"concurrent">>, Pid, RandomMeta)
                             syn:register(scope_all, <<"concurrent">>, Pid, RandomMeta)
                     end
                     end
             end,
             end,
+            %% random kill
+            case rand:uniform(10) of
+                1 -> exit(Pid, kill);
+                _ -> ok
+            end,
+            %% random sleep
             RndTime = rand:uniform(30),
             RndTime = rand:uniform(30),
             timer:sleep(RndTime)
             timer:sleep(RndTime)
         end, lists:seq(1, Iterations)),
         end, lists:seq(1, Iterations)),