Documentation
¶
Index ¶
- func AssertCommandFailure(t testing.TB, h *E2EHarness, args ...string) (stdout, stderr string, exitCode int)
- func AssertCommandSuccess(t testing.TB, h *E2EHarness, args ...string) (stdout, stderr string)
- func AssertContains(t testing.TB, output, expected string)
- func AssertEmpty(t testing.TB, output string, label string)
- func AssertEqual(t testing.TB, expected, actual any, label string)
- func AssertError(t testing.TB, err error, context string)
- func AssertErrorContains(t testing.TB, err error, expectedMsg string, context string)
- func AssertExitCode(t testing.TB, expected, actual int, stdout, stderr string)
- func AssertFalse(t testing.TB, condition bool, message string)
- func AssertFileExists(t testing.TB, h *E2EHarness, filename string)
- func AssertListLength(t testing.TB, list any, expectedLen int, label string)
- func AssertMapContains(t testing.TB, m map[string]any, key string, expectedValue any)
- func AssertMapHasKey(t testing.TB, m map[string]any, key string)
- func AssertNoError(t testing.TB, err error, context string)
- func AssertNotContains(t testing.TB, output, notExpected string)
- func AssertNotEmpty(t testing.TB, output string, label string)
- func AssertTrue(t testing.TB, condition bool, message string)
- func DumpDaemonLogs(t testing.TB, h *E2EHarness)
- func FormatError(context string, err error) string
- func LogOutput(t testing.TB, stdout, stderr string)
- func RetryUntilSuccess(t testing.TB, fn func() error, timeout, interval string) error
- type Cleanup
- func (c *Cleanup) CleanupAll()
- func (c *Cleanup) ClearGraph() error
- func (c *Cleanup) KillDaemonProcess() error
- func (c *Cleanup) Register(fn func() error)
- func (c *Cleanup) RemoveTestFiles() error
- func (c *Cleanup) Run()
- func (c *Cleanup) StopDaemon() error
- func (c *Cleanup) WaitForDaemonStop(timeout time.Duration) error
- type E2EHarness
- func (h *E2EHarness) AddMemoryFile(name, content string) error
- func (h *E2EHarness) CreateConfigWithEmbeddings(httpPort int, semantic SemanticProviderConfig, ...) error
- func (h *E2EHarness) CreateConfigWithSemanticProvider(httpPort int, semantic SemanticProviderConfig) error
- func (h *E2EHarness) EnableHTTPServer(port int) error
- func (h *E2EHarness) RunCommand(args ...string) (stdout, stderr string, exitCode int)
- func (h *E2EHarness) Setup() error
- func (h *E2EHarness) StartDaemon() error
- func (h *E2EHarness) StopDaemon() error
- func (h *E2EHarness) Teardown() error
- func (h *E2EHarness) WaitForHealthy(timeout time.Duration) error
- type EmbeddingsProviderConfig
- type GraphClient
- func (c *GraphClient) Clear(ctx context.Context) error
- func (c *GraphClient) Close() error
- func (c *GraphClient) Connect() error
- func (c *GraphClient) CountNodes(ctx context.Context, label string) (int, error)
- func (c *GraphClient) DropGraph(ctx context.Context) error
- func (c *GraphClient) FileExists(ctx context.Context, path string) (bool, error)
- func (c *GraphClient) GetFileTags(ctx context.Context, path string) ([]string, error)
- func (c *GraphClient) GetRelatedFiles(ctx context.Context, path string, limit int) ([]string, error)
- func (c *GraphClient) Query(ctx context.Context, query string) (falkordb.QueryResult, error)
- type HTTPClient
- func (c *HTTPClient) GetFact(id string) (map[string]any, error)
- func (c *HTTPClient) GetFactsIndex() (map[string]any, error)
- func (c *HTTPClient) GetFileMetadata(path string) (any, error)
- func (c *HTTPClient) GetIndex() (any, error)
- func (c *HTTPClient) GetIndexFiles() ([]map[string]any, error)
- func (c *HTTPClient) GetRelatedFiles(path string, limit int) (any, error)
- func (c *HTTPClient) Health() (map[string]any, error)
- func (c *HTTPClient) ListRecentFiles(days, limit int) (any, error)
- func (c *HTTPClient) QueryFiles(query, category, entity, tag, topic string, days, limit int) (map[string]any, error)
- func (c *HTTPClient) SearchEntities(entity string, maxResults int) (any, error)
- func (c *HTTPClient) SearchFiles(query string, maxResults int) (any, error)
- func (c *HTTPClient) SetPort(port int)
- func (c *HTTPClient) TriggerRebuild(force bool) error
- func (c *HTTPClient) WaitForHealthy(timeout time.Duration) error
- type MCPClient
- func (c *MCPClient) CallTool(name string, args any) (any, error)
- func (c *MCPClient) Close() error
- func (c *MCPClient) Initialize() (*protocol.InitializeResponse, error)
- func (c *MCPClient) ListResources() ([]protocol.Resource, error)
- func (c *MCPClient) ListTools() ([]protocol.Tool, error)
- func (c *MCPClient) ReadResource(uri string) (string, error)
- func (c *MCPClient) Shutdown() error
- type SemanticProviderConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertCommandFailure ¶
func AssertCommandFailure(t testing.TB, h *E2EHarness, args ...string) (stdout, stderr string, exitCode int)
AssertCommandFailure runs a command and asserts it fails
func AssertCommandSuccess ¶
func AssertCommandSuccess(t testing.TB, h *E2EHarness, args ...string) (stdout, stderr string)
AssertCommandSuccess runs a command and asserts it succeeds
func AssertContains ¶
AssertContains checks that output contains expected string
func AssertEmpty ¶
AssertEmpty checks that output is empty
func AssertEqual ¶
AssertEqual checks that two values are equal
func AssertError ¶
AssertError checks that an error occurred
func AssertErrorContains ¶
AssertErrorContains checks that an error occurred and contains expected message
func AssertExitCode ¶
AssertExitCode checks that a command exited with the expected code
func AssertFalse ¶
AssertFalse checks that a condition is false
func AssertFileExists ¶
func AssertFileExists(t testing.TB, h *E2EHarness, filename string)
AssertFileExists checks that a file exists in the harness memory directory
func AssertListLength ¶
AssertListLength checks that a list has the expected length
func AssertMapContains ¶
AssertMapContains checks that a map contains a key with expected value
func AssertMapHasKey ¶
AssertMapHasKey checks that a map contains a key
func AssertNoError ¶
AssertNoError checks that an error is nil
func AssertNotContains ¶
AssertNotContains checks that output does not contain a string
func AssertNotEmpty ¶
AssertNotEmpty checks that output is not empty
func AssertTrue ¶
AssertTrue checks that a condition is true
func DumpDaemonLogs ¶
func DumpDaemonLogs(t testing.TB, h *E2EHarness)
DumpDaemonLogs reads and logs the daemon log file for debugging
func FormatError ¶
FormatError formats an error with context for better test output
Types ¶
type Cleanup ¶
type Cleanup struct {
// contains filtered or unexported fields
}
Cleanup handles cleanup operations for E2E tests
func MustCleanup ¶
func MustCleanup(t testing.TB, h *E2EHarness) *Cleanup
MustCleanup creates a cleanup manager and registers it with t.Cleanup()
func NewCleanup ¶
func NewCleanup(t testing.TB, h *E2EHarness) *Cleanup
NewCleanup creates a new cleanup manager
func (*Cleanup) CleanupAll ¶
func (c *Cleanup) CleanupAll()
CleanupAll performs all cleanup operations
func (*Cleanup) ClearGraph ¶
ClearGraph clears all data from the test graph
func (*Cleanup) KillDaemonProcess ¶
KillDaemonProcess forcefully kills the daemon process (last resort)
func (*Cleanup) RemoveTestFiles ¶
RemoveTestFiles removes all test files from memory directory
func (*Cleanup) StopDaemon ¶
StopDaemon ensures the daemon is stopped
type E2EHarness ¶
type E2EHarness struct {
// Test environment paths
AppDir string
MemoryRoot string
ConfigPath string
PIDPath string
LogPath string
BinaryPath string
GraphName string // Unique graph name for test isolation
// Test clients
MCPClient *MCPClient
GraphClient *GraphClient
HTTPClient *HTTPClient
// contains filtered or unexported fields
}
E2EHarness provides a complete test environment for end-to-end tests
func (*E2EHarness) AddMemoryFile ¶
func (h *E2EHarness) AddMemoryFile(name, content string) error
AddMemoryFile creates a file in the memory directory
func (*E2EHarness) CreateConfigWithEmbeddings ¶ added in v0.14.0
func (h *E2EHarness) CreateConfigWithEmbeddings(httpPort int, semantic SemanticProviderConfig, embeddings EmbeddingsProviderConfig) error
CreateConfigWithEmbeddings creates a config file with specific embeddings settings
func (*E2EHarness) CreateConfigWithSemanticProvider ¶ added in v0.14.0
func (h *E2EHarness) CreateConfigWithSemanticProvider(httpPort int, semantic SemanticProviderConfig) error
CreateConfigWithSemanticProvider creates a config file with specific semantic provider settings
func (*E2EHarness) EnableHTTPServer ¶
func (h *E2EHarness) EnableHTTPServer(port int) error
EnableHTTPServer enables the HTTP server on the specified port
func (*E2EHarness) RunCommand ¶
func (h *E2EHarness) RunCommand(args ...string) (stdout, stderr string, exitCode int)
RunCommand runs the agentic-memorizer binary with the given arguments
func (*E2EHarness) Setup ¶
func (h *E2EHarness) Setup() error
Setup initializes the test environment
func (*E2EHarness) StartDaemon ¶
func (h *E2EHarness) StartDaemon() error
StartDaemon starts the daemon process
func (*E2EHarness) StopDaemon ¶
func (h *E2EHarness) StopDaemon() error
StopDaemon stops the daemon process
func (*E2EHarness) Teardown ¶
func (h *E2EHarness) Teardown() error
Teardown cleans up the test environment
func (*E2EHarness) WaitForHealthy ¶
func (h *E2EHarness) WaitForHealthy(timeout time.Duration) error
WaitForHealthy polls the health endpoint until daemon is ready
type EmbeddingsProviderConfig ¶ added in v0.14.0
type EmbeddingsProviderConfig struct {
Enabled bool
Provider string // "openai", "voyage", "gemini"
Model string
Dimensions int
APIKey string
}
EmbeddingsProviderConfig holds embeddings provider configuration for tests
type GraphClient ¶
type GraphClient struct {
// contains filtered or unexported fields
}
GraphClient provides a test client for FalkorDB operations
func NewGraphClient ¶
func NewGraphClient(host, port, graphName string) *GraphClient
NewGraphClient creates a new FalkorDB test client
func (*GraphClient) Clear ¶
func (c *GraphClient) Clear(ctx context.Context) error
Clear clears all data from the test graph
func (*GraphClient) Close ¶
func (c *GraphClient) Close() error
Close closes the FalkorDB connection
func (*GraphClient) Connect ¶
func (c *GraphClient) Connect() error
Connect establishes connection to FalkorDB
func (*GraphClient) CountNodes ¶
CountNodes counts nodes of a specific label
func (*GraphClient) DropGraph ¶
func (c *GraphClient) DropGraph(ctx context.Context) error
DropGraph completely drops the test graph (for test cleanup) Note: With unique graph names per test, simple Clear() is sufficient for cleanup
func (*GraphClient) FileExists ¶
FileExists checks if a file node exists in the graph
func (*GraphClient) GetFileTags ¶
GetFileTags retrieves tags for a specific file
func (*GraphClient) GetRelatedFiles ¶
func (c *GraphClient) GetRelatedFiles(ctx context.Context, path string, limit int) ([]string, error)
GetRelatedFiles finds files related to a given file via shared tags/topics
func (*GraphClient) Query ¶
func (c *GraphClient) Query(ctx context.Context, query string) (falkordb.QueryResult, error)
Query executes a Cypher query
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient provides a test client for the daemon's HTTP API
func NewHTTPClient ¶
func NewHTTPClient(host string, port int) *HTTPClient
NewHTTPClient creates a new HTTP test client
func (*HTTPClient) GetFact ¶ added in v0.14.0
func (c *HTTPClient) GetFact(id string) (map[string]any, error)
GetFact retrieves a specific fact by ID
func (*HTTPClient) GetFactsIndex ¶ added in v0.14.0
func (c *HTTPClient) GetFactsIndex() (map[string]any, error)
GetFactsIndex retrieves all facts from the graph
func (*HTTPClient) GetFileMetadata ¶
func (c *HTTPClient) GetFileMetadata(path string) (any, error)
GetFileMetadata retrieves metadata for a specific file
func (*HTTPClient) GetIndex ¶
func (c *HTTPClient) GetIndex() (any, error)
GetIndex retrieves the full index from the graph
func (*HTTPClient) GetIndexFiles ¶ added in v0.14.0
func (c *HTTPClient) GetIndexFiles() ([]map[string]any, error)
GetIndexFiles retrieves the files array from the index response The API returns {index: {files: [...]}} so this helper unwraps it
func (*HTTPClient) GetRelatedFiles ¶
func (c *HTTPClient) GetRelatedFiles(path string, limit int) (any, error)
GetRelatedFiles finds files related to a given file using the file metadata endpoint
func (*HTTPClient) Health ¶
func (c *HTTPClient) Health() (map[string]any, error)
Health checks the daemon health endpoint
func (*HTTPClient) ListRecentFiles ¶
func (c *HTTPClient) ListRecentFiles(days, limit int) (any, error)
ListRecentFiles lists recently modified files using the unified files endpoint
func (*HTTPClient) QueryFiles ¶ added in v0.14.0
func (c *HTTPClient) QueryFiles(query, category, entity, tag, topic string, days, limit int) (map[string]any, error)
QueryFiles performs a unified files query with optional filters
func (*HTTPClient) SearchEntities ¶
func (c *HTTPClient) SearchEntities(entity string, maxResults int) (any, error)
SearchEntities searches for files mentioning a specific entity using the unified files endpoint
func (*HTTPClient) SearchFiles ¶
func (c *HTTPClient) SearchFiles(query string, maxResults int) (any, error)
SearchFiles performs a semantic search using the unified files endpoint
func (*HTTPClient) SetPort ¶
func (c *HTTPClient) SetPort(port int)
SetPort updates the HTTP client's port
func (*HTTPClient) TriggerRebuild ¶
func (c *HTTPClient) TriggerRebuild(force bool) error
TriggerRebuild triggers a full index rebuild
func (*HTTPClient) WaitForHealthy ¶
func (c *HTTPClient) WaitForHealthy(timeout time.Duration) error
WaitForHealthy polls the health endpoint until it responds or times out
type MCPClient ¶
type MCPClient struct {
// contains filtered or unexported fields
}
MCPClient simulates an MCP client for testing the MCP server
func NewMCPClient ¶
NewMCPClient creates a new MCP client that communicates with the server via stdio
func (*MCPClient) Initialize ¶
func (c *MCPClient) Initialize() (*protocol.InitializeResponse, error)
Initialize sends the initialize request
func (*MCPClient) ListResources ¶
ListResources requests the list of available resources
func (*MCPClient) ReadResource ¶
ReadResource reads a specific resource by URI