Skip to content

Commit a1a904a

Browse files
committed
channel_source_SUITE: Wait for server channel
... in `undefined_channel_source` testcase. This testcase fails transiently and it looks like a timing issue: channel_source_SUITE > non_parallel_tests > undefined_channel_source #1. {error, {{badmatch,[]}, [{channel_source_SUITE,undefined_channel_source1,1, [{file,"test/channel_source_SUITE.erl"},{line,138}]}, {rpc,'-handle_call_call/6-fun-0-',5, [{file,"rpc.erl"},{line,197}]}]}} (cherry picked from commit 43037ce)
1 parent 21da95a commit a1a904a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/channel_source_SUITE.erl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,19 @@ undefined_channel_source(Config) ->
135135
undefined_channel_source1(_Config) ->
136136
ExistingChannels = rabbit_channel:list(),
137137
{_Writer, _Limiter, ServerCh} = rabbit_ct_broker_helpers:test_channel(),
138-
[ServerCh] = rabbit_channel:list() -- ExistingChannels,
138+
wait_for_server_channel(ExistingChannels, ServerCh, 60),
139139
[{source, undefined}] = rabbit_channel:info(ServerCh, [source]),
140140
_ = rabbit_channel:source(ServerCh, ?MODULE),
141141
[{source, ?MODULE}] = rabbit_channel:info(ServerCh, [source]),
142142
passed.
143+
144+
wait_for_server_channel(ExistingChannels, ServerCh, 0) ->
145+
[ServerCh] = rabbit_channel:list() -- ExistingChannels;
146+
wait_for_server_channel(ExistingChannels, ServerCh, Attempts) ->
147+
case rabbit_channel:list() -- ExistingChannels of
148+
[ServerCh] ->
149+
ok;
150+
_ ->
151+
timer:sleep(1000),
152+
wait_for_server_channel(ExistingChannels, ServerCh, Attempts - 1)
153+
end.

0 commit comments

Comments
 (0)