Skip to content

Commit

Permalink
Merge pull request #864 from omisego/806-fix_coverage_final
Browse files Browse the repository at this point in the history
Make coverage calculation encompass the entire umbrella app - tidied
  • Loading branch information
pdobacz committed Jul 24, 2019
2 parents 74c454c + af07d4a commit 117d556
Show file tree
Hide file tree
Showing 19 changed files with 55 additions and 35 deletions.
5 changes: 4 additions & 1 deletion apps/omg/config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ config :omg,
ethereum_events_check_interval_ms: 50,
coordinator_eth_height_check_interval_ms: 100,
client_monitor_interval_ms: 50,
environment: :test
environment: :test,
# an entry to fix a common reference path to the root directory of the umbrella project
# this is useful because `mix test` and `mix coveralls --umbrella` have different views on the root dir when testing
umbrella_root_dir: Path.join(__DIR__, "../../..")

config :omg, OMG.Utils.Tracer, env: "test"
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ defmodule OMG.DependencyConformance.SignatureTest do
DeferredConfig.populate(:omg_eth)
{:ok, exit_fn} = Eth.DevNode.start()

root_path = "../../"
root_path = Application.fetch_env!(:omg_eth, :umbrella_root_dir)
{:ok, [addr | _]} = Ethereumex.HttpClient.eth_accounts()
{:ok, _, signtest_addr} = Eth.Deployer.create_new(OMG.Eth.Eip712, root_path, Eth.Encoding.from_hex(addr))

Expand Down
7 changes: 4 additions & 3 deletions apps/omg/test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ExUnit.configure(exclude: [integration: true, property: true])
Application.ensure_all_started(:propcheck)
ExUnitFixtures.load_fixture_files("../**/test/**/**/fixtures.exs")
ExUnitFixtures.start()
ExUnit.configure(exclude: [integration: true, property: true, wrappers: true])
Application.ensure_all_started(:propcheck)
umbrella_root_dir = Application.fetch_env!(:omg, :umbrella_root_dir)
ExUnitFixtures.load_fixture_files(Path.join(umbrella_root_dir, "apps/*/test/**/fixtures.exs"))
ExUnit.start()
2 changes: 1 addition & 1 deletion apps/omg_child_chain/test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ExUnit.configure(exclude: [integration: true, property: true])
ExUnit.configure(exclude: [integration: true, property: true, wrappers: true])
Application.ensure_all_started(:propcheck)
ExUnitFixtures.start()
# loading all fixture files from the whole umbrella project
Expand Down
2 changes: 1 addition & 1 deletion apps/omg_child_chain_rpc/test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ExUnit.configure(exclude: [integration: true])
ExUnit.configure(exclude: [integration: true, property: true, wrappers: true])
ExUnitFixtures.start()
ExUnitFixtures.load_fixture_files()
ExUnit.start()
Expand Down
2 changes: 1 addition & 1 deletion apps/omg_db/test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ExUnit.configure(exclude: [wrappers: true])
ExUnit.configure(exclude: [integration: true, property: true, wrappers: true])
ExUnitFixtures.load_fixture_files()
ExUnit.start()
5 changes: 4 additions & 1 deletion apps/omg_eth/config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ config :ethereumex,
http_options: [recv_timeout: :infinity]

config :omg_eth,
exit_period_seconds: 22
exit_period_seconds: 22,
# an entry to fix a common reference path to the root directory of the umbrella project
# this is useful because `mix test` and `mix coveralls --umbrella` have different views on the root dir when testing
umbrella_root_dir: Path.join(__DIR__, "../../..")
4 changes: 2 additions & 2 deletions apps/omg_eth/test/fixtures.exs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ defmodule OMG.Eth.Fixtures do
deffixture contract(eth_node) do
:ok = eth_node

%{} = Eth.DevHelpers.prepare_env!(root_path: "../../")
%{} = Eth.DevHelpers.prepare_env!(root_path: Application.fetch_env!(:omg_eth, :umbrella_root_dir))
end

