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.
This commit is contained in:
Michael Klishin 2024-06-21 21:29:27 -04:00
parent 83ab70120c
commit a656e2e4c6
1 changed files with 10 additions and 5 deletions

View File

@ -55,7 +55,7 @@ groups() ->
import_case20,
import_case21
]},
{boot_time_import_using_classic_source, [], [
import_on_a_booting_node_using_classic_local_source
]},
@ -258,15 +258,20 @@ import_case16(Config) ->
VHostIsImported =
fun () ->
case vhost_lookup(Config, VHost) of
{error, {no_such_vhosts, _}} -> false;
{error, {no_such_vhost, _}} -> false;
{error, _} -> false;
_ -> true
end
end,
rabbit_ct_helpers:await_condition(VHostIsImported, 20000),
VHostRec = vhost_lookup(Config, VHost),
?assertEqual(<<"A case16 description">>, vhost:get_description(VHostRec)),
?assertEqual(<<"quorum">>, vhost:get_default_queue_type(VHostRec)),
?assertEqual([multi_dc_replication,ab,cde], vhost:get_tags(VHostRec)),
case VHostRec of
{error, _} -> ct:fail("Failed to import virtual host named 'tagged' in case 16");
Val when is_tuple(Val) ->
?assertEqual(<<"A case16 description">>, vhost:get_description(VHostRec)),
?assertEqual(<<"quorum">>, vhost:get_default_queue_type(VHostRec)),
?assertEqual([multi_dc_replication,ab,cde], vhost:get_tags(VHostRec))
end,
ok.