parent
1c0bfe5eb0
commit
6b3fd80916
@ -1,26 +1,24 @@ |
||||
defmodule Explorer.Indexer.Supervisor do |
||||
defmodule Indexer.Application do |
||||
@moduledoc """ |
||||
Supervising the fetchers for the `Explorer.Indexer` |
||||
This is the `Application` module for `Indexer`. |
||||
""" |
||||
|
||||
use Supervisor |
||||
use Application |
||||
|
||||
alias Explorer.Indexer.{AddressBalanceFetcher, BlockFetcher, InternalTransactionFetcher, PendingTransactionFetcher} |
||||
alias Indexer.{AddressBalanceFetcher, BlockFetcher, InternalTransactionFetcher, PendingTransactionFetcher} |
||||
|
||||
def start_link(opts) do |
||||
Supervisor.start_link(__MODULE__, opts, name: __MODULE__) |
||||
end |
||||
|
||||
@impl Supervisor |
||||
def init(_opts) do |
||||
@impl Application |
||||
def start(_type, _args) do |
||||
children = [ |
||||
{Task.Supervisor, name: Explorer.Indexer.TaskSupervisor}, |
||||
{Task.Supervisor, name: Indexer.TaskSupervisor}, |
||||
{AddressBalanceFetcher, name: AddressBalanceFetcher}, |
||||
{PendingTransactionFetcher, name: PendingTransactionFetcher}, |
||||
{InternalTransactionFetcher, name: InternalTransactionFetcher}, |
||||
{BlockFetcher, []} |
||||
] |
||||
|
||||
Supervisor.init(children, strategy: :one_for_one) |
||||
opts = [strategy: :one_for_one, name: Indexer.Supervisor] |
||||
|
||||
Supervisor.start_link(children, opts) |
||||
end |
||||
end |
||||
|
@ -1 +1,20 @@ |
||||
# https://github.com/CircleCI-Public/circleci-demo-elixir-phoenix/blob/a89de33a01df67b6773ac90adc74c34367a4a2d6/test/test_helper.exs#L1-L3 |
||||
junit_folder = Mix.Project.build_path() <> "/junit/#{Mix.Project.config()[:app]}" |
||||
File.mkdir_p!(junit_folder) |
||||
:ok = Application.put_env(:junit_formatter, :report_dir, junit_folder) |
||||
|
||||
# start all dependencies, but not Indexer itself as we need to unit test the supervision tree without and don't want the |
||||
# genesis task scanning in the background |
||||
Application.load(:indexer) |
||||
|
||||
for application <- Application.spec(:indexer, :applications) do |
||||
Application.ensure_all_started(application) |
||||
end |
||||
|
||||
# no declared in :applications since it is test-only |
||||
{:ok, _} = Application.ensure_all_started(:ex_machina) |
||||
|
||||
ExUnit.configure(formatters: [JUnitFormatter, ExUnit.CLIFormatter]) |
||||
ExUnit.start() |
||||
|
||||
Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo, :manual) |
||||
|
Loading…
Reference in new issue