Skip to content

Commit f515282

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.
1 parent 6ec0748 commit f515282

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
@@ -55,7 +55,7 @@ groups() ->
5555
import_case20,
5656
import_case21
5757
]},
58-
58+
5959
{boot_time_import_using_classic_source, [], [
6060
import_on_a_booting_node_using_classic_local_source
6161
]},
@@ -258,15 +258,20 @@ import_case16(Config) ->
258258
VHostIsImported =
259259
fun () ->
260260
case vhost_lookup(Config, VHost) of
261-
{error, {no_such_vhosts, _}} -> false;
261+
{error, {no_such_vhost, _}} -> false;
262+
{error, _} -> false;
262263
_ -> true
263264
end
264265
end,
265266
rabbit_ct_helpers:await_condition(VHostIsImported, 20000),
266267
VHostRec = vhost_lookup(Config, VHost),
267-
?assertEqual(<<"A case16 description">>, vhost:get_description(VHostRec)),
268-
?assertEqual(<<"quorum">>, vhost:get_default_queue_type(VHostRec)),
269-
?assertEqual([multi_dc_replication,ab,cde], vhost:get_tags(VHostRec)),
268+
case VHostRec of
269+
{error, _} -> ct:fail("Failed to import virtual host named 'tagged' in case 16");
270+
Val when is_tuple(Val) ->
271+
?assertEqual(<<"A case16 description">>, vhost:get_description(VHostRec)),
272+
?assertEqual(<<"quorum">>, vhost:get_default_queue_type(VHostRec)),
273+
?assertEqual([multi_dc_replication,ab,cde], vhost:get_tags(VHostRec))
274+
end,
270275

271276
ok.
272277

0 commit comments

Comments
 (0)