Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test cases #94

Merged
merged 16 commits into from
Sep 6, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/swarm/tracker/tracker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ defmodule Swarm.Tracker do
Clock.leq(rclock, lclock) ->
# The local version is dominant
:keep_state_and_data

:else ->
warn(
"received track event for #{inspect(name)}, but local clock conflicts with remote clock, event unhandled"
Expand Down
7 changes: 4 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ defmodule Swarm.Mixfile do
end

defp aliases() do
case System.get_env("SWARM_TEST_DEBUG") do
"true" -> [test: "test --no-start --trace"]
_ -> [test: "test --no-start"]
if System.get_env("SWARM_TEST_DEBUG") do
arjan marked this conversation as resolved.
Show resolved Hide resolved
[test: "test --no-start --trace"]
else
[test: "test --no-start"]
end
end

Expand Down
4 changes: 3 additions & 1 deletion test/tracker_replica_event_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ defmodule Swarm.TrackerReplicaEventTests do

setup do
:ets.delete_all_objects(:swarm_registry)

{:ok, pid} = MyApp.WorkerSup.register()
meta = %{mfa: {MyApp.WorkerSup, :register, []}}
name = :rand.uniform()
Expand Down Expand Up @@ -102,6 +103,7 @@ defmodule Swarm.TrackerReplicaEventTests do

test "handle_replica_event :track with conflicting pid and local clock dominates should ignore the event",
%{name: name, pid: pid, meta: meta, lclock: lclock, rclock: rclock} do

lclock = Clock.event(lclock)
send_replica_event(lclock, {:track, name, pid, meta})

Expand Down Expand Up @@ -206,7 +208,7 @@ defmodule Swarm.TrackerReplicaEventTests do

assert entry(name: _, pid: ^pid, ref: _, meta: ^meta, clock: _) = Registry.get_by_name(name)
end

test "handle_replica_event :update_meta when conflict should merge the meta data", %{
name: name,
pid: pid,
Expand Down
1 change: 1 addition & 0 deletions test/tracker_sync_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ defmodule Swarm.TrackerSyncTests do
end)

:rand.seed(:exs64)

{:ok, _} = MyApp.WorkerSup.start_link()
:ok
end
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.