Skip to content

Commit

Permalink
Fix some self-repair tests
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmanzanera committed Oct 5, 2022
1 parent 098a1cf commit 9cbb375
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/archethic/self_repair/scheduler_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ defmodule Archethic.SelfRepair.SchedulerTest do
{:ok, %NotFound{}}
end)

{:ok, pid} = Scheduler.start_link([interval: "*/1 * * * * * *"], [])
{:ok, pid} = Scheduler.start_link([interval: "*/3 * * * * * *"], [])
assert :ok = Scheduler.start_scheduler(pid)
%{timer: timer} = :sys.get_state(pid)

:erlang.trace(pid, true, [:receive])

assert_receive {:trace, ^pid, :receive, :sync}, 2_000

Process.sleep(100)
assert_receive {:trace, ^pid, :receive, :sync}, 3_000
Process.cancel_timer(timer)
end

test "handle_info/3 should initiate the loading of missing transactions, schedule the next repair and update the last sync date" do
Expand Down Expand Up @@ -77,7 +77,7 @@ defmodule Archethic.SelfRepair.SchedulerTest do
:ok
end)

{:ok, pid} = Scheduler.start_link([interval: "*/1 * * * * * *"], [])
{:ok, pid} = Scheduler.start_link([interval: "0 0 * * * * *"], [])

send(pid, :sync)

Expand Down
2 changes: 2 additions & 0 deletions test/support/template.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ defmodule ArchethicCase do
|> stub(:transaction_exists?, fn _ -> false end)
|> stub(:register_p2p_summary, fn _, _, _, _ -> :ok end)
|> stub(:get_last_p2p_summaries, fn -> [] end)
|> stub(:get_latest_tps, fn -> 0.0 end)
|> stub(:register_stats, fn _, _, _, _ -> :ok end)
|> stub(:get_bootstrap_info, fn
"storage_nonce" ->
"nonce"
Expand Down

0 comments on commit 9cbb375

Please sign in to comment.