From a656e2e4c67eb898f2fafd7ddb535f5dba1d8f72 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Fri, 21 Jun 2024 21:29:27 -0400 Subject: [PATCH] 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. --- deps/rabbit/test/definition_import_SUITE.erl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/deps/rabbit/test/definition_import_SUITE.erl b/deps/rabbit/test/definition_import_SUITE.erl index 67b2e6bb51..9f6cfc70e2 100644 --- a/deps/rabbit/test/definition_import_SUITE.erl +++ b/deps/rabbit/test/definition_import_SUITE.erl @@ -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.