From b6a27897a2a9372a7767fb385ff0df6a8895ccb6 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 17 Jun 2019 15:59:51 +0300 Subject: [PATCH] fix tests --- .../channels/exchange_rate_channel_test.exs | 4 ++++ apps/block_scout_web/test/support/channel_case.ex | 3 --- apps/explorer/test/explorer/market/market_test.exs | 7 +++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/block_scout_web/test/block_scout_web/channels/exchange_rate_channel_test.exs b/apps/block_scout_web/test/block_scout_web/channels/exchange_rate_channel_test.exs index 062809bec3..d0ffcc36c8 100644 --- a/apps/block_scout_web/test/block_scout_web/channels/exchange_rate_channel_test.exs +++ b/apps/block_scout_web/test/block_scout_web/channels/exchange_rate_channel_test.exs @@ -43,6 +43,8 @@ defmodule BlockScoutWeb.ExchangeRateChannelTest do describe "new_rate" do test "subscribed user is notified", %{token: token} do ExchangeRates.handle_info({nil, {:ok, [token]}}, %{}) + Supervisor.terminate_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()}) + Supervisor.restart_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()}) topic = "exchange_rate:new_rate" @endpoint.subscribe(topic) @@ -61,6 +63,8 @@ defmodule BlockScoutWeb.ExchangeRateChannelTest do test "subscribed user is notified with market history", %{token: token} do ExchangeRates.handle_info({nil, {:ok, [token]}}, %{}) + Supervisor.terminate_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()}) + Supervisor.restart_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()}) today = Date.utc_today() diff --git a/apps/block_scout_web/test/support/channel_case.ex b/apps/block_scout_web/test/support/channel_case.ex index 27ef9f1fce..fcb7ddad66 100644 --- a/apps/block_scout_web/test/support/channel_case.ex +++ b/apps/block_scout_web/test/support/channel_case.ex @@ -31,9 +31,6 @@ defmodule BlockScoutWeb.ChannelCase do setup tags do :ok = Ecto.Adapters.SQL.Sandbox.checkout(Explorer.Repo) - Supervisor.terminate_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()}) - Supervisor.restart_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()}) - unless tags[:async] do Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo, {:shared, self()}) end diff --git a/apps/explorer/test/explorer/market/market_test.exs b/apps/explorer/test/explorer/market/market_test.exs index be1390877d..c2954d7033 100644 --- a/apps/explorer/test/explorer/market/market_test.exs +++ b/apps/explorer/test/explorer/market/market_test.exs @@ -5,6 +5,13 @@ defmodule Explorer.MarketTest do alias Explorer.Market.MarketHistory alias Explorer.Repo + setup do + Supervisor.terminate_child(Explorer.Supervisor, {ConCache, Explorer.Chain.BlocksCache.cache_name()}) + Supervisor.restart_child(Explorer.Supervisor, {ConCache, Explorer.Chain.BlocksCache.cache_name()}) + + :ok + end + test "fetch_recent_history/1" do today = Date.utc_today()