Test timeout override

pull/833/head
Luke Imhoff 6 years ago
parent e4916eb90a
commit e6c6ea6354
  1. 4
      apps/explorer/lib/explorer/chain/import.ex
  2. 52
      apps/explorer/test/explorer/chain/import_test.exs

@ -520,9 +520,7 @@ defmodule Explorer.Chain.Import do
when is_map(ecto_schema_module_to_changes_list) and is_map(options) do when is_map(ecto_schema_module_to_changes_list) and is_map(options) do
case ecto_schema_module_to_changes_list do case ecto_schema_module_to_changes_list do
%{Token => tokens_changes} -> %{Token => tokens_changes} ->
tokens_options = Map.fetch!(options, :tokens) %{timestamps: timestamps, tokens: %{on_conflict: on_conflict}} = options
timestamps = Map.fetch!(options, :timestamps)
on_conflict = Map.fetch!(tokens_options, :on_conflict)
Multi.run(multi, :tokens, fn _ -> Multi.run(multi, :tokens, fn _ ->
insert_tokens( insert_tokens(

@ -1459,5 +1459,57 @@ defmodule Explorer.Chain.ImportTest do
) )
) )
end end
test "timeouts can be overridden" do
assert {:ok, _} =
Import.all(%{
addresses: %{
params: [],
timeout: 1
},
balances: %{
params: [],
timeout: 1
},
blocks: %{
params: [],
timeout: 1
},
block_second_degree_relations: %{
params: [],
timeout: 1
},
internal_transactions: %{
params: [],
timeout: 1
},
logs: %{
params: [],
timeout: 1
},
token_transfers: %{
params: [],
timeout: 1
},
tokens: %{
params: [],
on_conflict: :replace_all,
timeout: 1
},
transactions: %{
params: [],
on_conflict: :replace_all,
timeout: 1
},
transaction_forks: %{
params: [],
timeout: 1
},
token_balances: %{
params: [],
timeout: 1
}
})
end
end end
end end

Loading…
Cancel
Save