aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/test/cover_SUITE.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2012-12-19 12:25:07 +0100
committerSiri Hansen <[email protected]>2012-12-19 12:29:10 +0100
commitc1ecd14be890ec4f2e8a25f00525412a381fcc72 (patch)
tree51e7f0971e013e798b4535ac7eea466909c9825e /lib/tools/test/cover_SUITE.erl
parentc89f88ab3ec77ebc1cef180e1ae5c9917b4c7b06 (diff)
downloadotp-c1ecd14be890ec4f2e8a25f00525412a381fcc72.tar.gz
otp-c1ecd14be890ec4f2e8a25f00525412a381fcc72.tar.bz2
otp-c1ecd14be890ec4f2e8a25f00525412a381fcc72.zip
[cover] Remove stopped node also from lost_nodes list
A nodes that was stopped with cover:stop/1 while marked as lost would not be removed from the list of lost nodes. Therefore, if a nodeup was later received for a node with the same name, it would be reconnected. This has been corrected.
Diffstat (limited to 'lib/tools/test/cover_SUITE.erl')
-rw-r--r--lib/tools/test/cover_SUITE.erl50
1 files changed, 48 insertions, 2 deletions
diff --git a/lib/tools/test/cover_SUITE.erl b/lib/tools/test/cover_SUITE.erl
index fc30b7453a..9d2b449460 100644
--- a/lib/tools/test/cover_SUITE.erl
+++ b/lib/tools/test/cover_SUITE.erl
@@ -24,7 +24,8 @@
-export([start/1, compile/1, analyse/1, misc/1, stop/1,
distribution/1, reconnect/1, die_and_reconnect/1,
- dont_reconnect_after_stop/1, export_import/1,
+ dont_reconnect_after_stop/1, stop_node_after_disconnect/1,
+ export_import/1,
otp_5031/1, eif/1, otp_5305/1, otp_5418/1, otp_6115/1, otp_7095/1,
otp_8188/1, otp_8270/1, otp_8273/1, otp_8340/1]).
@@ -48,7 +49,7 @@ all() ->
undefined ->
[start, compile, analyse, misc, stop,
distribution, reconnect, die_and_reconnect,
- dont_reconnect_after_stop,
+ dont_reconnect_after_stop, stop_node_after_disconnect,
export_import, otp_5031, eif, otp_5305, otp_5418,
otp_6115, otp_7095, otp_8188, otp_8270, otp_8273,
otp_8340];
@@ -565,6 +566,51 @@ dont_reconnect_after_stop(Config) ->
?t:stop_node(N1),
ok.
+%% Test that a node which is stopped while it is marked as lost is not
+%% reconnected if it is restarted (OTP-10638)
+stop_node_after_disconnect(Config) ->
+ DataDir = ?config(data_dir, Config),
+ ok = file:set_cwd(DataDir),
+
+ {ok,f} = compile:file(f),
+
+ NodeName = cover_SUITE_stop_node_after_disconnect,
+ {ok,N1} = ?t:start_node(NodeName,peer,
+ [{args," -pa " ++ DataDir},{start_cover,false}]),
+ {ok,f} = cover:compile(f),
+ {ok,[N1]} = cover:start(nodes()),
+
+ %% A call to check later
+ rpc:call(N1,f,f1,[]),
+
+ %% Flush the node, then terminate the node to make it marked as lost
+ cover:flush(N1),
+ rpc:call(N1,erlang,halt,[]),
+
+ check_f_calls(1,0),
+
+ %% Stop cover on node
+ cover:stop(N1),
+
+ %% Restart the node and check that cover does not reconnect
+ {ok,N1} = ?t:start_node(NodeName,peer,
+ [{args," -pa " ++ DataDir},{start_cover,false}]),
+ timer:sleep(300),
+ [] = cover:which_nodes(),
+ Beam = rpc:call(N1,code,which,[f]),
+ false = (Beam==cover_compiled),
+
+ %% One more call...
+ rpc:call(N1,f,f1,[]),
+ cover:flush(N1),
+
+ %% Ensure that the last call is not counted
+ check_f_calls(1,0),
+
+ cover:stop(),
+ ?t:stop_node(N1),
+ ok.
+
export_import(suite) -> [];
export_import(Config) when is_list(Config) ->
?line DataDir = ?config(data_dir, Config),