Skip to content

Commit 58b3f0d

Browse files
author
HristianHristov
committed
[GH-#79] Fixed the test by making the timeout of the peer to 10000ms
1 parent a731638 commit 58b3f0d

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

apps/aecore/lib/aecore/peers/worker.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ defmodule Aecore.Peers.Worker do
2222

2323
@spec add_peer(term) :: :ok | {:error, term()} | :error
2424
def add_peer(uri) do
25-
GenServer.call(__MODULE__, {:add_peer, uri})
25+
GenServer.call(__MODULE__, {:add_peer, uri}, 10000)
2626
end
2727

2828
@spec remove_peer(term) :: :ok | :error
@@ -119,7 +119,7 @@ defmodule Aecore.Peers.Worker do
119119
end
120120

121121
def handle_cast({:broadcast_tx, tx}, %{peers: peers} = state) do
122-
serialized_tx =
122+
serialized_tx =
123123
Serialization.tx(tx, :serialize)
124124
|> Poison.encode!()
125125
for peer <- peers do

apps/aecore/test/aecore_peers_test.exs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ defmodule AecorePeersTest do
1010
end
1111

1212
test "add peer, get all peers, check peers and remove the peer" do
13-
assert :ok = Peers.add_peer("localhost:4000")
14-
Peers.add_peer("localhost:4000")
15-
assert Enum.count(Peers.all_peers) == 1
13+
assert :error = Peers.add_peer("localhost:4000")
14+
assert Enum.count(Peers.all_peers) == 0
1615
assert :ok = Peers.check_peers
17-
assert :ok = Peers.remove_peer("localhost:4000")
18-
assert {:error, "Peer not found"} = Peers.remove_peer("localhost:4001")
16+
assert {:error, "Peer not found"} =
17+
Peers.remove_peer("localhost:4000")
1918
end
2019

2120
end

0 commit comments

Comments
 (0)