Skip to content

Commit 81f0606

Browse files
definition_import_SUITE: fix a subtle timing issue
In case 16, an await_condition/2 condition was not correctly matching the error. As a result, the function proceeded to the assertion step earlier than it should have, failing with an obscure function_clause. This was because an {error, Context} clause was not correct. In addition to fixing it, this change adds a catch-all clause and verifies the loaded tagged virtual host before running any assertions on it. If the virtual host was not imported, case 16 will now fail with a specific CT log message. References #11457 because the changes there exposed this behavior in CI. (cherry picked from commit f515282)
1 parent e370d0e commit 81f0606

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

deps/rabbit/test/definition_import_SUITE.erl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ groups() ->
5656
import_case20,
5757
import_case21
5858
]},
59-
59+
6060
{boot_time_import_using_classic_source, [], [
6161
import_on_a_booting_node_using_classic_local_source
6262
]},
@@ -259,15 +259,20 @@ import_case16(Config) ->
259259
VHostIsImported =
260260
fun () ->
261261
case vhost_lookup(Config, VHost) of
262-
{error, {no_such_vhosts, _}} -> false;
262+
{error, {no_such_vhost, _}} -> false;
263+
{error, _} -> false;
263264
_ -> true
264265
end
265266
end,
266267
rabbit_ct_helpers:await_condition(VHostIsImported, 20000),
267268
VHostRec = vhost_lookup(Config, VHost),
268-
?assertEqual(<<"A case16 description">>, vhost:get_description(VHostRec)),
269-
?assertEqual(<<"quorum">>, vhost:get_default_queue_type(VHostRec)),
270-
?assertEqual([multi_dc_replication,ab,cde], vhost:get_tags(VHostRec)),
269+
case VHostRec of
270+
{error, _} -> ct:fail("Failed to import virtual host named 'tagged' in case 16");
271+
Val when is_tuple(Val) ->
272+
?assertEqual(<<"A case16 description">>, vhost:get_description(VHostRec)),
273+
?assertEqual(<<"quorum">>, vhost:get_default_queue_type(VHostRec)),
274+
?assertEqual([multi_dc_replication,ab,cde], vhost:get_tags(VHostRec))
275+
end,
271276

272277
ok.
273278

0 commit comments

Comments
 (0)