Help us shape the future of Go! Take the 2026 Go Developer Survey

storetest

package
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package storetest is the conformance suite for agentsession.Store implementations. Every store in this repository runs it; a store elsewhere can too.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, opts Options)

Run exercises a store through the whole interface.

Types

type Options

type Options struct {
	// New returns a fresh, empty store.
	New func(t *testing.T) agentsession.Store
	// Reopen returns a second handle on the same underlying storage as
	// s, for stores that persist. It is nil for a store that does not.
	Reopen func(t *testing.T, s agentsession.Store) agentsession.Store
	// Second returns another writing store on the same storage as s,
	// open beside it, as another process's would be: one that is
	// refused a session s holds. It is nil for a store that is not
	// shared. The Read case uses it to show that Read takes no hold.
	Second func(t *testing.T, s agentsession.Store) agentsession.Store
	// ReadOnly returns a store on the same storage as s opened
	// read-only, as another process's would be. It is nil for a store
	// that has no read-only form; the Follow cases use Second then, and
	// skip the second-store case when that is nil too.
	ReadOnly func(t *testing.T, s agentsession.Store) agentsession.Store
	// Import takes a session file into s whole, for a store whose own
	// import is not reachable as an [agentsession.Importer], such as a
	// client of a server whose store has one: it imports into the store
	// behind it. It is nil for a store that implements Importer, which
	// the suite then uses, and for one with no import, for which the
	// cases that need a session taken whole skip.
	Import func(t *testing.T, s agentsession.Store, file []byte) error
	// Push pushes the session a file holds to s by exchange, from a store
	// of the hook's own that took the file as the record, and returns
	// what the push returned. It is nil for a store that receives no
	// push.
	Push func(t *testing.T, s agentsession.Store, file []byte) error
	// RedactedOnly returns a fresh, empty store set to hold only redacted
	// sessions, which Import and Push are given too. It is nil for a
	// store that cannot be set so.
	RedactedOnly func(t *testing.T) agentsession.Store
	// Lower closes s, rewrites the format the stored header of session
	// id names to format, as a writer of that earlier minor would have
	// left it, and returns a store on the same storage that reads it. It
	// is nil for a store that cannot; the EntryNoRaise case then skips.
	Lower func(t *testing.T, s agentsession.Store, id, format string) agentsession.Store
}

Options configure a run.

Jump to

Keyboard shortcuts

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