Documentation
¶
Overview ¶
Package providertest provides conformance tests for memory provider implementations.
Provider implementations can use this package to verify they correctly implement the core.Provider interface with consistent behavior.
Basic usage:
func TestConformance(t *testing.T) {
store := kvsmemory.New()
p, _ := kvs.NewProvider(core.ProviderConfig{
Options: map[string]any{"store": store},
}, nil)
providertest.RunAll(t, providertest.Config{
Provider: p,
})
}
For providers requiring API credentials (like Twilio):
func TestConformance(t *testing.T) {
if os.Getenv("TWILIO_ACCOUNT_SID") == "" {
t.Skip("TWILIO_ACCOUNT_SID not set")
}
p, _ := NewProvider(core.ProviderConfig{}, nil)
providertest.RunAll(t, providertest.Config{
Provider: p,
SkipIntegration: false,
TenantID: "your-store-id",
SubjectID: "your-profile-id",
})
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunBehaviorTests ¶
RunBehaviorTests runs behavioral contract tests.
func RunCRUDTests ¶
RunCRUDTests runs CRUD operation tests.
func RunInterfaceTests ¶
RunInterfaceTests runs only interface compliance tests. These tests verify the provider correctly implements the interface contract.
func RunSearchTests ¶
RunSearchTests runs search and recall tests.
Types ¶
type Config ¶
type Config struct {
// Provider is the memory provider implementation to test.
Provider core.Provider
// Embedder is an optional embedder for testing semantic search.
// If nil, search tests will verify behavior without embeddings.
Embedder core.Embedder
// SkipIntegration skips tests that require real API calls.
// Set to true for local-only providers (memory, kvs, postgres).
SkipIntegration bool
// TenantID is the tenant ID to use for tests.
// Defaults to "test-tenant" if empty.
TenantID string
// SubjectID is the subject ID to use for tests.
// Defaults to "test-subject" if empty.
SubjectID string
// Timeout for individual test operations.
// Defaults to 30 seconds if zero.
Timeout time.Duration
}
Config configures the memory provider conformance test suite.
Click to show internal directories.
Click to hide internal directories.