@@ -54,7 +54,8 @@ groups() ->
5454 incoming_heartbeat ,
5555 multi_transfer_without_delivery_id ,
5656 set_receiver_capabilities ,
57- set_sender_capabilities
57+ set_sender_capabilities ,
58+ set_sender_sync_capabilities
5859 ]}
5960 ].
6061
@@ -911,6 +912,54 @@ set_sender_capabilities(Config) ->
911912 ok = amqp10_client :close_connection (Connection ),
912913 ok .
913914
915+
916+ set_sender_sync_capabilities (Config ) ->
917+ Hostname = ? config (mock_host , Config ),
918+ Port = ? config (mock_port , Config ),
919+ OpenStep = fun ({0 = Ch , # 'v1_0.open' {}, _Pay }) ->
920+ {Ch , [# 'v1_0.open' {container_id = {utf8 , <<" mock" >>}}]}
921+ end ,
922+ BeginStep = fun ({1 = Ch , # 'v1_0.begin' {}, _Pay }) ->
923+ {Ch , [# 'v1_0.begin' {remote_channel = {ushort , 1 },
924+ next_outgoing_id = {uint , 1 },
925+ incoming_window = {uint , 1000 },
926+ outgoing_window = {uint , 1000 }}
927+ ]}
928+ end ,
929+ AttachStep = fun ({1 = Ch , # 'v1_0.attach' {role = false ,
930+ name = Name ,
931+ source = # 'v1_0.source' {
932+
933+ },
934+ target = # 'v1_0.target' {
935+ capabilities = {utf8 , <<" capability-1" >>}}}, <<>>}) ->
936+ {Ch , [# 'v1_0.attach' {name = Name ,
937+ handle = {uint , 99 },
938+ role = true }]}
939+ end ,
940+ Steps = [fun mock_server :recv_amqp_header_step /1 ,
941+ fun mock_server :send_amqp_header_step /1 ,
942+ mock_server :amqp_step (OpenStep ),
943+ mock_server :amqp_step (BeginStep ),
944+ mock_server :amqp_step (AttachStep )],
945+
946+ ok = mock_server :set_steps (? config (mock_server , Config ), Steps ),
947+
948+ Cfg = #{address => Hostname , port => Port , sasl => none , notify => self ()},
949+ {ok , Connection } = amqp10_client :open_connection (Cfg ),
950+ {ok , Session } = amqp10_client :begin_session_sync (Connection ),
951+ {ok , Sender } = amqp10_client :attach_sender_link_sync (Session , <<" mock1-sender" >>,
952+ <<" test" >>,
953+ mixed ,
954+ none ,
955+ <<" capability-1" >>),
956+ Msg = amqp10_msg :new (<<" mock-tag" >>, <<" banana" >>, true ),
957+ {error , insufficient_credit } = amqp10_client :send_msg (Sender , Msg ),
958+
959+ ok = amqp10_client :end_session (Session ),
960+ ok = amqp10_client :close_connection (Connection ),
961+ ok .
962+
914963outgoing_heartbeat (Config ) ->
915964 Hostname = ? config (rmq_hostname , Config ),
916965 Port = rabbit_ct_broker_helpers :get_node_config (Config , 0 , tcp_port_amqp ),
0 commit comments