Puck.Sandbox.Runtime.Adapters.Test (Puck v0.2.11)

Copy Markdown View Source

In-memory test adapter for Puck.Sandbox.Runtime.

Usage

setup do
  start_supervised!(Puck.Sandbox.Runtime.Adapters.Test)
  :ok
end

test "sandbox" do
  {:ok, sandbox} = Puck.Sandbox.Runtime.create({Puck.Sandbox.Runtime.Adapters.Test, %{}})
  {:ok, result} = Puck.Sandbox.Runtime.exec(sandbox, "echo hello")
end

Summary

Functions

Returns a specification to start this module under a supervisor.

Gets the config for a sandbox.

Gets the command execution history for a sandbox.

Sets a mock response for a specific command in a sandbox.

Starts the test adapter agent.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_config(sandbox_id, name \\ __MODULE__)

Gets the config for a sandbox.

get_exec_history(sandbox_id, name \\ __MODULE__)

Gets the command execution history for a sandbox.

set_exec_response(sandbox_id, command, response, name \\ __MODULE__)

Sets a mock response for a specific command in a sandbox.

start_link(opts \\ [])

Starts the test adapter agent.

Options

  • :name - The name to register the agent under. Defaults to __MODULE__. Use a unique name per test when running with async: true.