Ltix.Test.StorageAdapter (Ltix v0.2.0)

Copy Markdown View Source

In-memory StorageAdapter for tests.

Uses an Agent to store registrations, deployments, and nonces. Each test should start its own adapter via start_link/1 and register it with set_pid/1.

Manual usage

{:ok, pid} = Ltix.Test.StorageAdapter.start_link(
  platforms: [platform]
)
Ltix.Test.StorageAdapter.set_pid(pid)

Summary

Functions

Returns a specification to start this module under a supervisor.

Register the adapter PID in the calling process.

Start the storage adapter agent.

Return the key the adapter signs with.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

set_pid(pid)

Register the adapter PID in the calling process.

Processes the caller starts, such as tasks and LiveViews, use the same adapter.

start_link(opts \\ [])

Start the storage adapter agent.

Options

  • :platforms - list of Ltix.Test.Platform structs whose registration and deployment the adapter resolves (defaults to [])
  • :registrations - list of structs implementing Ltix.Registerable that have no deployment (defaults to [])

tool_jwk()

@spec tool_jwk() :: Ltix.JWK.t()

Return the key the adapter signs with.

The key is generated the first time it is needed, and signing works without starting the adapter.