@@ -85,7 +85,8 @@ all_tests() ->
85
85
dlx_08 ,
86
86
dlx_09 ,
87
87
single_active_ordering_02 ,
88
- different_nodes
88
+ two_nodes_same_otp_version ,
89
+ two_nodes_different_otp_version
89
90
].
90
91
91
92
groups () ->
@@ -1093,14 +1094,65 @@ single_active_ordering_03(_Config) ->
1093
1094
false
1094
1095
end .
1095
1096
1096
- % % Test that running the state machine commands on different Erlang nodes
1097
- % % end up in exactly the same state.
1098
- different_nodes (Config ) ->
1099
- Config1 = rabbit_ct_helpers :run_setup_steps (
1100
- Config ,
1101
- rabbit_ct_broker_helpers :setup_steps ()),
1097
+ % % Run the log on two different Erlang nodes with the same OTP version.
1098
+ two_nodes_same_otp_version (Config0 ) ->
1099
+ Config = rabbit_ct_helpers :run_setup_steps (Config0 ,
1100
+ rabbit_ct_broker_helpers :setup_steps ()),
1101
+ Node = rabbit_ct_broker_helpers :get_node_config (Config , 0 , nodename ),
1102
+ case is_same_otp_version (Config ) of
1103
+ true ->
1104
+ ok = rabbit_ct_broker_helpers :add_code_path_to_node (Node , ? MODULE ),
1105
+ two_nodes (Node );
1106
+ false ->
1107
+ ct :fail (" expected CT node and RabbitMQ node to have the same OTP version" )
1108
+ end ,
1109
+ rabbit_ct_helpers :run_teardown_steps (Config ,
1110
+ rabbit_ct_broker_helpers :teardown_steps ()).
1111
+
1112
+ % % Run the log on two different Erlang nodes with different OTP versions.
1113
+ two_nodes_different_otp_version (_Config ) ->
1114
+ Node = 'rabbit_fifo_prop@localhost' ,
1115
+ case net_adm :ping (Node ) of
1116
+ pong ->
1117
+ case is_same_otp_version (Node ) of
1118
+ true ->
1119
+ ct :fail (" expected CT node and 'rabbit_fifo_prop@localhost' "
1120
+ " to have different OTP versions" );
1121
+ false ->
1122
+ Prefixes = [" rabbit_fifo" , " rabbit_misc" , " mc" ,
1123
+ " lqueue" , " priority_queue" , " ra_" ],
1124
+ [begin
1125
+ Mod = list_to_atom (ModStr ),
1126
+ {Mod , Bin , _File } = code :get_object_code (Mod ),
1127
+ {module , Mod } = erpc :call (Node , code , load_binary , [Mod , ModStr , Bin ])
1128
+ end
1129
+ || {ModStr , _FileName , _Loaded } <- code :all_available (),
1130
+ lists :any (fun (Prefix ) -> lists :prefix (Prefix , ModStr ) end , Prefixes )],
1131
+ two_nodes (Node )
1132
+ end ;
1133
+ pang ->
1134
+ Reason = {node_down , Node },
1135
+ case rabbit_ct_helpers :is_ci () of
1136
+ true ->
1137
+ ct :fail (Reason );
1138
+ false ->
1139
+ {skip , Reason }
1140
+ end
1141
+ end .
1102
1142
1103
- Size = 400 ,
1143
+ is_same_otp_version (ConfigOrNode ) ->
1144
+ OurOTP = erlang :system_info (otp_release ),
1145
+ OtherOTP = case ConfigOrNode of
1146
+ Cfg when is_list (Cfg ) ->
1147
+ rabbit_ct_broker_helpers :rpc (Cfg , erlang , system_info , [otp_release ]);
1148
+ Node when is_atom (Node ) ->
1149
+ erpc :call (Node , erlang , system_info , [otp_release ])
1150
+ end ,
1151
+ ct :pal (" Our CT node runs OTP ~s , other node runs OTP ~s " , [OurOTP , OtherOTP ]),
1152
+ OurOTP =:= OtherOTP .
1153
+
1154
+ two_nodes (Node ) ->
1155
+ Size = 500 ,
1104
1156
run_proper (
1105
1157
fun () ->
1106
1158
? FORALL ({Length , Bytes , DeliveryLimit , SingleActive },
@@ -1118,13 +1170,9 @@ different_nodes(Config) ->
1118
1170
DeliveryLimit ),
1119
1171
? FORALL (O , ? LET (Ops , log_gen_different_nodes (Size ), expand (Ops , Conf )),
1120
1172
collect ({log_size , length (O )},
1121
- different_nodes_prop (Config1 , Conf , O )))
1173
+ different_nodes_prop (Node , Conf , O )))
1122
1174
end )
1123
- end , [], Size ),
1124
-
1125
- rabbit_ct_helpers :run_teardown_steps (
1126
- Config1 ,
1127
- rabbit_ct_broker_helpers :teardown_steps ()).
1175
+ end , [], Size ).
1128
1176
1129
1177
max_length (_Config ) ->
1130
1178
% % tests that max length is never transgressed
@@ -1485,18 +1533,18 @@ single_active_prop(Conf0, Commands, ValidateOrder) ->
1485
1533
false
1486
1534
end .
1487
1535
1488
- different_nodes_prop (Config , Conf0 , Commands ) ->
1536
+ different_nodes_prop (Node , Conf0 , Commands ) ->
1489
1537
Conf = Conf0 #{release_cursor_interval => 100 },
1490
1538
Indexes = lists :seq (1 , length (Commands )),
1491
1539
Entries = lists :zip (Indexes , Commands ),
1492
1540
InitState = test_init (Conf ),
1493
1541
Fun = fun (_ ) -> true end ,
1494
- Vsn = 6 ,
1542
+ MachineVersion = 6 ,
1495
1543
1496
- {State0 , _Effs0 } = run_log (InitState , Entries , Fun , Vsn ),
1497
- {State1 , _Effs1 } = rabbit_ct_broker_helpers : rpc ( Config , ? MODULE , run_log ,
1498
- [InitState , Entries , Fun , Vsn ]),
1499
- State0 =:= State1 .
1544
+ {State1 , _Effs1 } = run_log (InitState , Entries , Fun , MachineVersion ),
1545
+ {State2 , _Effs2 } = erpc : call ( Node , ? MODULE , run_log ,
1546
+ [InitState , Entries , Fun , MachineVersion ]),
1547
+ State1 =:= State2 .
1500
1548
1501
1549
messages_total_prop (Conf0 , Commands ) ->
1502
1550
Conf = Conf0 #{release_cursor_interval => 100 },
0 commit comments