omgnetwork / elixir-omg

OMG-Network repository of Watcher and Watcher Info
https://omg.network
Apache License 2.0
213 stars 59 forks source link

OMG.Performance is bound to Geth #929

Closed 0x234 closed 4 years ago

0x234 commented 5 years ago

In the context of infrastructure testing I want to be able to use any Ethereum client (Geth, Parity, Infura) So that I can test the service is operational (not application level functional testing)

Context:

elixir-user@add-load-7cfdbbcfc6-jghhm:~/elixir-omg$ export ETHEREUM_RPC_URL=http://parity-rinkeby-childchain:8545
elixir-user@add-load-7cfdbbcfc6-jghhm:~/elixir-omg$ export ETH_NODE=parity
elixir-user@add-load-7cfdbbcfc6-jghhm:~/elixir-omg$ export MIX_ENV=test
elixir-user@add-load-7cfdbbcfc6-jghhm:~/elixir-omg$ export SIGNER_PASSPHRASE=ThisIsATestnetPassphrase
elixir-user@add-load-7cfdbbcfc6-jghhm:~/elixir-omg$ mix compile
elixir-user@add-load-7cfdbbcfc6-jghhm:~/elixir-omg$ iex -S mix run --no-start --config ~/config.exs
Erlang/OTP 21 [erts-10.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Interactive Elixir (1.8.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> {:ok, _} = Application.ensure_all_started(:ethereumex)
{:ok,
 [:poolboy, :unicode_util_compat, :idna, :mimerl, :certifi, :ssl_verify_fun,
  :metrics, :hackney, :httpoison, :ethereumex]}
iex(2)>
nil
iex(3)> alias OMG.Eth
OMG.Eth
iex(4)> alias OMG.TestHelper
OMG.TestHelper
iex(5)>
nil
iex(6)> DeferredConfig.populate(:omg_eth)
:ok
iex(7)>
nil
iex(8)> contract_addr = Application.fetch_env!(:omg_eth, :contract_addr) |> Eth.Encoding.from_hex()
<<65, 181, 89, 206, 24, 97, 149, 169, 191, 186, 155, 53, 150, 182, 251, 232,
  207, 119, 37, 93>>
iex(9)>
nil
iex(10)> opts = [initial_funds: trunc(:math.pow(10, 18)) * 1]
[initial_funds: 1000000000000000000]
iex(11)>
nil
iex(12)> faucet = String.downcase("0x944A81BeECac91802787fBCFB9767FCBf81db1f5")
"0x944a81beecac91802787fbcfb9767fcbf81db1f5"
iex(13)>
nil
iex(14)> opts = Keyword.put(opts, :faucet, faucet)
[
  faucet: "0x944a81beecac91802787fbcfb9767fcbf81db1f5",
  initial_funds: 1000000000000000000
]
iex(15)>
nil
iex(16)> initial_funds_eth = 1
1
iex(17)>
nil
iex(18)>
nil
iex(19)> opts = Keyword.put(opts, :initial_funds, trunc(:math.pow(10, 18) * initial_funds_eth))
[
  initial_funds: 1000000000000000000,
  faucet: "0x944a81beecac91802787fbcfb9767fcbf81db1f5"
]
iex(20)>
nil
iex(21)> generate = fn ->
...(21)>   alice = TestHelper.generate_entity()
...(21)>
...(21)>   {:ok, _alice_enc} = Eth.DevHelpers.import_unlock_fund(alice, opts)
...(21)>   alice
...(21)> end
#Function<20.128620087/0 in :erl_eval.expr/5>
iex(22)>
nil
iex(23)> alices = 1..5 |> Enum.map(fn _ -> Task.async(generate) end) |> Enum.map(& Task.await(&1, :infinity))
2019-09-03 09:35:23.264 [error] ⋅Task #PID<0.429.0> started from #PID<0.382.0> terminating
** (stop) exited in: Task.await(%Task{owner: #PID<0.429.0>, pid: #PID<0.440.0>, ref: #Reference<0.325499796.1928331266.223153>}, 60000)
    ** (EXIT) time out
    (elixir) lib/task.ex:577: Task.await/2
    test/support/dev_helpers.ex:83: OMG.Eth.DevHelpers.import_unlock_fund/2
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
    (stdlib) erl_eval.erl:449: :erl_eval.expr/5
    (stdlib) erl_eval.erl:126: :erl_eval.exprs/5
    (elixir) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
    (elixir) lib/task/supervised.ex:35: Task.Supervised.reply/5
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Function: #Function<20.128620087/0 in :erl_eval.expr/5>
    Args: []⋅
2019-09-03 09:35:23.264 [error] ⋅Task #PID<0.431.0> started from #PID<0.382.0> terminating
** (stop) exited in: Task.await(%Task{owner: #PID<0.431.0>, pid: #PID<0.439.0>, ref: #Reference<0.325499796.1928331266.223133>}, 60000)
    ** (EXIT) time out
    (elixir) lib/task.ex:577: Task.await/2
    test/support/dev_helpers.ex:83: OMG.Eth.DevHelpers.import_unlock_fund/2
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
    (stdlib) erl_eval.erl:449: :erl_eval.expr/5
    (stdlib) erl_eval.erl:126: :erl_eval.exprs/5
    (elixir) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
    (elixir) lib/task/supervised.ex:35: Task.Supervised.reply/5
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Function: #Function<20.128620087/0 in :erl_eval.expr/5>
    Args: []⋅
** (EXIT from #PID<0.382.0>) shell process exited with reason: exited in: Task.await(%Task{owner: #PID<0.431.0>, pid: #PID<0.439.0>, ref: #Reference<0.325499796.1928331266.223133>}, 60000)
    ** (EXIT) time out
pdobacz commented 4 years ago

seems like it has been resolved in #929 and also the perf test has since then undergone a revamp so closing. Also the dedicated perf test team will tackle this now more end-to-end, so I think no need to track this.