Skip to content

Commit 7aea2fd

Browse files
committed
per_user_connection_tracking_SUITE: Wait for the expected list of connections
[Why] In CI, we sometimes observe two tracked connections in the return value. I don't know yet what they are. Could it be a client that reopened its crashed connection and because stats are updated asynchronously, we get two tracked connections for a short period of time?
1 parent 8da7be1 commit 7aea2fd

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

deps/rabbit/test/per_user_connection_tracking_SUITE.erl

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,28 +115,42 @@ single_node_list_of_user(Config) ->
115115

116116
[Conn1] = open_connections(Config, [{0, Username1}]),
117117
?awaitMatch(1, count_connections_in(Config, Username1), ?AWAIT_TIMEOUT),
118-
[#tracked_connection{username = Username1}] = connections_in(Config, Username1),
118+
?awaitMatch(
119+
[#tracked_connection{username = Username1}],
120+
connections_in(Config, Username1),
121+
?AWAIT_TIMEOUT),
119122
close_connections([Conn1]),
120123
?awaitMatch(0, count_connections_in(Config, Username1), ?AWAIT_TIMEOUT),
121124

122125
[Conn2] = open_connections(Config, [{0, Username2}]),
123126
?awaitMatch(1, count_connections_in(Config, Username2), ?AWAIT_TIMEOUT),
124-
[#tracked_connection{username = Username2}] = connections_in(Config, Username2),
127+
?awaitMatch(
128+
[#tracked_connection{username = Username2}],
129+
connections_in(Config, Username2),
130+
?AWAIT_TIMEOUT),
125131

126132
[Conn3] = open_connections(Config, [{0, Username1}]),
127133
?awaitMatch(1, count_connections_in(Config, Username1), ?AWAIT_TIMEOUT),
128-
[#tracked_connection{username = Username1}] = connections_in(Config, Username1),
134+
?awaitMatch(
135+
[#tracked_connection{username = Username1}],
136+
connections_in(Config, Username1),
137+
?AWAIT_TIMEOUT),
129138

130139
[Conn4] = open_connections(Config, [{0, Username1}]),
131140
kill_connections([Conn4]),
132141
?awaitMatch(1, count_connections_in(Config, Username1), ?AWAIT_TIMEOUT),
133-
[#tracked_connection{username = Username1}] = connections_in(Config, Username1),
142+
?awaitMatch(
143+
[#tracked_connection{username = Username1}],
144+
connections_in(Config, Username1),
145+
?AWAIT_TIMEOUT),
134146

135147
[Conn5] = open_connections(Config, [{0, Username1}]),
136148
?awaitMatch(2, count_connections_in(Config, Username1), ?AWAIT_TIMEOUT),
137-
[Username1, Username1] =
138-
lists:map(fun (#tracked_connection{username = U}) -> U end,
139-
connections_in(Config, Username1)),
149+
?awaitMatch(
150+
[Username1, Username1],
151+
lists:map(fun (#tracked_connection{username = U}) -> U end,
152+
connections_in(Config, Username1)),
153+
?AWAIT_TIMEOUT),
140154

141155
close_connections([Conn2, Conn3, Conn5]),
142156
rabbit_ct_broker_helpers:delete_user(Config, Username2),

0 commit comments

Comments
 (0)