20
20
-module(global_group_SUITE).
22
-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2,
23
init_per_suite/1, end_per_suite/1]).
23
24
-export([start_gg_proc/1, no_gg_proc/1, no_gg_proc_sync/1, compatible/1,
24
25
one_grp/1, one_grp_x/1, two_grp/1, hidden_groups/1, test_exit/1]).
25
26
-export([init/1, init/2, init2/2, start_proc/1, start_proc_rereg/1]).
27
-export([init_per_testcase/2, fin_per_testcase/2]).
28
-export([init_per_testcase/2, end_per_testcase/2]).
29
30
%-compile(export_all).
31
-include("test_server.hrl").
32
-include_lib("test_server/include/test_server.hrl").
33
34
-define(NODES, [node()|nodes()]).
35
36
-define(UNTIL(Seq), loop_until_true(fun() -> Seq end)).
38
[start_gg_proc, no_gg_proc, no_gg_proc_sync,
39
compatible, one_grp, one_grp_x, two_grp, test_exit,
38
suite() -> [{ct_hooks,[ts_install_cth]}].
41
[start_gg_proc, no_gg_proc, no_gg_proc_sync, compatible,
42
one_grp, one_grp_x, two_grp, test_exit, hidden_groups].
47
init_per_group(_GroupName, Config) ->
50
end_per_group(_GroupName, Config) ->
54
init_per_suite(Config) ->
56
%% Copied from test_server_ctrl ln 647, we have to do this here as
57
%% the test_server only does this when run without common_test
59
case global:whereis_name(test_server) of
61
io:format(user, "Registering test_server globally!~n",[]),
62
global:register_name(test_server, whereis(test_server_ctrl));
65
N when N == node(Pid) ->
66
io:format(user, "Warning: test_server already running!\n", []),
67
global:re_register_name(test_server,self());
74
end_per_suite(_Config) ->
75
global:unregister_name(test_server),
42
78
-define(TESTCASE, testcase_name).
43
79
-define(testcase, ?config(?TESTCASE, Config)).
46
82
Dog=?t:timetrap(?t:minutes(5)),
47
83
[{?TESTCASE, Case}, {watchdog, Dog}|Config].
49
fin_per_testcase(_Func, Config) ->
85
end_per_testcase(_Func, Config) ->
50
86
Dog=?config(watchdog, Config),
51
87
?t:timetrap_cancel(Dog).
65
101
?line Dir = ?config(priv_dir, Config),
66
102
?line File = filename:join(Dir, "global_group.config"),
67
?line {ok, Fd}=file:open(File, write),
103
?line {ok, Fd}=file:open(File, [write]),
68
104
[Ncp1,Ncp2,Ncp3] = node_names([cp1, cp2, cp3], Config),
69
105
?line config(Fd, Ncp1, Ncp2, Ncp3, "cpx", "cpy", "cpz", "cpq"),
100
136
?line Dir = ?config(priv_dir, Config),
101
137
?line File = filename:join(Dir, "no_global_group.config"),
102
?line {ok, Fd} = file:open(File, write),
138
?line {ok, Fd} = file:open(File, [write]),
103
139
?line config_no(Fd),
105
141
?line NN = node_name(atom_to_list(node())),
164
200
?line Own_nodes_should = [node(), Cp1nn, Cp2nn, Cp3nn,
165
201
Cpxnn, Cpynn, Cpznn],
166
202
?line Own_nodes = rpc:call(Cp3, global_group, own_nodes, []),
167
?line true = (Own_nodes -- Own_nodes_should) =:= [],
168
?line true = (Own_nodes_should -- Own_nodes) =:= [],
203
?line [] = (Own_nodes -- Own_nodes_should),
204
?line [] = (Own_nodes_should -- Own_nodes),
170
206
?line Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]),
273
309
?line Dir = ?config(priv_dir, Config),
274
310
?line File = filename:join(Dir, "no_global_group_sync.config"),
275
?line {ok, Fd} = file:open(File, write),
311
?line {ok, Fd} = file:open(File, [write]),
277
313
[Ncp1,Ncp2,Ncp3,Ncpx,Ncpy,Ncpz] =
278
314
node_names([cp1,cp2,cp3,cpx,cpy,cpz], Config),
339
375
?line Own_nodes_should = [node(), Cp1nn, Cp2nn, Cp3nn,
340
376
Cpxnn, Cpynn, Cpznn],
341
377
?line Own_nodes = rpc:call(Cp3, global_group, own_nodes, []),
342
?line true = (Own_nodes -- Own_nodes_should) =:= [],
343
?line true = (Own_nodes_should -- Own_nodes) =:= [],
378
?line [] = (Own_nodes -- Own_nodes_should),
379
?line [] = (Own_nodes_should -- Own_nodes),
345
381
?line Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]),
447
483
?line Dir = ?config(priv_dir, Config),
448
484
?line File = filename:join(Dir, "global_group_comp.config"),
449
?line {ok, Fd} = file:open(File, write),
485
?line {ok, Fd} = file:open(File, [write]),
451
487
[Ncp1,Ncp2,Ncp3,Ncpx,Ncpy,Ncpz] =
452
488
node_names([cp1,cp2,cp3,cpx,cpy,cpz], Config),
513
549
?line Own_nodes_should = [node(), Cp1nn, Cp2nn, Cp3nn,
514
550
Cpxnn, Cpynn, Cpznn],
515
551
?line Own_nodes = rpc:call(Cp3, global_group, own_nodes, []),
516
?line true = (Own_nodes -- Own_nodes_should) =:= [],
517
?line true = (Own_nodes_should -- Own_nodes) =:= [],
552
?line [] = (Own_nodes -- Own_nodes_should),
553
?line [] = (Own_nodes_should -- Own_nodes),
519
555
?line Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]),
620
656
?line Dir = ?config(priv_dir, Config),
621
657
?line File = filename:join(Dir, "global_group.config"),
622
?line {ok, Fd} = file:open(File, write),
658
?line {ok, Fd} = file:open(File, [write]),
623
659
[Ncp1,Ncp2,Ncp3] = node_names([cp1, cp2, cp3], Config),
624
660
?line config(Fd, Ncp1, Ncp2, Ncp3, "cpx", "cpy", "cpz", "cpq"),
707
743
?line Dir = ?config(priv_dir, Config),
708
744
?line File = filename:join(Dir, "global_group.config"),
709
?line {ok, Fd} = file:open(File, write),
745
?line {ok, Fd} = file:open(File, [write]),
710
746
[Ncp1,Ncp2,Ncp3] = node_names([cp1, cp2, cp3], Config),
711
747
?line config(Fd, Ncp1, Ncp2, Ncp3, "cpx", "cpy", "cpz", "cpq"),
769
805
?line Dir = ?config(priv_dir, Config),
770
806
?line File = filename:join(Dir, "global_group.config"),
771
?line {ok, Fd} = file:open(File, write),
807
?line {ok, Fd} = file:open(File, [write]),
773
809
[Ncp1,Ncp2,Ncp3,Ncpx,Ncpy,Ncpz,Ncpq] =
774
810
node_names([cp1,cp2,cp3,cpx,cpy,cpz,cpq], Config),
1069
1105
?line Dir = ?config(priv_dir, Config),
1070
1106
?line File = filename:join(Dir, "global_group.config"),
1071
?line {ok, Fd} = file:open(File, write),
1107
?line {ok, Fd} = file:open(File, [write]),
1073
1109
[Ncp1,Ncp2,Ncp3,Ncpx,Ncpy,Ncpz,Ncpq] =
1074
1110
node_names([cp1,cp2,cp3,cpx,cpy,cpz,cpq], Config),