Documentation
¶
Overview ¶
Package harnesstest is TEST SUPPORT over the released harness runtime: a real harness session store, a real rig with one loop, and a recording inference client that answers every turn. It exists so that Host's tests about what a launch does to a DURABLE CONVERSATION — create, release, restore — run against harness's own journal rather than a fake that can only agree with itself.
Nothing in a production path imports it. It names github.com/looprig/inference only because harness's loop.WithInference takes an inference.Client, which is the one seam a test must supply to run a turn without a model.
Index ¶
- func Backend(tb testing.TB) *storage.Composite
- func Compose(tb testing.TB, ledger, kv *storage.Composite) *storage.Composite
- func CountSessionStarted(tb testing.TB, store *harnessstore.Store, id uuid.UUID) int
- func Events(tb testing.TB, store *harnessstore.Store, id uuid.UUID) []event.Event
- func Rig(tb testing.TB, store *harnessstore.Store, llm inference.Client) *rig.Rig
- func Store(tb testing.TB, backend *storage.Composite, tenant sessionwire.TenantID) *harnessstore.Store
- type RecordingLLM
- type RigLauncher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Backend ¶
Backend is one in-memory storage composite. Tests that need two harness stores sharing a ledger but not a catalog build them from two Backends' parts with Compose.
func Compose ¶
Compose assembles a composite from another composite's ledger and a second one's KV, so a store opened over it reads one journal and a DIFFERENT catalog. Leases, blobs and the ordered index come from the ledger's side.
func CountSessionStarted ¶
CountSessionStarted counts the SessionStarted records filed under id. A conversation that was restored has exactly one; one that was silently restarted has two.
func Events ¶
Events replays every event filed under id, in order. A stream that cannot be opened is reported as a failure rather than as an empty history.
func Store ¶
func Store(tb testing.TB, backend *storage.Composite, tenant sessionwire.TenantID) *harnessstore.Store
Store opens a harness session store for one tenant over backend.
Types ¶
type RecordingLLM ¶
type RecordingLLM struct {
// contains filtered or unexported fields
}
RecordingLLM answers every turn with the text "ok" and records every request, so a test can read back the conversation a turn was run over.
func (*RecordingLLM) Requests ¶
func (l *RecordingLLM) Requests() []inference.Request
Requests returns every request recorded so far.
type RigLauncher ¶
type RigLauncher struct {
// contains filtered or unexported fields
}
RigLauncher launches a real rig's sessions under a caller-named identity.
func (RigLauncher) NewSessionUnder ¶
func (l RigLauncher) NewSessionUnder(ctx context.Context, id uuid.UUID) (session.SessionController, error)
NewSessionUnder launches a new session under id with rig.WithSessionID.