@@ -321,23 +321,28 @@ promote_on_failure(Config) ->
321
321
durable = true }),
322
322
ok .
323
323
324
-
325
324
promote_on_shutdown (Config ) ->
326
325
[A , B ] = rabbit_ct_broker_helpers :get_node_configs (Config , nodename ),
327
326
rabbit_ct_broker_helpers :set_ha_policy (Config , A , <<" ^ha.promote" >>,
328
327
<<" all" >>, [{<<" ha-promote-on-shutdown" >>, <<" always" >>}]),
329
328
rabbit_ct_broker_helpers :set_ha_policy (Config , A , <<" ^ha.nopromote" >>,
330
329
<<" all" >>),
330
+ rabbit_ct_broker_helpers :set_ha_policy (Config , A , <<" ^ha.nopromoteonfailure" >>,
331
+ <<" all" >>, [{<<" ha-promote-on-failure" >>, <<" when-synced" >>},
332
+ {<<" ha-promote-on-shutdown" >>, <<" always" >>}]),
331
333
332
334
ACh = rabbit_ct_client_helpers :open_channel (Config , A ),
333
335
[begin
334
336
amqp_channel :call (ACh , # 'queue.declare' {queue = Q ,
335
337
durable = true }),
336
338
rabbit_ct_client_helpers :publish (ACh , Q , 10 )
337
- end || Q <- [<<" ha.promote.test" >>, <<" ha.nopromote.test" >>]],
339
+ end || Q <- [<<" ha.promote.test" >>,
340
+ <<" ha.nopromote.test" >>,
341
+ <<" ha.nopromoteonfailure.test" >>]],
338
342
ok = rabbit_ct_broker_helpers :restart_node (Config , B ),
339
343
ok = rabbit_ct_broker_helpers :stop_node (Config , A ),
340
344
BCh = rabbit_ct_client_helpers :open_channel (Config , B ),
345
+ BCh1 = rabbit_ct_client_helpers :open_channel (Config , B ),
341
346
# 'queue.declare_ok' {message_count = 0 } =
342
347
amqp_channel :call (
343
348
BCh , # 'queue.declare' {queue = <<" ha.promote.test" >>,
@@ -347,12 +352,21 @@ promote_on_shutdown(Config) ->
347
352
amqp_channel :call (
348
353
BCh , # 'queue.declare' {queue = <<" ha.nopromote.test" >>,
349
354
durable = true })),
355
+ ? assertExit (
356
+ {{shutdown , {server_initiated_close , 404 , _ }}, _ },
357
+ amqp_channel :call (
358
+ BCh1 , # 'queue.declare' {queue = <<" ha.nopromoteonfailure.test" >>,
359
+ durable = true })),
350
360
ok = rabbit_ct_broker_helpers :start_node (Config , A ),
351
361
ACh2 = rabbit_ct_client_helpers :open_channel (Config , A ),
352
362
# 'queue.declare_ok' {message_count = 10 } =
353
363
amqp_channel :call (
354
364
ACh2 , # 'queue.declare' {queue = <<" ha.nopromote.test" >>,
355
365
durable = true }),
366
+ # 'queue.declare_ok' {message_count = 10 } =
367
+ amqp_channel :call (
368
+ ACh2 , # 'queue.declare' {queue = <<" ha.nopromoteonfailure.test" >>,
369
+ durable = true }),
356
370
ok .
357
371
358
372
nodes_policy_should_pick_master_from_its_params (Config ) ->
0 commit comments