From 39b3ec8a7df89af7aba0ac315a6f328bdbd20b0e Mon Sep 17 00:00:00 2001 From: Dan Schultzer <1254724+danschultzer@users.noreply.github.com> Date: Wed, 7 Feb 2024 11:56:13 -0800 Subject: [PATCH 1/2] Silence node logs --- test/pow/store/backend/mnesia_cache_test.exs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/pow/store/backend/mnesia_cache_test.exs b/test/pow/store/backend/mnesia_cache_test.exs index 3db3f86f..920003b8 100644 --- a/test/pow/store/backend/mnesia_cache_test.exs +++ b/test/pow/store/backend/mnesia_cache_test.exs @@ -560,8 +560,9 @@ defmodule Pow.Store.Backend.MnesiaCacheTest do rpc(node, Application, :ensure_all_started, [app_name]) end - # Remove logger to prevent logs - rpc(node, Logger, :remove_backend, [:console]) + # Silence console logging on node + rpc(node, :logger, :remove_handler, [:default]) + rpc(node, Logger, :remove_backend, [:console]) # TODO: Remove when Elixir 1.15 is required add_listener_module(node) From ab89cc8de358c9dafb3738d8ae35ba77ed5ed205 Mon Sep 17 00:00:00 2001 From: Dan Schultzer <1254724+danschultzer@users.noreply.github.com> Date: Wed, 7 Feb 2024 20:19:20 -0800 Subject: [PATCH 2/2] Make tests more consistent --- test/pow/store/backend/mnesia_cache_test.exs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/pow/store/backend/mnesia_cache_test.exs b/test/pow/store/backend/mnesia_cache_test.exs index 920003b8..a1814016 100644 --- a/test/pow/store/backend/mnesia_cache_test.exs +++ b/test/pow/store/backend/mnesia_cache_test.exs @@ -228,9 +228,9 @@ defmodule Pow.Store.Backend.MnesiaCacheTest do # Set short TTL on node a flush_process_mailbox() - config = Config.put(@default_config, :ttl, 100) + config = Config.put(@default_config, :ttl, @assertion_timeout) assert :rpc.call(node_a, MnesiaCache, :put, [config, {"short_ttl_key_set_on_a", "value"}]) - assert_receive {{:mnesia, ^node_b}, {:mnesia_system_event, {:mnesia_user, {:refresh_invalidators, {_, _}}}}} + assert_receive {{:mnesia, ^node_b}, {:mnesia_system_event, {:mnesia_user, {:refresh_invalidators, {_, _}}}}}, @assertion_timeout # Stop node a flush_process_mailbox() @@ -241,7 +241,7 @@ defmodule Pow.Store.Backend.MnesiaCacheTest do # Ensure that node b invalidates with TTL set on node a assert :rpc.call(node_b, MnesiaCache, :get, [config, "short_ttl_key_set_on_a"]) == "value" - assert_receive {{:mnesia, ^node_b}, {:mnesia_table_event, {:delete, {MnesiaCache, [_, "short_ttl_key_set_on_a"]}, _}}}, @assertion_timeout + assert_receive {{:mnesia, ^node_b}, {:mnesia_table_event, {:delete, {MnesiaCache, [_, "short_ttl_key_set_on_a"]}, _}}}, @assertion_timeout + 100 assert :rpc.call(node_b, MnesiaCache, :get, [config, "short_ttl_key_set_on_a"]) == :not_found # Start node a but not mnesia yet before we test cross node TTL