Browse Source

Improve tests.

Roberto Ostinelli 5 years ago
parent
commit
d5556e32b7
2 changed files with 8 additions and 5 deletions
  1. 4 3
      test/syn_registry_SUITE.erl
  2. 4 2
      test/syn_test_suite_helper.erl

+ 4 - 3
test/syn_registry_SUITE.erl

@@ -556,18 +556,19 @@ two_nodes_registration_race_condition_conflict_resolution_when_process_died(Conf
     %% start syn on nodes
     %% start syn on nodes
     ok = syn:start(),
     ok = syn:start(),
     ok = rpc:call(SlaveNode, syn, start, []),
     ok = rpc:call(SlaveNode, syn, start, []),
-    timer:sleep(100),
+    timer:sleep(1000),
     %% start processes
     %% start processes
     Pid0 = syn_test_suite_helper:start_process(),
     Pid0 = syn_test_suite_helper:start_process(),
     Pid1 = syn_test_suite_helper:start_process(SlaveNode),
     Pid1 = syn_test_suite_helper:start_process(SlaveNode),
     %% inject into syn to simulate concurrent registration
     %% inject into syn to simulate concurrent registration
     syn_registry:add_to_local_table(ConflictingName, Pid0, keep_this_one, undefined),
     syn_registry:add_to_local_table(ConflictingName, Pid0, keep_this_one, undefined),
+    timer:sleep(250),
     %% kill process
     %% kill process
     syn_test_suite_helper:kill_process(Pid0),
     syn_test_suite_helper:kill_process(Pid0),
-    timer:sleep(250),
     %% register to trigger conflict resolution
     %% register to trigger conflict resolution
+    timer:sleep(250),
     ok = rpc:call(SlaveNode, syn, register, [ConflictingName, Pid1, SlaveNode]),
     ok = rpc:call(SlaveNode, syn, register, [ConflictingName, Pid1, SlaveNode]),
-    timer:sleep(1000),
+    timer:sleep(250),
     %% check
     %% check
     {Pid1, SlaveNode} = syn:whereis(ConflictingName, with_meta),
     {Pid1, SlaveNode} = syn:whereis(ConflictingName, with_meta),
     {Pid1, SlaveNode} = rpc:call(SlaveNode, syn, whereis, [ConflictingName, with_meta]),
     {Pid1, SlaveNode} = rpc:call(SlaveNode, syn, whereis, [ConflictingName, with_meta]),

+ 4 - 2
test/syn_test_suite_helper.erl

@@ -72,9 +72,11 @@ clean_after_test() ->
     Nodes = [node() | nodes()],
     Nodes = [node() | nodes()],
     %% shutdown
     %% shutdown
     lists:foreach(fun(Node) ->
     lists:foreach(fun(Node) ->
-        rpc:call(Node, syn, stop, []),
+        %% close syn
+        rpc:call(Node, application, stop, [syn]),
         %% clean env
         %% clean env
-        rpc:call(Node, application, unset_env, [syn, event_handler])
+        rpc:call(Node, application, unset_env, [syn, event_handler]),
+        rpc:call(Node, application, unset_env, [syn, anti_entropy])
     end, Nodes).
     end, Nodes).
 
 
 start_process() ->
 start_process() ->