@@ -46,7 +46,8 @@ groups() ->
46
46
timeout_authenticating ,
47
47
timeout_close_sent ,
48
48
max_segment_size_bytes_validation ,
49
- close_connection_on_consumer_update_timeout ]},
49
+ close_connection_on_consumer_update_timeout ,
50
+ set_filter_size ]},
50
51
% % Run `test_global_counters` on its own so the global metrics are
51
52
% % initialised to 0 for each testcase
52
53
{single_node_1 , [], [test_global_counters ]},
@@ -433,6 +434,37 @@ close_connection_on_consumer_update_timeout(Config) ->
433
434
closed = wait_for_socket_close (Transport , Sb , 10 ),
434
435
ok .
435
436
437
+ set_filter_size (Config ) ->
438
+ Stream = atom_to_binary (? FUNCTION_NAME , utf8 ),
439
+ Transport = gen_tcp ,
440
+ Port = get_stream_port (Config ),
441
+ Opts = [{active , false }, {mode , binary }],
442
+ {ok , S } = Transport :connect (" localhost" , Port , Opts ),
443
+ C0 = rabbit_stream_core :init (0 ),
444
+ C1 = test_peer_properties (Transport , S , C0 ),
445
+ C2 = test_authenticate (Transport , S , C1 ),
446
+
447
+ Tests = [
448
+ {128 , ? RESPONSE_CODE_OK },
449
+ {15 , ? RESPONSE_CODE_PRECONDITION_FAILED },
450
+ {256 , ? RESPONSE_CODE_PRECONDITION_FAILED }
451
+ ],
452
+
453
+ C3 = lists :foldl (fun ({Size , ExpectedResponseCode }, Conn0 ) ->
454
+ Frame = rabbit_stream_core :frame (
455
+ {request , 1 ,
456
+ {create_stream , Stream ,
457
+ #{<<" stream-filter-size-bytes" >> => integer_to_binary (Size )}}}),
458
+ ok = Transport :send (S , Frame ),
459
+ {Cmd , Conn1 } = receive_commands (Transport , S , Conn0 ),
460
+ ? assertMatch ({response , 1 , {create_stream , ExpectedResponseCode }}, Cmd ),
461
+ Conn1
462
+ end , C2 , Tests ),
463
+
464
+ _ = test_close (Transport , S , C3 ),
465
+ closed = wait_for_socket_close (Transport , S , 10 ),
466
+ ok .
467
+
436
468
consumer_count (Config ) ->
437
469
ets_count (Config , ? TABLE_CONSUMER ).
438
470
0 commit comments