Skip to content

Commit 0ecf3d4

Browse files
committed
Test stream publisher & consumer counters
Pair: @kjnilsson Signed-off-by: Gerhard Lazu <[email protected]>
1 parent dad0025 commit 0ecf3d4

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

deps/rabbitmq_stream/test/rabbit_stream_SUITE.erl

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ end_per_testcase(_Test, _Config) ->
121121
ok.
122122

123123
test_global_counters(Config) ->
124-
Port = get_stream_port(Config),
125-
test_server(gen_tcp, Port),
124+
test_server(gen_tcp, Config),
126125
?assertEqual(#{
127126
publishers => 0,
128127
consumers => 0,
@@ -153,14 +152,11 @@ test_global_counters(Config) ->
153152
ok.
154153

155154
test_stream(Config) ->
156-
Port = get_stream_port(Config),
157-
test_server(gen_tcp, Port),
155+
test_server(gen_tcp, Config),
158156
ok.
159157

160158
test_stream_tls(Config) ->
161-
Port = get_stream_port_tls(Config),
162-
application:ensure_all_started(ssl),
163-
test_server(ssl, Port),
159+
test_server(ssl, Config),
164160
ok.
165161

166162
test_gc_consumers(Config) ->
@@ -313,7 +309,12 @@ get_node_name(Config) ->
313309
get_node_name(Config, Node) ->
314310
rabbit_ct_broker_helpers:get_node_config(Config, Node, nodename).
315311

316-
test_server(Transport, Port) ->
312+
test_server(Transport, Config) ->
313+
Port = case Transport of
314+
gen_tcp -> get_stream_port(Config);
315+
ssl -> application:ensure_all_started(ssl),
316+
get_stream_port_tls(Config)
317+
end,
317318
{ok, S} =
318319
Transport:connect("localhost", Port,
319320
[{active, false}, {mode, binary}]),
@@ -324,11 +325,13 @@ test_server(Transport, Port) ->
324325
C3 = test_create_stream(Transport, S, Stream, C2),
325326
PublisherId = 42,
326327
C4 = test_declare_publisher(Transport, S, PublisherId, Stream, C3),
328+
?assertMatch(#{publishers := 1}, get_global_counters(Config)),
327329
Body = <<"hello">>,
328330
C5 = test_publish_confirm(Transport, S, PublisherId, Body, C4),
329331
C6 = test_publish_confirm(Transport, S, PublisherId, Body, C5),
330332
SubscriptionId = 42,
331333
C7 = test_subscribe(Transport, S, SubscriptionId, Stream, C6),
334+
?assertMatch(#{consumers := 1}, get_global_counters(Config)),
332335
C8 = test_deliver(Transport, S, SubscriptionId, 0, Body, C7),
333336
C9 = test_deliver(Transport, S, SubscriptionId, 1, Body, C8),
334337
C10 = test_delete_stream(Transport, S, Stream, C9),

0 commit comments

Comments
 (0)