fix(mnesia_acl): upgrade snabbkaffe and use ?check_trace

This commit is contained in:
Ilya Averyanov 2021-10-18 12:08:16 +03:00
parent 43ac315444
commit ba319e1159
2 changed files with 24 additions and 23 deletions

View File

@ -239,8 +239,7 @@ t_migration_concurrency(_Config) ->
end, end,
fun(_, Trace) -> fun(_, Trace) ->
?assertMatch([_], ?of_kind(emqx_acl_mnesia_migrator_record_missed, Trace)) ?assertMatch([_], ?of_kind(emqx_acl_mnesia_migrator_record_missed, Trace))
end end),
),
?assert(emqx_acl_mnesia_migrator:is_old_table_migrated()), ?assert(emqx_acl_mnesia_migrator:is_old_table_migrated()),
?assertEqual([], emqx_acl_mnesia_db:all_acls()). ?assertEqual([], emqx_acl_mnesia_db:all_acls()).
@ -251,27 +250,30 @@ t_old_and_new_acl_migration_by_migrator(_Config) ->
meck:new(fake_nodes, [non_strict]), meck:new(fake_nodes, [non_strict]),
meck:expect(fake_nodes, all, fun() -> [node(), 'somebadnode@127.0.0.1'] end), meck:expect(fake_nodes, all, fun() -> [node(), 'somebadnode@127.0.0.1'] end),
snabbkaffe:start_trace(),
% check all nodes every 30 ms ?check_trace(
{ok, _} = emqx_acl_mnesia_migrator:start_link(#{ begin
name => ct_migrator, % check all nodes every 30 ms
check_nodes_interval => 30, {ok, _} = emqx_acl_mnesia_migrator:start_link(#{
get_nodes => fun fake_nodes:all/0 name => ct_migrator,
}), check_nodes_interval => 30,
timer:sleep(100), get_nodes => fun fake_nodes:all/0
}),
timer:sleep(100)
end,
fun(_, Trace) ->
?assertEqual([], ?of_kind(emqx_acl_mnesia_migrator_start_migration, Trace))
end),
Trace0 = snabbkaffe:collect_trace(), ?check_trace(
?assertEqual([], ?of_kind(emqx_acl_mnesia_migrator_start_migration, Trace0)), begin
meck:expect(fake_nodes, all, fun() -> [node()] end),
timer:sleep(100)
end,
fun(_, Trace) ->
?assertMatch([_], ?of_kind(emqx_acl_mnesia_migrator_finish, Trace))
end),
meck:expect(fake_nodes, all, fun() -> [node()] end),
timer:sleep(100),
Trace1 = snabbkaffe:collect_trace(),
?assertMatch([_], ?of_kind(emqx_acl_mnesia_migrator_finish, Trace1)),
snabbkaffe:stop(),
meck:unload(fake_nodes), meck:unload(fake_nodes),
?assertEqual(combined_conflicting_records(), emqx_acl_mnesia_db:all_acls()), ?assertEqual(combined_conflicting_records(), emqx_acl_mnesia_db:all_acls()),
@ -289,8 +291,7 @@ t_old_and_new_acl_migration_repeated_by_migrator(_Config) ->
fun(_, Trace) -> fun(_, Trace) ->
?assertEqual([], ?of_kind(emqx_acl_mnesia_migrator_start_migration, Trace)), ?assertEqual([], ?of_kind(emqx_acl_mnesia_migrator_start_migration, Trace)),
?assertMatch([_], ?of_kind(emqx_acl_mnesia_migrator_finish, Trace)) ?assertMatch([_], ?of_kind(emqx_acl_mnesia_migrator_finish, Trace))
end end).
).
t_start_stop_supervised(_Config) -> t_start_stop_supervised(_Config) ->
?assertEqual(undefined, whereis(emqx_acl_mnesia_migrator)), ?assertEqual(undefined, whereis(emqx_acl_mnesia_migrator)),

View File

@ -55,7 +55,7 @@
, {recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}} , {recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}}
, {observer_cli, "1.6.1"} % NOTE: depends on recon 2.5.1 , {observer_cli, "1.6.1"} % NOTE: depends on recon 2.5.1
, {getopt, "1.0.1"} , {getopt, "1.0.1"}
, {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.13.0"}}} , {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.15.0"}}}
]}. ]}.
{xref_ignores, {xref_ignores,