diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..94cf31b --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,33 @@ +# Elixir CircleCI 2.0 configuration file +# +# Check https://circleci.com/docs/2.0/language-elixir/ for more details +version: 2 +jobs: + build: + docker: + # specify the version here + - image: elixir:1.6 + + # Specify service dependencies here if necessary + # CircleCI maintains a library of pre-built images + # documented at https://circleci.com/docs/2.0/circleci-images/ + # - image: circleci/postgres:9.4 + + working_directory: ~/repo + steps: + - checkout + - run: + name: Install node@7.10.1 + command: | + set +e + touch $BASH_ENV + curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash + echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV + echo 'nvm install v7.10.1' >> $BASH_ENV + echo 'nvm alias default 7.10.1' >> $BASH_ENV + - run: node -v + - run: npm install -g testrpc + - run: mix deps.get + - run: mix ecto.create + - run: mix test diff --git a/test/eth/query_test.exs b/test/eth/query_test.exs index 40d0db4..7e17095 100644 --- a/test/eth/query_test.exs +++ b/test/eth/query_test.exs @@ -26,10 +26,7 @@ defmodule ETH.Query.Test do end test "syncing/0 works" do - result = ETH.syncing() - - assert result |> elem(0) == :ok - assert result |> elem(1) == false + assert ETH.syncing() == {:ok, false} end test "syncing!/0 works" do @@ -101,8 +98,6 @@ defmodule ETH.Query.Test do end test "get_block/1 by number works" do - Process.sleep(2) - target_result = ETH.get_block(2) target_block = target_result |> elem(1) @@ -134,7 +129,6 @@ defmodule ETH.Query.Test do end test "get_block/1 by hash works" do - Process.sleep(2) {:ok, first_block} = ETH.get_block(1) {:ok, second_block} = ETH.get_block(2) @@ -171,8 +165,6 @@ defmodule ETH.Query.Test do end test "get_block!/1 by number works" do - Process.sleep(2) - target_block = ETH.get_block!(2) assert target_block.number == 2 @@ -202,7 +194,6 @@ defmodule ETH.Query.Test do end test "get_block!/1 by hash works" do - Process.sleep(2) first_block = ETH.get_block!(1) second_block = ETH.get_block!(2) diff --git a/test/support/eth_client.exs b/test/support/eth_client.exs index d982e58..f093e7b 100644 --- a/test/support/eth_client.exs +++ b/test/support/eth_client.exs @@ -1,6 +1,6 @@ defmodule ETH.TestClient do def start do - Task.async(fn -> + spawn(fn -> "testrpc -b=1 -m=\" parent leopard beauty edit tilt what blast next huge need print advice evolve move explain govern grab raccoon gown gravity gloom walnut silver reopen\"" |> String.to_charlist |> :os.cmd()