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

sessionstoretest

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package sessionstoretest checks baseAgent.SessionStore implementations against the contract documented on baseAgent.SessionStore.

Call Run from a test in the store's package:

func TestConformance(t *testing.T) {
	sessionstoretest.Run(t, func(t *testing.T) baseAgent.SessionStore {
		return newTestStore(t)
	})
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, newStore func(t *testing.T) baseAgent.SessionStore)

Run checks the store returned by newStore against the SessionStore contract. newStore is called once per subtest. The store may share a database with other tests: every session uses fresh UUIDs, and listing tests filter on a metadata value unique to the subtest.

Types

type MemoryStore

type MemoryStore struct {
	// contains filtered or unexported fields
}

MemoryStore is an in-memory baseAgent.SessionStore. It keeps entries encoded with baseAgent.MarshalSessionEntry, as a database would, so it doubles as a reference implementation of the contract and a store for tests.

func NewMemoryStore

func NewMemoryStore() *MemoryStore

NewMemoryStore returns an empty MemoryStore.

func (*MemoryStore) AppendEntry

func (s *MemoryStore) AppendEntry(ctx context.Context, sessionID string, entry baseAgent.SessionEntry) error

func (*MemoryStore) CreateSession

func (s *MemoryStore) CreateSession(ctx context.Context, header baseAgent.SessionHeader, entries []baseAgent.SessionEntry) error

func (*MemoryStore) ListSessions

func (s *MemoryStore) ListSessions(ctx context.Context, query baseAgent.SessionQuery) ([]baseAgent.SessionInfo, error)

func (*MemoryStore) LoadSession

func (s *MemoryStore) LoadSession(ctx context.Context, sessionID string) (baseAgent.LoadedSession, error)

func (*MemoryStore) SetCurrentEntry

func (s *MemoryStore) SetCurrentEntry(ctx context.Context, sessionID string, expected, entryID *string) error

Jump to

Keyboard shortcuts

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