diff options
author | Alex Auvolat <alex@adnab.me> | 2018-09-11 17:21:14 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2018-09-11 17:21:14 +0200 |
commit | 9695231c327e052c5d5bc61197cc8222599fb91a (patch) | |
tree | c0d0f247269729658ad354a32475f34fa7268ed1 /shard/test | |
parent | a033c82a3c656a8f53feb60b5b149680771ac247 (diff) | |
download | shard-9695231c327e052c5d5bc61197cc8222599fb91a.tar.gz shard-9695231c327e052c5d5bc61197cc8222599fb91a.zip |
Block store dependency management & caching (NOT TESTED)
Diffstat (limited to 'shard/test')
-rw-r--r-- | shard/test/conn_test.exs | 5 | ||||
-rw-r--r-- | shard/test/mst_test.exs | 20 | ||||
-rw-r--r-- | shard/test/test_helper.exs | 2 |
3 files changed, 4 insertions, 23 deletions
diff --git a/shard/test/conn_test.exs b/shard/test/conn_test.exs index 275f6dd..ae43d9d 100644 --- a/shard/test/conn_test.exs +++ b/shard/test/conn_test.exs @@ -6,10 +6,10 @@ defmodule ShardTest.Conn do require Salty.Sign.Ed25519, as: Sign test "crypto connection" do - {:ok, srv_pkey, srv_skey} = Sign.keypair + {srv_pkey, srv_skey} = Shard.Identity.get_keypair {:ok, sess_pkey, sess_skey} = Box.keypair {:ok, challenge} = Salty.Random.buf 32 - {:ok, socket} = :gen_tcp.connect {127,0,0,1}, 4044, [:binary, packet: 2, active: false] + {:ok, socket} = :gen_tcp.connect {127,0,0,1}, 4045, [:binary, packet: 2, active: false] hello = {srv_pkey, sess_pkey, challenge, 0} :gen_tcp.send(socket, :erlang.term_to_binary hello) @@ -50,6 +50,7 @@ defmodule ShardTest.Conn do receive do after 100 -> nil end end + @tag :skip test "connect to chat rooms" do {:ok, pid1} = DynamicSupervisor.start_child(Shard.DynamicSupervisor, {SApp.Chat, "test"}) {:ok, pid2} = DynamicSupervisor.start_child(Shard.DynamicSupervisor, {SApp.Chat, "other_test"}) diff --git a/shard/test/mst_test.exs b/shard/test/mst_test.exs index c1758ad..cf5a898 100644 --- a/shard/test/mst_test.exs +++ b/shard/test/mst_test.exs @@ -174,24 +174,4 @@ defmodule ShardTest.MST do assert MST.last(mg1, nil, 2000) == all_items end - test "merkle search tree 8: MST.merge callback" do - items1 = (for i <- 1..1000, do: i*2+40) - items2 = (for i <- 1..1000, do: i*3) - - y = Enum.reduce(items1, %MST{}, fn i, acc -> MST.insert(acc, i) end) - z = Enum.reduce(items2, %MST{}, fn i, acc -> MST.insert(acc, i) end) - - {:ok, cb_called} = Agent.start_link fn -> [] end - - cb = fn i, true -> Agent.update(cb_called, fn x -> [i | x] end) end - mg = MST.merge(y, z, cb) - - cb_vals = Agent.get cb_called, &(&1) - expected = MapSet.difference(MapSet.new(items2), MapSet.new(items1)) - |> MapSet.to_list - |> Enum.sort - |> Enum.reverse - assert expected == cb_vals - end - end diff --git a/shard/test/test_helper.exs b/shard/test/test_helper.exs index e5b6600..e6a4f8e 100644 --- a/shard/test/test_helper.exs +++ b/shard/test/test_helper.exs @@ -1,4 +1,4 @@ -ExUnit.start() +ExUnit.start(exclude: [:skip]) case :gen_tcp.connect('localhost', 4045, []) do {:ok, socket} -> |