agenttest

package
v0.4.0-rc.30 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package agenttest provides agent environments, platform mocks, and caller contexts for tests of agents built on agentsdk.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCaller

func WithCaller(ctx context.Context, user agentsdk.User, access agentsdk.Access) context.Context

WithCaller returns a context for an authenticated user with the given access. Identity does not determine access, so tests can model any valid combination.

func WithUser

func WithUser(ctx context.Context, user agentsdk.User) context.Context

WithUser returns a context for an authenticated user. It implies AccessUser.

Types

type Env

type Env struct {
	Agent *agentsdk.Agent
	// Airlock records calls made through the platform API.
	Airlock *MockAirlock
	// URL is the mock Airlock base URL.
	URL string
}

Env is a fully constructed test agent with its mock Airlock server.

func New

func New(t *testing.T, factory func() *agentsdk.Agent) *Env

New configures a mock Airlock and test database before invoking factory. TEST_DB_URL is used when explicitly supplied; otherwise New starts a throwaway pgvector container. agentsdk.New finds db/migrations from the enclosing Go module, then resets and applies them before it returns to the rest of factory, so dependency construction and registrations always see a clean, migrated schema.

type MockAirlock

type MockAirlock = mockairlock.Mock

MockAirlock is an in-process Airlock API used by agent tests.

func NewMockAirlock

func NewMockAirlock() (*MockAirlock, string)

NewMockAirlock creates a mock Airlock server and returns its base URL.

type MockRequest

type MockRequest = mockairlock.Request

MockRequest records a request made to the mock Airlock server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL