Normandy.Test.SessionRegistryContract (normandy v2.2.0)

View Source

The ExUnit tests every Normandy.Behaviours.SessionRegistry implementation must pass. Normandy runs them against Native, Horde and Redis; run them against yours.

defmodule MyApp.SessionRegistryTest do
  use ExUnit.Case, async: true
  use Normandy.Test.SessionRegistryContract, impl: MyApp.SessionRegistry
end

Options, checked when the test module compiles (a bad one raises ArgumentError):

Every test registers the fixed session id "s1", so each handle must start empty (its own namespace, or async: false and a reset in a setup before the use line). A registry may be eventually consistent: every check after a change polls whereis/2 every 10 ms for up to 3 s, and a process killed while registered must disappear within that time.