Normandy.Test.MemoryStoreContract
(normandy v2.2.0)
View Source
The ExUnit tests every Normandy.Behaviours.MemoryStore implementation must pass.
Normandy runs them against its own five backends; run them against yours.
defmodule MyApp.MemoryStoreTest do
use ExUnit.Case, async: true
use Normandy.Test.MemoryStoreContract,
impl: MyApp.MemoryStore,
new: {MyApp.MemoryStore, :new, [[url: "..."]]}
endOptions, checked when the test module compiles (a bad one raises ArgumentError):
:impl(atom/0) - Required. The module implementingNormandy.Behaviours.MemoryStore.:new-{module, function, args}returning a handle, called once per test. Default:{impl, :new, []}.
Each test writes under its own namespace ("contract-<unique integer>"), so handles may
share storage and the test module may be async: true, unless your backend keeps
node-global state that new resets (then async: false). The tests run real
concurrency (Tasks racing on one namespace, awaited for up to 15 s), drive the
memory tool (Normandy.Tools.Memory) against the store, and fill a namespace past
Normandy.Behaviours.MemoryStore.list_limit/0.