@@ -321,23 +321,28 @@ promote_on_failure(Config) ->
321321 durable = true }),
322322 ok .
323323
324-
325324promote_on_shutdown (Config ) ->
326325 [A , B ] = rabbit_ct_broker_helpers :get_node_configs (Config , nodename ),
327326 rabbit_ct_broker_helpers :set_ha_policy (Config , A , <<" ^ha.promote" >>,
328327 <<" all" >>, [{<<" ha-promote-on-shutdown" >>, <<" always" >>}]),
329328 rabbit_ct_broker_helpers :set_ha_policy (Config , A , <<" ^ha.nopromote" >>,
330329 <<" 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" >>}]),
331333
332334 ACh = rabbit_ct_client_helpers :open_channel (Config , A ),
333335 [begin
334336 amqp_channel :call (ACh , # 'queue.declare' {queue = Q ,
335337 durable = true }),
336338 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" >>]],
338342 ok = rabbit_ct_broker_helpers :restart_node (Config , B ),
339343 ok = rabbit_ct_broker_helpers :stop_node (Config , A ),
340344 BCh = rabbit_ct_client_helpers :open_channel (Config , B ),
345+ BCh1 = rabbit_ct_client_helpers :open_channel (Config , B ),
341346 # 'queue.declare_ok' {message_count = 0 } =
342347 amqp_channel :call (
343348 BCh , # 'queue.declare' {queue = <<" ha.promote.test" >>,
@@ -347,12 +352,21 @@ promote_on_shutdown(Config) ->
347352 amqp_channel :call (
348353 BCh , # 'queue.declare' {queue = <<" ha.nopromote.test" >>,
349354 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 })),
350360 ok = rabbit_ct_broker_helpers :start_node (Config , A ),
351361 ACh2 = rabbit_ct_client_helpers :open_channel (Config , A ),
352362 # 'queue.declare_ok' {message_count = 10 } =
353363 amqp_channel :call (
354364 ACh2 , # 'queue.declare' {queue = <<" ha.nopromote.test" >>,
355365 durable = true }),
366+ # 'queue.declare_ok' {message_count = 10 } =
367+ amqp_channel :call (
368+ ACh2 , # 'queue.declare' {queue = <<" ha.nopromoteonfailure.test" >>,
369+ durable = true }),
356370 ok .
357371
358372nodes_policy_should_pick_master_from_its_params (Config ) ->
0 commit comments