@@ -65,7 +65,8 @@ groups() ->
6565 authentication_error_should_close_with_delay ,
6666 unauthorized_vhost_access_should_close_with_delay ,
6767 sasl_anonymous ,
68- test_publisher_with_too_long_reference_errors
68+ test_publisher_with_too_long_reference_errors ,
69+ test_consumer_with_too_long_reference_errors
6970 ]},
7071 % % Run `test_global_counters` on its own so the global metrics are
7172 % % initialised to 0 for each testcase
@@ -978,6 +979,38 @@ test_publisher_with_too_long_reference_errors(Config) ->
978979 test_close (T , S , C ),
979980 ok .
980981
982+ test_consumer_with_too_long_reference_errors (Config ) ->
983+ FunctionName = atom_to_binary (? FUNCTION_NAME , utf8 ),
984+ T = gen_tcp ,
985+ Port = get_port (T , Config ),
986+ Opts = get_opts (T ),
987+ {ok , S } = T :connect (" localhost" , Port , Opts ),
988+ C = rabbit_stream_core :init (0 ),
989+ ConnectionName = FunctionName ,
990+ test_peer_properties (T , S , #{<<" connection_name" >> => ConnectionName }, C ),
991+ test_authenticate (T , S , C ),
992+
993+ Stream = FunctionName ,
994+ test_create_stream (T , S , Stream , C ),
995+
996+ MaxSize = 255 ,
997+ ReferenceOK = iolist_to_binary (lists :duplicate (MaxSize , <<" a" >>)),
998+ ReferenceKO = iolist_to_binary (lists :duplicate (MaxSize + 1 , <<" a" >>)),
999+
1000+ Tests = [{1 , ReferenceOK , ? RESPONSE_CODE_OK },
1001+ {2 , ReferenceKO , ? RESPONSE_CODE_PRECONDITION_FAILED }],
1002+
1003+ [begin
1004+ F = request ({subscribe , SubId , Stream , first , 1 , #{<<" name" >> => Ref }}),
1005+ ok = T :send (S , F ),
1006+ {Cmd , C } = receive_commands (T , S , C ),
1007+ ? assertMatch ({response , 1 , {subscribe , ExpectedResponseCode }}, Cmd )
1008+ end || {SubId , Ref , ExpectedResponseCode } <- Tests ],
1009+
1010+ test_delete_stream (T , S , Stream , C ),
1011+ test_close (T , S , C ),
1012+ ok .
1013+
9811014consumer_offset_info (Config , ConnectionName ) ->
9821015 [[{offset , Offset },
9831016 {offset_lag , Lag }]] = rpc (Config , 0 , ? MODULE ,
0 commit comments