Documentation
¶
Overview ¶
Package test provides shared integration-test helpers for go-llm packages.
The harness in this package creates a disposable PostgreSQL container, bootstraps the minimal auth schema required by llmmanager, resolves provider-specific environment variables, exposes a go-pg/pkg/test-style Main/Conn lifecycle, and provides common helpers for runtime loops, bounded contexts, synthetic auth users, and provider/model setup.
Index ¶
- func AdminUser(conn *Conn) *auth.User
- func ConnectorURL(t *testing.T, name string) string
- func Context(t *testing.T) context.Context
- func CreateProvider(t *testing.T, insert schema.ProviderInsert, ...) *schema.Provider
- func DiscardLogger() *slog.Logger
- func IsUnreachable(err error) bool
- func Main(m *testing.M, conn *Conn, config ProviderConfig)
- func ModelName(t *testing.T, preferred string, ...) string
- func ModelNameMatching(t *testing.T, preferred string, ...) string
- func RunBackground(t *testing.T, run func(context.Context) error)
- func User(conn *Conn, groups ...string) *auth.User
- func WaitUntil(t *testing.T, duration time.Duration, condition func() bool, message string)
- type Conn
- type ProviderConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectorURL ¶
ConnectorURL creates a live in-process MCP server and returns its base URL.
func CreateProvider ¶
func CreateProvider( t *testing.T, insert schema.ProviderInsert, create func(context.Context, schema.ProviderInsert) (*schema.Provider, error), sync func(context.Context) ([]string, []string, error), ) *schema.Provider
CreateProvider persists and syncs a provider for an integration test.
func DiscardLogger ¶
DiscardLogger returns a logger that drops all output.
func IsUnreachable ¶
IsUnreachable reports transport-level connectivity failures for live-provider integration tests.
func ModelName ¶
func ModelName( t *testing.T, preferred string, list func(context.Context) (*schema.ModelList, error), ) string
ModelName returns the preferred model when available, otherwise the first model advertised by the provider.
func ModelNameMatching ¶
func ModelNameMatching( t *testing.T, preferred string, list func(context.Context) (*schema.ModelList, error), match func(schema.Model) bool, validate func(context.Context, string) error, ) string
ModelNameMatching returns the first model that matches the predicate and, when provided, passes validation. The preferred model is tried first.
func RunBackground ¶
RunBackground runs a cancelable integration-test loop and waits for it to exit during test cleanup.
Types ¶
type Conn ¶
type Conn struct {
pg.PoolConn
Config ProviderConfig
SetupSkipReason string
SkipReason string
// contains filtered or unexported fields
}
func (*Conn) ProviderInsert ¶
func (c *Conn) ProviderInsert() schema.ProviderInsert