fixed a lot for the tests and added extra tetts
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
defmodule PaxosTest do
|
||||
# The functions implement
|
||||
# the module specific testing logic
|
||||
defp init(name, participants, all \\ false) do
|
||||
def init(name, participants, all \\ false) do
|
||||
cpid = TestHarness.wait_to_register(:coord, :global.whereis_name(:coord))
|
||||
|
||||
try do
|
||||
@@ -24,15 +24,15 @@ defmodule PaxosTest do
|
||||
end
|
||||
end
|
||||
|
||||
defp kill_paxos(pid, name) do
|
||||
def kill_paxos(pid, name) do
|
||||
Process.exit(pid, :kill)
|
||||
:global.unregister_name(name)
|
||||
pid
|
||||
end
|
||||
|
||||
defp wait_for_decision(_, _, timeout) when timeout <= 0, do: {:none, :none}
|
||||
def wait_for_decision(_, _, timeout) when timeout <= 0, do: {:none, :none}
|
||||
|
||||
defp wait_for_decision(pid, inst, timeout) do
|
||||
def wait_for_decision(pid, inst, timeout) do
|
||||
Process.sleep(100)
|
||||
v = Paxos.get_decision(pid, inst, 1)
|
||||
|
||||
@@ -42,7 +42,7 @@ defmodule PaxosTest do
|
||||
end
|
||||
end
|
||||
|
||||
defp propose_until_commit(pid, inst, val) do
|
||||
def propose_until_commit(pid, inst, val) do
|
||||
status = Paxos.propose(pid, inst, val, 10000)
|
||||
|
||||
case status do
|
||||
@@ -365,7 +365,8 @@ defmodule PaxosTest do
|
||||
[new_leader | _] = spare
|
||||
|
||||
if name == leader do
|
||||
Paxos.propose(pid, 1, val, 10000)
|
||||
# Put the time out at 1000 since that is the window of my leader elector
|
||||
Paxos.propose(pid, 1, val, 1000)
|
||||
Process.sleep(Enum.random(1..5))
|
||||
Process.exit(pid, :kill)
|
||||
end
|
||||
@@ -423,7 +424,8 @@ defmodule PaxosTest do
|
||||
leader = (fn [h | _] -> h end).(participants)
|
||||
|
||||
if name == leader do
|
||||
Paxos.propose(pid, 1, val, 10000)
|
||||
# Put the time out at 1000 since that is the window of my leader elector
|
||||
Paxos.propose(pid, 1, val, 1000)
|
||||
Process.sleep(Enum.random(1..5))
|
||||
Process.exit(pid, :kill)
|
||||
end
|
||||
@@ -501,7 +503,8 @@ defmodule PaxosTest do
|
||||
# IO.puts "kill: leaders, followers = #{inspect leaders}, #{inspect followers}"
|
||||
|
||||
if name in leaders do
|
||||
Paxos.propose(pid, 1, val, 10000)
|
||||
# Put the time out at 1000 since that is the window of my leader elector
|
||||
Paxos.propose(pid, 1, val, 1000)
|
||||
Process.sleep(Enum.random(1..5))
|
||||
Process.exit(pid, :kill)
|
||||
end
|
||||
@@ -573,7 +576,8 @@ defmodule PaxosTest do
|
||||
IO.puts("kill: leaders, followers = #{inspect(leaders)}, #{inspect(followers)}")
|
||||
|
||||
if name in leaders do
|
||||
Paxos.propose(pid, 1, val, 10000)
|
||||
# Put the time out at 1000 since that is the window of my leader elector
|
||||
Paxos.propose(pid, 1, val, 1000)
|
||||
Process.sleep(Enum.random(1..5))
|
||||
Process.exit(pid, :kill)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user