deffixture token(root_chain_contract_config) do
:ok = root_chain_contract_config

root_path = "../../"
root_path = Application.fetch_env!(:omg_eth, :umbrella_root_dir)
{:ok, [addr | _]} = Ethereumex.HttpClient.eth_accounts()

DeferredConfig.populate(:omg_eth)
Expand Down
2 changes: 1 addition & 1 deletion apps/omg_eth/test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ExUnit.configure(exclude: [wrappers: true])
ExUnit.configure(exclude: [integration: true, property: true, wrappers: true])
ExUnitFixtures.start()
ExUnitFixtures.load_fixture_files()
ExUnit.start()
2 changes: 1 addition & 1 deletion apps/omg_performance/test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ExUnit.configure(exclude: [integration: true])
ExUnit.configure(exclude: [integration: true, property: true, wrappers: true])
ExUnitFixtures.start()
ExUnit.start()
2 changes: 1 addition & 1 deletion apps/omg_status/test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.

Application.ensure_all_started(:omg_status)
ExUnit.configure(exclude: [integration: true, property: true])
ExUnit.configure(exclude: [integration: true, property: true, wrappers: true])
ExUnit.start()
5 changes: 4 additions & 1 deletion apps/omg_watcher/config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ config :omg_watcher,
block_getter_loops_interval_ms: 50,
# NOTE: must be here - one of our integration tests actually fakes block withholding to test something
maximum_block_withholding_time_ms: 1_000,
exit_finality_margin: 1
exit_finality_margin: 1,
# an entry to fix a common reference path to the root directory of the umbrella project
# this is useful because `mix test` and `mix coveralls --umbrella` have different views on the root dir when testing
umbrella_root_dir: Path.join(__DIR__, "../../..")

config :omg_watcher, environment: :test
7 changes: 0 additions & 7 deletions apps/omg_watcher/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ defmodule OMG.Watcher.Mixfile do
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
test_coverage: [tool: ExCoveralls]
]
Expand Down Expand Up @@ -50,10 +49,4 @@ defmodule OMG.Watcher.Mixfile do
{:omg_child_chain, in_umbrella: true, only: [:test], runtime: false}
]
end

defp aliases do
[
test: ["ecto.create --quiet", "ecto.migrate", "test"]
]
end
end
2 changes: 1 addition & 1 deletion apps/omg_watcher/test/fixtures.exs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ defmodule OMG.Watcher.Fixtures do

exexec_opts_for_mix = [
stdout: :stream,
cd: "../..",
cd: Application.fetch_env!(:omg_watcher, :umbrella_root_dir),
env: %{"MIX_ENV" => to_string(Mix.env())},
# group 0 will create a new process group, equal to the OS pid of that process
group: 0,
Expand Down
5 changes: 4 additions & 1 deletion apps/omg_watcher/test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ExUnit.configure(exclude: [integration: true])
ExUnit.configure(exclude: [integration: true, property: true, wrappers: true])
ExUnitFixtures.start()
ExUnit.start()

{:ok, _} = Application.ensure_all_started(:httpoison)
{:ok, _} = Application.ensure_all_started(:fake_server)

Mix.Task.run("ecto.create", ~w(--quiet))
Mix.Task.run("ecto.migrate", ~w(--quiet))
7 changes: 0 additions & 7 deletions apps/omg_watcher_rpc/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ defmodule OMG.WatcherRPC.Mixfile do
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
test_coverage: [tool: ExCoveralls]
]
Expand Down Expand Up @@ -43,10 +42,4 @@ defmodule OMG.WatcherRPC.Mixfile do
{:omg_watcher, in_umbrella: true}
]
end

defp aliases do
[
test: ["ecto.create --quiet", "ecto.migrate", "test"]
]
end
end
5 changes: 4 additions & 1 deletion apps/omg_watcher_rpc/test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ExUnit.configure(exclude: [integration: true])
ExUnit.configure(exclude: [integration: true, property: true, wrappers: true])
ExUnitFixtures.start()
ExUnit.start()

{:ok, _} = Application.ensure_all_started(:httpoison)
{:ok, _} = Application.ensure_all_started(:fake_server)

Mix.Task.run("ecto.create", ~w(--quiet))
Mix.Task.run("ecto.migrate", ~w(--quiet))
18 changes: 17 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ defmodule OMG.Umbrella.MixProject do

def project do
[
# name the ap for the sake of `mix coveralls --umbrella`
# see https://github.com/parroty/excoveralls/issues/23#issuecomment-339379061
app: :omg_umbrella,
apps_path: "apps",
start_permanent: Mix.env() == :prod,
deps: deps(),
Expand All @@ -17,18 +20,30 @@ defmodule OMG.Umbrella.MixProject do
],
dialyzer: dialyzer(),
test_coverage: [tool: ExCoveralls],
# gets all apps test folders for the sake of `mix coveralls --umbrella`
test_paths: test_paths(),
aliases: aliases(),
# Docs
source_url: "https://github.com/omisego/elixir-omg"
]
end

defp test_paths do
"apps/*/test" |> Path.wildcard() |> Enum.sort()
end

defp deps do
[
{:distillery, "~> 2.0", runtime: false},
{:dialyxir, "~> 1.0.0-rc.6", only: [:dev, :test], runtime: false},
{:credo, "~> 1.0.5", only: [:dev, :test], runtime: false},
{:excoveralls, "~> 0.11.1", only: [:test], runtime: false},
# https://github.com/xadhoom/excoveralls.git `52c6c8e5d7fe9abb814e5e3e546c863b9b2b41b7` rebased on `master`
# more or less around v0.11.1
{:excoveralls,
git: "https://github.com/omisego/excoveralls.git",
ref: "23b97648ff5ed7b19d75364233bbf3e5fcb407ad",
only: [:test],
runtime: false},
{:licensir, "~> 0.2.0", only: :dev, runtime: false},
{
:ex_unit_fixtures,
Expand All @@ -55,6 +70,7 @@ defmodule OMG.Umbrella.MixProject do
"coveralls.html": ["coveralls.html --no-start"],
"coveralls.detail": ["coveralls.detail --no-start"],
"coveralls.post": ["coveralls.post --no-start"],
"coveralls.circle": ["coveralls.circle --no-start"],
"ecto.setup": ["ecto.create", "ecto.migrate", "run apps/omg_watcher/priv/repo/seeds.exs"],
"ecto.reset": ["ecto.drop", "ecto.setup"]
]
Expand Down
6 changes: 4 additions & 2 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [:make], [], "hexpm"},
"credo": {:hex, :credo, "1.0.5", "fdea745579f8845315fe6a3b43e2f9f8866839cfbc8562bb72778e9fdaa94214", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
"db_connection": {:hex, :db_connection, "2.1.0", "122e2f62c4906bf2e49554f1e64db5030c19229aa40935f33088e7d543aa79d0", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm"},
"decimal": {:hex, :decimal, "1.7.0", "30d6b52c88541f9a66637359ddf85016df9eb266170d53105f02e4a67e00c5aa", [:mix], [], "hexpm"},
"decimal": {:hex, :decimal, "1.8.0", "ca462e0d885f09a1c5a342dbd7c1dcf27ea63548c65a65e67334f4b61803822e", [:mix], [], "hexpm"},
"decorator": {:hex, :decorator, "1.2.4", "31dfff6143d37f0b68d0bffb3b9f18ace14fea54d4f1b5e4f86ead6f00d9ff6e", [:mix], [], "hexpm"},
"deferred_config": {:hex, :deferred_config, "0.1.1", "ec912e9ee3c99b90a8d4bdec8fbd15309f4bd6729f30789e0ff6f595d06bbce5", [:mix], [], "hexpm"},
"dialyxir": {:hex, :dialyxir, "1.0.0-rc.6", "78e97d9c0ff1b5521dd68041193891aebebce52fc3b93463c0a6806874557d7d", [:mix], [{:erlex, "~> 0.2.1", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm"},
Expand All @@ -27,15 +27,17 @@
"ex_doc": {:hex, :ex_doc, "0.20.2", "1bd0dfb0304bade58beb77f20f21ee3558cc3c753743ae0ddbb0fd7ba2912331", [:mix], [{:earmark, "~> 1.3", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.10", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"},
"ex_rlp": {:hex, :ex_rlp, "0.5.2", "7f4ce7bd55e543c054ce6d49629b01e9833c3462e3d547952be89865f39f2c58", [:mix], [], "hexpm"},
"ex_unit_fixtures": {:git, "https://github.com/omisego/ex_unit_fixtures.git", "4a099c621dc70e0d65cb9619b38192e31ec5f504", [branch: "feature/require_files_not_load"]},
"excoveralls": {:hex, :excoveralls, "0.11.1", "dd677fbdd49114fdbdbf445540ec735808250d56b011077798316505064edb2c", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
"excoveralls": {:git, "https://github.com/omisego/excoveralls.git", "23b97648ff5ed7b19d75364233bbf3e5fcb407ad", [ref: "23b97648ff5ed7b19d75364233bbf3e5fcb407ad"]},
"exexec": {:git, "https://github.com/pthomalla/exexec.git", "213658a4ccb96d7a84ffddc642b2596c86acc5d0", [branch: "add_streams"]},
"exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm"},
"exleveldb": {:hex, :exleveldb, "0.14.0", "8e9353bbce38482d6971d254c6b98ceb50f3f179c94732b5d17db1be426fca18", [:mix], [{:eleveldb, "~> 2.2.20", [hex: :eleveldb, repo: "hexpm", optional: false]}], "hexpm"},
"exth_crypto": {:hex, :exth_crypto, "0.1.6", "8e636a9bcb75d8e32451be96e547a495121ed2178d078db294edb0f81f7cf2e8", [:mix], [{:binary, "~> 0.0.4", [hex: :binary, repo: "hexpm", optional: false]}, {:keccakf1600, "~> 2.0.0", [hex: :keccakf1600_orig, repo: "hexpm", optional: false]}, {:libsecp256k1, "~> 0.1.9", [hex: :libsecp256k1, repo: "hexpm", optional: false]}], "hexpm"},
"fake_server": {:hex, :fake_server, "1.5.0", "33680295eb7da4c91ac5357614e3a37b1891c828a525bb990c44cc5e9791dc68", [:mix], [{:cowboy, "~> 1.1", [hex: :cowboy, repo: "hexpm", optional: false]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"},
"hackney": {:hex, :hackney, "1.15.1", "9f8f471c844b8ce395f7b6d8398139e26ddca9ebc171a8b91342ee15a19963f4", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.4", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"},
"httpoison": {:hex, :httpoison, "1.4.0", "e0b3c2ad6fa573134e42194d13e925acfa8f89d138bc621ffb7b1989e6d22e73", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"},
"idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"},
"jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
"jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm"},
"keccakf1600": {:hex, :keccakf1600_orig, "2.0.0", "0a7217ddb3ee8220d449bbf7575ec39d4e967099f220a91e3dfca4dbaef91963", [:rebar3], [], "hexpm"},
"libsecp256k1": {:git, "https://github.com/InoMurko/libsecp256k1.git", "83d4c91b7b5ad79fdd3c020be8c57ff6e2212780", [ref: "83d4c91b7b5ad79fdd3c020be8c57ff6e2212780"]},
"libsecp256k1_source": {:git, "https://github.com/bitcoin-core/secp256k1.git", "d33352151699bd7598b868369dace092f7855740", [ref: "d33352151699bd7598b868369dace092f7855740"]},
Expand Down

0 comments on commit 117d556

Please sign in to comment.