testing

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertConcurrentResults

func AssertConcurrentResults(t *testing.T, results *ConcurrentTestResults, minSuccessRate float64, maxOpTime time.Duration)

AssertConcurrentResults validates concurrent test results

func AssertEventuallyTrue

func AssertEventuallyTrue(t *testing.T, timeout time.Duration, condition func() bool, msg string)

AssertEventuallyTrue waits for a condition to become true

func AssertFileExists

func AssertFileExists(t *testing.T, filePath string)

AssertFileExists asserts that a file exists

func AssertFileNotExists

func AssertFileNotExists(t *testing.T, filePath string)

AssertFileNotExists asserts that a file does not exist

func AssertIndexAvailability

func AssertIndexAvailability(t *testing.T, helper *IndexCoordinationTestHelper, expectedAvailability map[core.IndexType]bool)

AssertIndexAvailability asserts that specific indexes are available or unavailable

func AssertIndexingPerformance

func AssertIndexingPerformance(t *testing.T, name string, filesPerSecond int, fn func())

AssertIndexingPerformance validates indexing meets standard thresholds

func AssertMemoryBounds

func AssertMemoryBounds(t *testing.T, maxHeapMB int64, fn func())

AssertMemoryBounds validates memory usage

func AssertNeverTrue

func AssertNeverTrue(t *testing.T, duration time.Duration, condition func() bool, msg string)

AssertNeverTrue ensures a condition never becomes true within a timeout

func AssertResourceCleaned

func AssertResourceCleaned(t *testing.T, checkFunc func() bool, resourceName string)

AssertResourceCleaned verifies a resource was properly cleaned up

func AssertSearchPerformance

func AssertSearchPerformance(t *testing.T, name string, fn func())

AssertSearchPerformance validates search meets standard thresholds

func AssertSnapshot

func AssertSnapshot(t *testing.T, testName string, actual interface{})

AssertSnapshot compares or updates a snapshot based on mode

func AssertThroughput

func AssertThroughput(t *testing.T, minOpsPerSec float64, ops int, fn func())

AssertThroughput validates operation throughput

func CheckFileServiceCompliance

func CheckFileServiceCompliance(t *testing.T, rootDir string)

CheckFileServiceCompliance is a convenience function for testing

func CommonGitignorePatterns

func CommonGitignorePatterns() []string

CommonGitignorePatterns returns commonly used gitignore patterns for testing

func CompareBinarySnapshots

func CompareBinarySnapshots(snap1, snap2 *BinarySnapshot) bool

CompareBinarySnapshots compares two binary snapshots for equality

func CompareSearchBehaviorSnapshots

func CompareSearchBehaviorSnapshots(t *testing.T, expected, actual *SearchBehaviorSnapshot)

CompareSearchBehaviorSnapshots compares two search behavior snapshots

func CompareSearchPerformanceSnapshots

func CompareSearchPerformanceSnapshots(t *testing.T, expected, actual *SearchPerformanceSnapshot)

CompareSearchPerformanceSnapshots compares two search performance snapshots

func CompareSnapshots

func CompareSnapshots(t *testing.T, expected, actual *ProjectSnapshot)

CompareSnapshots compares two snapshots and reports differences

func CreateTempDir

func CreateTempDir(t *testing.T) string

CreateTempDir creates a temporary directory for testing

func CreateTestDirectory

func CreateTestDirectory(basePath, dirPath string) error

CreateTestDirectory creates a test directory

func CreateTestFile

func CreateTestFile(basePath, filename, content string) error

CreateTestFile creates a test file with the given content

func DetectRaceCondition

func DetectRaceCondition(t *testing.T, concurrentOps int, operation func(id int))

DetectRaceCondition attempts to trigger race conditions

func GenerateBoundaryValues

func GenerateBoundaryValues(boundary int) []int

GenerateBoundaryValues generates test values around a boundary

func GoProjectFiles

func GoProjectFiles() map[string]string

GoProjectFiles returns a map of common Go project files

func NodeProjectFiles

func NodeProjectFiles() map[string]string

NodeProjectFiles returns a map of common Node.js project files

func RetryTimingAssertion

func RetryTimingAssertion(t *testing.T, maxRetries int, testFn func() (time.Duration, error), threshold time.Duration, description string) bool

RetryTimingAssertion implements stampede prevention by retrying timing-sensitive assertions This handles transient system load that can cause timing tests to fail spuriously.

Parameters:

  • t: testing.T instance
  • maxRetries: number of retry attempts (minimum 1 for stampede prevention)
  • testFn: function that performs the timed operation and returns (duration, error)
  • threshold: maximum acceptable duration
  • description: description of what's being timed

Returns true if the assertion passed, false otherwise

func RetryTimingAssertionWithSetup

func RetryTimingAssertionWithSetup(t *testing.T, maxRetries int, setupFn func() error, testFn func() (time.Duration, error), threshold time.Duration, description string) bool

RetryTimingAssertionWithSetup is like RetryTimingAssertion but allows setup before each retry

Parameters:

  • t: testing.T instance
  • maxRetries: number of retry attempts (minimum 1 for stampede prevention)
  • setupFn: function called before each attempt (for resetting state)
  • testFn: function that performs the timed operation and returns (duration, error)
  • threshold: maximum acceptable duration
  • description: description of what's being timed

func RunBoundaryValueTests

func RunBoundaryValueTests(t *testing.T, cases []BoundaryValueTestCase)

RunBoundaryValueTests runs tests for boundary conditions

func RunCoordinationBenchmark

func RunCoordinationBenchmark(b *testing.B, scenario ConcurrentTestScenario)

RunCoordinationBenchmark runs a coordination benchmark with the given scenario

func RunEdgeCaseScenarios

func RunEdgeCaseScenarios(t *testing.T, scenarios []EdgeCaseScenario)

RunEdgeCaseScenarios runs a suite of edge case scenarios

func RunInputValidationTests

func RunInputValidationTests(t *testing.T, cases []InputValidationTestCase)

RunInputValidationTests runs a suite of input validation tests

func RunRecoveryScenario

func RunRecoveryScenario(t *testing.T, scenario RecoveryScenario)

RunRecoveryScenario tests error recovery

func RunTimeoutScenario

func RunTimeoutScenario(t *testing.T, scenario TimeoutScenario) error

RunTimeoutScenario runs an operation with a timeout

func RunWithMemoryPressure

func RunWithMemoryPressure(t *testing.T, allocMB int, op func(t *testing.T))

RunWithMemoryPressure runs an operation while allocating memory

func SaveSnapshot

func SaveSnapshot(testName string, snapshot *ProjectSnapshot) error

SaveSnapshot saves a snapshot to disk

func SetupProjectWithGitignore

func SetupProjectWithGitignore(t *testing.T, files map[string]string, gitignorePatterns []string) string

SetupProjectWithGitignore creates a test project with gitignore patterns

func SnapshotPath

func SnapshotPath(testName string) string

SnapshotPath returns the path for a snapshot file

func TestNilSafety

func TestNilSafety(t *testing.T, funcs map[string]func() error)

TestNilSafety tests that functions handle nil inputs gracefully

func ValidateEnhancedReferences

func ValidateEnhancedReferences(t *testing.T, engine *search.Engine, fileIDs []types.FileID, expectations []ReferenceExpectation)

ValidateEnhancedReferences validates reference counts for enhanced search results

func ValidateSearchDisplaysReferences

func ValidateSearchDisplaysReferences(t *testing.T, engine *search.Engine, fileIDs []types.FileID, symbolName string)

ValidateSearchDisplaysReferences checks that basic search includes reference info

func ValidateSnapshotIntegrity

func ValidateSnapshotIntegrity(snap *BinarySnapshot) error

ValidateSnapshotIntegrity performs comprehensive validation of snapshot data

func WaitForIndexState

func WaitForIndexState(t *testing.T, helper *IndexCoordinationTestHelper, indexType core.IndexType, isIndexing bool, timeout time.Duration) error

WaitForIndexState waits for an index to reach a specific state

func WriteBinarySnapshot

func WriteBinarySnapshot(w io.Writer, snap *BinarySnapshot) error

WriteBinarySnapshot writes a snapshot to a writer

Types

type BinarySnapshot

type BinarySnapshot struct {
	Checksum [32]byte
	Data     []byte
}

BinarySnapshot represents a binary serialization of index state

func ReadBinarySnapshot

func ReadBinarySnapshot(r io.Reader) (*BinarySnapshot, error)

ReadBinarySnapshot reads a snapshot from a reader

func SnapshotTrigramIndexData

func SnapshotTrigramIndexData(fileCount int, trigramData map[uint64][]LocationSnapshot) (*BinarySnapshot, error)

SnapshotTrigramIndexData creates a binary snapshot from trigram data

type BoundaryValueTestCase

type BoundaryValueTestCase struct {
	Name        string
	Value       int
	LowerBound  int
	UpperBound  int
	TestFunc    func(value int) error
	ExpectValid bool
}

BoundaryValueTestCase represents a test case for boundary values

type CacheMetrics

type CacheMetrics struct {
	HitCount int64
	HitRate  float64
}

CacheMetrics represents cache metrics

type ConcurrentEdgeCases

type ConcurrentEdgeCases struct {
	sync.Mutex
	Operations []string
}

ConcurrentEdgeCases provides test scenarios for concurrency edge conditions

func NewConcurrentEdgeCases

func NewConcurrentEdgeCases() *ConcurrentEdgeCases

NewConcurrentEdgeCases creates concurrent edge case scenarios

func (*ConcurrentEdgeCases) RecordOperation

func (c *ConcurrentEdgeCases) RecordOperation(op string)

RecordOperation records an operation with thread safety

func (*ConcurrentEdgeCases) RunConcurrentOperations

func (c *ConcurrentEdgeCases) RunConcurrentOperations(t *testing.T, ops []func(), timeout time.Duration) error

RunConcurrentOperations runs operations concurrently and records them

type ConcurrentTestResults

type ConcurrentTestResults struct {
	Results       []TestResult
	TotalOps      int64
	SuccessfulOps int64
	FailedOps     int64
	TotalDuration time.Duration
	AverageOpTime time.Duration
	MinOpTime     time.Duration
	MaxOpTime     time.Duration
	ConcurrentOps int64
	// contains filtered or unexported fields
}

ConcurrentTestResults represents the aggregated results of a concurrent test

func RunConcurrentTest

func RunConcurrentTest(t *testing.T, scenario ConcurrentTestScenario) *ConcurrentTestResults

RunConcurrentTest executes a concurrent test scenario

type ConcurrentTestScenario

type ConcurrentTestScenario struct {
	Name                   string
	NumGoroutines          int
	OperationsPerGoroutine int
	OperationFunc          func(ctx context.Context, goroutineID, opID int) error
	ExpectedResults        []TestResult
	Timeout                time.Duration
}

ConcurrentTestScenario represents a concurrent testing scenario

func CreateConcurrentSearchScenario

func CreateConcurrentSearchScenario() ConcurrentTestScenario

CreateConcurrentSearchScenario creates a scenario that tests concurrent searches

func CreateIndexUpdateScenario

func CreateIndexUpdateScenario() ConcurrentTestScenario

CreateIndexUpdateScenario creates a scenario that tests concurrent index updates

func CreateLockContentionScenario

func CreateLockContentionScenario(indexType core.IndexType) ConcurrentTestScenario

CreateLockContentionScenario creates a scenario that tests lock contention

type CoordinationEfficiency

type CoordinationEfficiency struct {
	OverallEfficiency   float64
	LockEfficiency      float64
	ResourceUtilization float64
}

CoordinationEfficiency represents efficiency metrics

type CoordinationMetrics

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

CoordinationMetrics represents coordination metrics for testing

func (*CoordinationMetrics) GetCoordinationMetrics

func (m *CoordinationMetrics) GetCoordinationMetrics() *CoordinationMetricsData

GetCoordinationMetrics returns the coordination metrics data

func (*CoordinationMetrics) IsCollecting

func (m *CoordinationMetrics) IsCollecting() bool

IsCollecting returns whether metrics are being collected

func (*CoordinationMetrics) Reset

func (m *CoordinationMetrics) Reset()

Reset resets the metrics

type CoordinationMetricsData

type CoordinationMetricsData struct {
	TotalOperations      int64
	SuccessfulOperations int64
	LockAcquisitions     int64
	DependencyAnalyses   int64
	AverageSearchTime    time.Duration
	AverageLockWaitTime  time.Duration
}

CoordinationMetricsData represents the actual metrics data

func (*CoordinationMetricsData) CalculateEfficiency

func (m *CoordinationMetricsData) CalculateEfficiency() *CoordinationEfficiency

CalculateEfficiency calculates efficiency metrics

type DegradedSearchResult

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

DegradedSearchResult represents a search result with degraded capabilities

func (*DegradedSearchResult) FailedIndexCount

func (r *DegradedSearchResult) FailedIndexCount() int

FailedIndexCount returns the count of failed indexes (simplified)

func (*DegradedSearchResult) GetWarnings

func (r *DegradedSearchResult) GetWarnings() []string

GetWarnings returns any warnings about degraded capabilities

func (*DegradedSearchResult) HasReferences

func (r *DegradedSearchResult) HasReferences() bool

HasReferences returns whether the result has reference data

func (*DegradedSearchResult) HasTrigrams

func (r *DegradedSearchResult) HasTrigrams() bool

HasTrigrams returns whether the result has trigram data

func (*DegradedSearchResult) HealthyIndexCount

func (r *DegradedSearchResult) HealthyIndexCount() int

HealthyIndexCount returns the count of healthy indexes (simplified)

func (*DegradedSearchResult) IsDegraded

func (r *DegradedSearchResult) IsDegraded() bool

IsDegraded returns whether the result represents degraded capabilities

type DynamicLoadTestResults

type DynamicLoadTestResults struct {
	AdaptationCount int
	ResilienceScore float64
}

func RunDynamicLoadTest

func RunDynamicLoadTest(t *testing.T, helper *IndexCoordinationTestHelper, scenario *LoadTestScenario) *DynamicLoadTestResults

RunDynamicLoadTest runs a dynamic load test

type EdgeCaseScenario

type EdgeCaseScenario struct {
	Name        string
	Description string
	SetupFunc   func(t *testing.T) (cleanup func())
	TestFunc    func(t *testing.T)
	ExpectError bool
	ErrorMatch  string // Substring to match in error message
}

EdgeCaseScenario represents a test scenario for edge cases and error paths

type ErrorMode

type ErrorMode int

ErrorMode controls error injection behavior

const (
	ErrorNone ErrorMode = iota
	ErrorRandom
	ErrorSpecific
	ErrorBurst
)

type EventType

type EventType int

EventType represents the type of file event

const (
	EventCreate EventType = iota
	EventModify
	EventDelete
	EventMove
)

type ExhaustionTestResults

type ExhaustionTestResults struct {
	ExhaustionDetected bool
}

func RunExhaustionTest

func RunExhaustionTest(t *testing.T, helper *IndexCoordinationTestHelper, scenario *LoadTestScenario) *ExhaustionTestResults

RunExhaustionTest runs an exhaustion test

type FileEvent

type FileEvent struct {
	Type      EventType
	Path      string
	OldPath   string // For move events
	Timestamp time.Time
	Size      int64
}

FileEvent represents a file system event

type FileNotFoundError

type FileNotFoundError struct {
	Path string
}

FileNotFoundError represents a file not found error

func (*FileNotFoundError) Error

func (e *FileNotFoundError) Error() string

type FileServiceAdapter

type FileServiceAdapter struct {
	*MockFilesystem
}

FileServiceAdapter adapts MockFilesystem to core.FileService interface

func NewFileServiceAdapter

func NewFileServiceAdapter(mfs *MockFilesystem) *FileServiceAdapter

NewFileServiceAdapter creates a new adapter

func (*FileServiceAdapter) FileExists

func (fsa *FileServiceAdapter) FileExists(path string) bool

FileExists implements core.FileService interface

func (*FileServiceAdapter) GetModTime

func (fsa *FileServiceAdapter) GetModTime(path string) (int64, error)

GetModTime implements core.FileService interface

func (*FileServiceAdapter) GetSize

func (fsa *FileServiceAdapter) GetSize(path string) (int64, error)

GetSize implements core.FileService interface

func (*FileServiceAdapter) IsDirectory

func (fsa *FileServiceAdapter) IsDirectory(path string) bool

IsDirectory implements core.FileService interface

func (*FileServiceAdapter) ReadFile

func (fsa *FileServiceAdapter) ReadFile(path string) ([]byte, error)

ReadFile implements core.FileService interface

type FileServiceComplianceChecker

type FileServiceComplianceChecker struct {
	AllowedPackages   []string
	ForbiddenPatterns []*regexp.Regexp
	Exceptions        map[string]bool // file paths that are allowed to violate rules
	Violations        []Violation
	IgnoreTestFiles   bool
	IgnoreToolFiles   bool
	// contains filtered or unexported fields
}

FileServiceComplianceChecker validates that FileService abstraction is respected

func NewFileServiceComplianceChecker

func NewFileServiceComplianceChecker() *FileServiceComplianceChecker

NewFileServiceComplianceChecker creates a new compliance checker

func (*FileServiceComplianceChecker) AssertNoFailures

func (c *FileServiceComplianceChecker) AssertNoFailures(t *testing.T)

AssertNoFailures fails the test if any violations are found

func (*FileServiceComplianceChecker) CheckDirectory

func (c *FileServiceComplianceChecker) CheckDirectory(rootDir string) error

CheckDirectory checks all Go files in a directory for FileService compliance

func (*FileServiceComplianceChecker) CheckFile

func (c *FileServiceComplianceChecker) CheckFile(filePath string) ([]Violation, error)

CheckFile checks a single Go file for FileService compliance violations

func (*FileServiceComplianceChecker) ClearCache

func (c *FileServiceComplianceChecker) ClearCache()

ClearCache clears the file content cache to free memory

func (*FileServiceComplianceChecker) GetViolationCount

func (c *FileServiceComplianceChecker) GetViolationCount() (errors, warnings, total int)

GetViolationCount returns the total number of violations by severity

func (*FileServiceComplianceChecker) HasErrors

func (c *FileServiceComplianceChecker) HasErrors() bool

HasErrors returns true if there are error-level violations

func (*FileServiceComplianceChecker) HasWarnings

func (c *FileServiceComplianceChecker) HasWarnings() bool

HasWarnings returns true if there are warning-level violations

func (*FileServiceComplianceChecker) PrintViolations

func (c *FileServiceComplianceChecker) PrintViolations()

PrintViolations prints all found violations in a readable format

type FileSystemEdgeCases

type FileSystemEdgeCases struct {
	TempDir string
}

FileSystemEdgeCases provides test scenarios for file system edge conditions

func NewFileSystemEdgeCases

func NewFileSystemEdgeCases(t *testing.T) *FileSystemEdgeCases

NewFileSystemEdgeCases creates edge case scenarios in a temp directory

func (*FileSystemEdgeCases) BinaryFile

func (e *FileSystemEdgeCases) BinaryFile(t *testing.T) string

BinaryFile creates a binary file

func (*FileSystemEdgeCases) DeepDirectory

func (e *FileSystemEdgeCases) DeepDirectory(t *testing.T, depth int) string

DeepDirectory creates deeply nested directories

func (*FileSystemEdgeCases) EmptyFile

func (e *FileSystemEdgeCases) EmptyFile(t *testing.T) string

EmptyFile creates an empty file for testing

func (*FileSystemEdgeCases) FileWithLongLines

func (e *FileSystemEdgeCases) FileWithLongLines(t *testing.T, lineLength int) string

FileWithLongLines creates a file with very long lines

func (*FileSystemEdgeCases) FileWithManyLines

func (e *FileSystemEdgeCases) FileWithManyLines(t *testing.T, lineCount int) string

FileWithManyLines creates a file with many lines

func (*FileSystemEdgeCases) FileWithNullBytes

func (e *FileSystemEdgeCases) FileWithNullBytes(t *testing.T) string

FileWithNullBytes creates a file containing null bytes

func (*FileSystemEdgeCases) LargeFile

func (e *FileSystemEdgeCases) LargeFile(t *testing.T, sizeBytes int) string

LargeFile creates a file larger than typical limits

func (*FileSystemEdgeCases) ReadOnlyFile

func (e *FileSystemEdgeCases) ReadOnlyFile(t *testing.T) string

ReadOnlyFile creates a read-only file

func (e *FileSystemEdgeCases) SymbolicLink(t *testing.T, target string) string

SymbolicLink creates a symlink (if supported by the OS)

type GoProjectGenerator

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

GoProjectGenerator creates Go test projects

func NewGoProjectGenerator

func NewGoProjectGenerator(gitignorePatterns ...string) *GoProjectGenerator

NewGoProjectGenerator creates a new Go project generator

func (*GoProjectGenerator) CreateProject

func (gen *GoProjectGenerator) CreateProject(basePath string)

CreateProject creates a Go project structure

func (*GoProjectGenerator) GetProjectConfig

func (gen *GoProjectGenerator) GetProjectConfig() *config.Config

GetProjectConfig returns the project configuration

type HighLoadTestResults

type HighLoadTestResults struct {
	CompletedIndexingOps int
	CompletedSearchOps   int
}

func RunHighLoadTest

func RunHighLoadTest(t *testing.T, helper *IndexCoordinationTestHelper, scenario *LoadTestScenario) *HighLoadTestResults

RunHighLoadTest runs a high load test

type IndexCoordinationTestHelper

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

IndexCoordinationTestHelper provides utilities for testing index coordination

func NewIndexCoordinationTestHelper

func NewIndexCoordinationTestHelper() *IndexCoordinationTestHelper

NewIndexCoordinationTestHelper creates a new test helper for index coordination

func (*IndexCoordinationTestHelper) AcquireMultipleLocksCtx

func (h *IndexCoordinationTestHelper) AcquireMultipleLocksCtx(ctx context.Context, requirements core.SearchRequirements, isWrite bool) ([]core.LockRelease, error)

AcquireMultipleLocksCtx acquires multiple locks with context

func (*IndexCoordinationTestHelper) AnalyzeSearchDependencies

func (h *IndexCoordinationTestHelper) AnalyzeSearchDependencies(requirements core.SearchRequirements) ([]core.IndexType, error)

AnalyzeSearchDependencies analyzes search dependencies

func (*IndexCoordinationTestHelper) Cleanup

func (h *IndexCoordinationTestHelper) Cleanup()

Cleanup cleans up test resources

func (*IndexCoordinationTestHelper) GetCoordinationMetrics

func (h *IndexCoordinationTestHelper) GetCoordinationMetrics() *CoordinationMetrics

GetCoordinationMetrics returns coordination metrics

func (*IndexCoordinationTestHelper) GetDependencyCacheMetrics

func (h *IndexCoordinationTestHelper) GetDependencyCacheMetrics() *CacheMetrics

GetDependencyCacheMetrics returns cache metrics for testing

func (*IndexCoordinationTestHelper) GetRegistry

GetRegistry returns the index state registry

func (*IndexCoordinationTestHelper) GetResourceBalancer

func (h *IndexCoordinationTestHelper) GetResourceBalancer() *MockResourceBalancer

GetResourceBalancer returns the mock resource balancer

func (*IndexCoordinationTestHelper) GetResourcePoolManager

func (h *IndexCoordinationTestHelper) GetResourcePoolManager() *MockResourcePoolManager

GetResourcePoolManager returns the mock resource pool manager

func (*IndexCoordinationTestHelper) RecoverIndex

func (h *IndexCoordinationTestHelper) RecoverIndex(indexType core.IndexType)

RecoverIndex simulates index recovery

func (*IndexCoordinationTestHelper) ResolveSearchDependencies

func (h *IndexCoordinationTestHelper) ResolveSearchDependencies(requirements core.SearchRequirements) (map[core.IndexType]bool, error)

ResolveSearchDependencies resolves search dependencies

func (*IndexCoordinationTestHelper) ResolveTransitiveDependencies

func (h *IndexCoordinationTestHelper) ResolveTransitiveDependencies(requirements core.SearchRequirements) ([]core.IndexType, error)

ResolveTransitiveDependencies resolves transitive dependencies

func (*IndexCoordinationTestHelper) SetIndexAvailability

func (h *IndexCoordinationTestHelper) SetIndexAvailability(indexType core.IndexType, available bool)

SetIndexAvailability sets index availability for testing

func (*IndexCoordinationTestHelper) SimulateBackgroundLoad

func (h *IndexCoordinationTestHelper) SimulateBackgroundLoad(duration time.Duration)

SimulateBackgroundLoad simulates background load for testing

func (*IndexCoordinationTestHelper) SimulateHealthyIndex

func (h *IndexCoordinationTestHelper) SimulateHealthyIndex(indexType core.IndexType)

SimulateHealthyIndex simulates a healthy index state

func (*IndexCoordinationTestHelper) SimulateIncrementalSearch

func (h *IndexCoordinationTestHelper) SimulateIncrementalSearch(requirements core.SearchRequirements, timeout time.Duration) (*SearchResult, error)

SimulateIncrementalSearch simulates incremental search capabilities

func (*IndexCoordinationTestHelper) SimulateIndexFailure

func (h *IndexCoordinationTestHelper) SimulateIndexFailure(indexType core.IndexType, reason string)

SimulateIndexFailure simulates an index failure

func (*IndexCoordinationTestHelper) SimulateIndexing

func (h *IndexCoordinationTestHelper) SimulateIndexing(indexType core.IndexType, duration time.Duration) error

SimulateIndexing simulates an indexing operation on the specified index type

func (*IndexCoordinationTestHelper) SimulateIndexingState

func (h *IndexCoordinationTestHelper) SimulateIndexingState(indexType core.IndexType, isIndexing bool)

SimulateIndexingState simulates an indexing state for a specific index type

func (*IndexCoordinationTestHelper) SimulatePriorityOperation

func (h *IndexCoordinationTestHelper) SimulatePriorityOperation(priority core.OperationPriority, duration time.Duration) error

SimulatePriorityOperation simulates a priority-based operation

func (*IndexCoordinationTestHelper) SimulateSearch

func (h *IndexCoordinationTestHelper) SimulateSearch(requirements core.SearchRequirements, duration time.Duration) error

SimulateSearch simulates a search operation on the specified index types

func (*IndexCoordinationTestHelper) SimulateSearchWithAdaptiveTimeout

func (h *IndexCoordinationTestHelper) SimulateSearchWithAdaptiveTimeout(requirements core.SearchRequirements, baseTimeout time.Duration) (*SearchResult, error)

SimulateSearchWithAdaptiveTimeout simulates search with adaptive timeout

func (*IndexCoordinationTestHelper) SimulateSearchWithDegradation

func (h *IndexCoordinationTestHelper) SimulateSearchWithDegradation(requirements core.SearchRequirements, timeout time.Duration) (*DegradedSearchResult, error)

SimulateSearchWithDegradation simulates search with graceful degradation

func (*IndexCoordinationTestHelper) SimulateSearchWithDependencyAnalysis

func (h *IndexCoordinationTestHelper) SimulateSearchWithDependencyAnalysis(requirements core.SearchRequirements, timeout time.Duration) (*SearchResult, error)

SimulateSearchWithDependencyAnalysis simulates search with dependency analysis

func (*IndexCoordinationTestHelper) SimulateSearchWithFairSharing

func (h *IndexCoordinationTestHelper) SimulateSearchWithFairSharing(requirements core.SearchRequirements, duration time.Duration) error

SimulateSearchWithFairSharing simulates a search operation with fair sharing

func (*IndexCoordinationTestHelper) SimulateSearchWithResourceBalancing

func (h *IndexCoordinationTestHelper) SimulateSearchWithResourceBalancing(requirements core.SearchRequirements, timeout time.Duration) error

SimulateSearchWithResourceBalancing simulates search with resource balancing

func (*IndexCoordinationTestHelper) SimulateSearchWithRetry

func (h *IndexCoordinationTestHelper) SimulateSearchWithRetry(requirements core.SearchRequirements, timeout time.Duration, maxRetries int) (*SearchResult, error)

SimulateSearchWithRetry simulates search with retry capability

type InputValidationTestCase

type InputValidationTestCase struct {
	Name        string
	Input       interface{}
	Validator   func(interface{}) error
	ExpectValid bool
	ErrorMatch  string
}

InputValidationTestCase represents a test case for input validation

type IsolatedTestEnv

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

IsolatedTestEnv provides a real temporary directory with controlled gitignore for integration testing

func NewIsolatedTestEnv

func NewIsolatedTestEnv(t *testing.T, gitignorePatterns ...string) *IsolatedTestEnv

NewIsolatedTestEnv creates a temporary directory with controlled gitignore patterns

func NewIsolatedTestEnvWithConfig

func NewIsolatedTestEnvWithConfig(t *testing.T, cfg *config.Config) *IsolatedTestEnv

NewIsolatedTestEnvWithConfig creates a test environment with custom configuration

func (*IsolatedTestEnv) AddToGitignore

func (ite *IsolatedTestEnv) AddToGitignore(patterns ...string)

AddToGitignore appends patterns to the existing .gitignore file

func (*IsolatedTestEnv) AppendToFile

func (ite *IsolatedTestEnv) AppendToFile(path string, content string)

AppendToFile appends content to an existing file

func (*IsolatedTestEnv) Config

func (ite *IsolatedTestEnv) Config() *config.Config

Config returns the test configuration

func (*IsolatedTestEnv) CreateRealGoProject

func (ite *IsolatedTestEnv) CreateRealGoProject()

CreateRealGoProject creates a realistic Go project structure

func (*IsolatedTestEnv) CreateRealNodeProject

func (ite *IsolatedTestEnv) CreateRealNodeProject()

CreateRealNodeProject creates a realistic Node.js project structure

func (*IsolatedTestEnv) Exists

func (ite *IsolatedTestEnv) Exists(path string) bool

Exists checks if a file or directory exists

func (*IsolatedTestEnv) GetGitignore

func (ite *IsolatedTestEnv) GetGitignore() string

GetGitignore returns the current .gitignore content

func (*IsolatedTestEnv) ListFiles

func (ite *IsolatedTestEnv) ListFiles() []string

ListFiles returns a list of all files in the test environment (recursively)

func (*IsolatedTestEnv) MkdirAll

func (ite *IsolatedTestEnv) MkdirAll(path string)

MkdirAll creates a directory (and any necessary parents)

func (*IsolatedTestEnv) ReadFile

func (ite *IsolatedTestEnv) ReadFile(path string) string

ReadFile reads the content of a file

func (*IsolatedTestEnv) ReadFileBytes

func (ite *IsolatedTestEnv) ReadFileBytes(path string) []byte

ReadFileBytes reads binary content of a file

func (*IsolatedTestEnv) SetGitignore

func (ite *IsolatedTestEnv) SetGitignore(patterns ...string)

SetGitignore creates or updates the .gitignore file

func (*IsolatedTestEnv) TempDir

func (ite *IsolatedTestEnv) TempDir() string

TempDir returns the temporary directory path

func (*IsolatedTestEnv) WriteFile

func (ite *IsolatedTestEnv) WriteFile(path string, content string)

WriteFile creates a file in the test environment

func (*IsolatedTestEnv) WriteFileBytes

func (ite *IsolatedTestEnv) WriteFileBytes(path string, content []byte)

WriteFileBytes creates a file with binary content

type LatencyMode

type LatencyMode int

LatencyMode controls latency simulation

const (
	LatencyNone LatencyMode = iota
	LatencyRandom
	LatencyFixed
	LatencyBurst
)

type LoadTestResults

type LoadTestResults struct {
	CompletedIndexingOps int
	CompletedSearchOps   int
}

func RunLoadTest

func RunLoadTest(t *testing.T, helper *IndexCoordinationTestHelper, scenario *LoadTestScenario) *LoadTestResults

RunLoadTest runs a load test

type LoadTestScenario

type LoadTestScenario struct {
	IndexingOperations int
	SearchOperations   int
	Duration           time.Duration
}

Test scenarios for load testing

func CreateExtremeLoadScenario

func CreateExtremeLoadScenario() *LoadTestScenario

CreateExtremeLoadScenario creates an extreme load scenario

func CreateHighLoadScenario

func CreateHighLoadScenario() *LoadTestScenario

CreateHighLoadScenario creates a high load test scenario

func CreateLoadScenario

func CreateLoadScenario(indexingOps, searchOps int) *LoadTestScenario

CreateLoadScenario creates a load test scenario

func CreateRecoveryScenario

func CreateRecoveryScenario() *LoadTestScenario

CreateRecoveryScenario creates a recovery scenario

func CreateResourceExhaustionScenario

func CreateResourceExhaustionScenario() *LoadTestScenario

CreateResourceExhaustionScenario creates a resource exhaustion scenario

type LocationSnapshot

type LocationSnapshot struct {
	FileID types.FileID
	Offset uint32
}

LocationSnapshot represents a file location

type MemoryGuard

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

MemoryGuard monitors memory usage during tests

func NewMemoryGuard

func NewMemoryGuard(t *testing.T) *MemoryGuard

NewMemoryGuard creates a new memory guard

func (*MemoryGuard) AssertWithinBounds

func (g *MemoryGuard) AssertWithinBounds()

AssertWithinBounds fails the test if memory exceeds bounds

func (*MemoryGuard) Check

func (g *MemoryGuard) Check() error

Check verifies memory usage is within bounds

func (*MemoryGuard) Checkpoint

func (g *MemoryGuard) Checkpoint()

Checkpoint records current memory state

func (*MemoryGuard) GetMemoryGrowth

func (g *MemoryGuard) GetMemoryGrowth() int64

GetMemoryGrowth returns the memory growth between first and last checkpoint

func (*MemoryGuard) WithMaxAllocMB

func (g *MemoryGuard) WithMaxAllocMB(mb int64) *MemoryGuard

WithMaxAllocMB sets the maximum total allocations in MB

func (*MemoryGuard) WithMaxHeapMB

func (g *MemoryGuard) WithMaxHeapMB(mb int64) *MemoryGuard

WithMaxHeapMB sets the maximum heap size in MB

type MemoryPressureScenario

type MemoryPressureScenario struct {
	Name          string
	AllocateMB    int
	Operation     func(t *testing.T)
	ShouldSucceed bool
}

MemoryPressureScenario tests behavior under memory pressure

type MockFile

type MockFile struct {
	Path        string
	Content     []byte
	ModTime     time.Time
	Size        int64
	IsDirectory bool
	Exists      bool
	Version     int // Track file versions for change simulation
}

MockFile represents a file in the mock filesystem

type MockFilesystem

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

MockFilesystem simulates filesystem operations for stress testing

func NewMockFilesystem

func NewMockFilesystem() *MockFilesystem

NewMockFilesystem creates a new mock filesystem

func (*MockFilesystem) ClearHistory

func (mfs *MockFilesystem) ClearHistory()

ClearHistory clears operation and event history

func (*MockFilesystem) CreateFile

func (mfs *MockFilesystem) CreateFile(path string, content []byte) error

CreateFile creates a new file in the mock filesystem

func (*MockFilesystem) DeleteFile

func (mfs *MockFilesystem) DeleteFile(path string) error

DeleteFile deletes a file from the mock filesystem

func (*MockFilesystem) GetEventHistory

func (mfs *MockFilesystem) GetEventHistory() []FileEvent

GetEventHistory returns the history of file events

func (*MockFilesystem) GetOperationHistory

func (mfs *MockFilesystem) GetOperationHistory() []Operation

GetOperationHistory returns the history of operations

func (*MockFilesystem) ModifyFile

func (mfs *MockFilesystem) ModifyFile(path string, content []byte) error

ModifyFile modifies an existing file

func (*MockFilesystem) ReadFile

func (mfs *MockFilesystem) ReadFile(path string) ([]byte, error)

ReadFile reads a file from the mock filesystem

func (*MockFilesystem) SetChangeSpeed

func (mfs *MockFilesystem) SetChangeSpeed(speed time.Duration)

SetChangeSpeed sets the speed of file changes

func (*MockFilesystem) SetErrorMode

func (mfs *MockFilesystem) SetErrorMode(mode ErrorMode)

SetErrorMode configures error injection

func (*MockFilesystem) SetLatencyMode

func (mfs *MockFilesystem) SetLatencyMode(mode LatencyMode)

SetLatencyMode configures latency simulation

func (*MockFilesystem) StartCodeEvolver

func (mfs *MockFilesystem) StartCodeEvolver(path string, baseContent []byte, changes int, interval time.Duration) chan struct{}

StartCodeEvolver simulates realistic code changes

func (*MockFilesystem) StartRandomBitFlipper

func (mfs *MockFilesystem) StartRandomBitFlipper(path string, content []byte, flips int, interval time.Duration) chan struct{}

StartRandomBitFlipper simulates random single character changes

func (*MockFilesystem) StartSequentialWriter

func (mfs *MockFilesystem) StartSequentialWriter(path string, count int, interval time.Duration) chan struct{}

StartSequentialWriter simulates a process writing sequential values

type MockResourceBalancer

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

Mock resource balancer for testing

func NewMockResourceBalancer

func NewMockResourceBalancer() *MockResourceBalancer

NewMockResourceBalancer creates a mock resource balancer for testing

func (*MockResourceBalancer) CompleteOperation

func (m *MockResourceBalancer) CompleteOperation(opType string, duration time.Duration)

CompleteOperation simulates operation completion for testing

func (*MockResourceBalancer) EnableDynamicReallocation

func (m *MockResourceBalancer) EnableDynamicReallocation(enabled bool)

EnableDynamicReallocation enables or disables dynamic reallocation

func (*MockResourceBalancer) EnableFairSharing

func (m *MockResourceBalancer) EnableFairSharing(enabled bool)

EnableFairSharing enables or disables fair sharing

func (*MockResourceBalancer) EnablePriorityQueuing

func (m *MockResourceBalancer) EnablePriorityQueuing(enabled bool)

EnablePriorityQueuing enables or disables priority queuing

func (*MockResourceBalancer) EnableRecoveryMode

func (m *MockResourceBalancer) EnableRecoveryMode(enabled bool)

EnableRecoveryMode enables or disables recovery mode

func (*MockResourceBalancer) GetAllocationMetrics

func (m *MockResourceBalancer) GetAllocationMetrics() ResourceAllocationMetrics

GetAllocationMetrics returns resource allocation metrics

func (*MockResourceBalancer) GetPriorityMetrics

func (m *MockResourceBalancer) GetPriorityMetrics() PriorityQueueMetrics

GetPriorityMetrics returns priority queue metrics

func (*MockResourceBalancer) GetReallocationMetrics

func (m *MockResourceBalancer) GetReallocationMetrics() ReallocationMetrics

GetReallocationMetrics returns dynamic reallocation metrics

func (*MockResourceBalancer) GetRecoveryMetrics

func (m *MockResourceBalancer) GetRecoveryMetrics() RecoveryMetrics

GetRecoveryMetrics returns recovery metrics

func (*MockResourceBalancer) GetStabilityMetrics

func (m *MockResourceBalancer) GetStabilityMetrics() StabilityMetrics

GetStabilityMetrics returns system stability metrics

func (*MockResourceBalancer) GetStarvationMetrics

func (m *MockResourceBalancer) GetStarvationMetrics() StarvationMetrics

GetStarvationMetrics returns starvation prevention metrics

func (*MockResourceBalancer) NotifySystemLoadChange

func (m *MockResourceBalancer) NotifySystemLoadChange(change SystemLoadChange)

NotifySystemLoadChange notifies of system load changes

func (*MockResourceBalancer) SetConfiguration

func (m *MockResourceBalancer) SetConfiguration(config ResourceBalancerConfig)

SetConfiguration sets the resource balancer configuration

func (*MockResourceBalancer) SetLoadLevel

func (m *MockResourceBalancer) SetLoadLevel(level int)

SetLoadLevel sets the current load level

func (*MockResourceBalancer) SetMaxConcurrency

func (m *MockResourceBalancer) SetMaxConcurrency(max int)

SetMaxConcurrency sets the maximum concurrency

func (*MockResourceBalancer) SetStarvationThreshold

func (m *MockResourceBalancer) SetStarvationThreshold(threshold time.Duration)

SetStarvationThreshold sets the starvation prevention threshold

func (*MockResourceBalancer) SetStressMode

func (m *MockResourceBalancer) SetStressMode(enabled bool)

SetStressMode enables or disables stress mode

type MockResourcePoolManager

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

Mock resource pool manager for testing

func NewMockResourcePoolManager

func NewMockResourcePoolManager() *MockResourcePoolManager

NewMockResourcePoolManager creates a mock resource pool manager

func (*MockResourcePoolManager) ConfigurePools

func (m *MockResourcePoolManager) ConfigurePools(pools []ResourcePool) error

ConfigurePools configures resource pools

func (*MockResourcePoolManager) GetEfficiencyMetrics

func (m *MockResourcePoolManager) GetEfficiencyMetrics() ResourcePoolEfficiencyMetrics

GetEfficiencyMetrics returns efficiency metrics

type MultiIndexCoordinationScenario

type MultiIndexCoordinationScenario struct {
	Name        string
	Description string
}

MultiIndexCoordinationScenario represents a test scenario

func CreateMultiIndexCoordinationScenario

func CreateMultiIndexCoordinationScenario() *MultiIndexCoordinationScenario

CreateMultiIndexCoordinationScenario creates a test scenario

type NodeProjectGenerator

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

NodeProjectGenerator creates Node.js test projects

func NewNodeProjectGenerator

func NewNodeProjectGenerator(gitignorePatterns ...string) *NodeProjectGenerator

NewNodeProjectGenerator creates a new Node.js project generator

func (*NodeProjectGenerator) CreateProject

func (gen *NodeProjectGenerator) CreateProject(basePath string)

CreateProject creates a Node.js project structure

func (*NodeProjectGenerator) GetProjectConfig

func (gen *NodeProjectGenerator) GetProjectConfig() *config.Config

GetProjectConfig returns the project configuration

type OpType

type OpType int

OpType represents the type of filesystem operation

const (
	OpCreate OpType = iota
	OpModify
	OpDelete
	OpMove
	OpRead
)

type Operation

type Operation struct {
	Type      OpType
	Path      string
	Content   []byte
	Timestamp time.Time
	Error     error
}

Operation represents a filesystem operation

type PathEdgeCases

type PathEdgeCases struct{}

PathEdgeCases provides test scenarios for path handling

func (PathEdgeCases) GetEdgeCasePaths

func (p PathEdgeCases) GetEdgeCasePaths() []string

GetEdgeCasePaths returns paths that should be handled gracefully

type PerformanceGuard

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

PerformanceGuard monitors and enforces performance constraints

func NewPerformanceGuard

func NewPerformanceGuard(t *testing.T) *PerformanceGuard

NewPerformanceGuard creates a new performance guard

func (*PerformanceGuard) AssertAllPassed

func (g *PerformanceGuard) AssertAllPassed()

AssertAllPassed fails the test if any performance check failed

func (*PerformanceGuard) AssertPassed

func (g *PerformanceGuard) AssertPassed(name string)

AssertPassed fails the test if performance checks failed

func (*PerformanceGuard) Check

func (g *PerformanceGuard) Check(name string) PerformanceResult

Check verifies that measurements meet the threshold

func (*PerformanceGuard) Measure

func (g *PerformanceGuard) Measure(name string, fn func()) PerformanceMeasurement

Measure runs a function and records its performance

func (*PerformanceGuard) MeasureN

func (g *PerformanceGuard) MeasureN(name string, n int, fn func()) []PerformanceMeasurement

MeasureN runs a function N times and collects measurements

func (*PerformanceGuard) WithIndexingThreshold

func (g *PerformanceGuard) WithIndexingThreshold(filesPerSecond int) *PerformanceGuard

WithIndexingThreshold adds standard indexing performance thresholds

func (*PerformanceGuard) WithSearchThreshold

func (g *PerformanceGuard) WithSearchThreshold() *PerformanceGuard

WithSearchThreshold adds standard search performance thresholds

func (*PerformanceGuard) WithThreshold

func (g *PerformanceGuard) WithThreshold(name string, threshold PerformanceThreshold) *PerformanceGuard

WithThreshold adds a performance threshold

type PerformanceMeasurement

type PerformanceMeasurement struct {
	Name        string
	Duration    time.Duration
	Allocations int64
	AllocBytes  int64
	Timestamp   time.Time
}

PerformanceMeasurement holds a single measurement

type PerformanceResult

type PerformanceResult struct {
	Name        string
	Passed      bool
	Duration    time.Duration
	Threshold   time.Duration
	Allocations int64
	MaxAllocs   int64
	P50         time.Duration
	P95         time.Duration
	P99         time.Duration
	Violations  []string
}

PerformanceResult holds the result of a performance check

type PerformanceScaler

type PerformanceScaler struct {
	CPUCount         int
	GOMAXPROCS       int
	IsCI             bool
	IsRaceDetector   bool
	IsShortMode      bool
	ConcurrencyRatio float64
}

PerformanceScaler provides scaling factors for performance tests based on runtime conditions

func NewPerformanceScaler

func NewPerformanceScaler(t *testing.T) *PerformanceScaler

NewPerformanceScaler creates a performance scaler for the current test environment

func (*PerformanceScaler) LogScalingFactors

func (ps *PerformanceScaler) LogScalingFactors(t *testing.T)

LogScalingFactors logs the current scaling factors for debugging

func (*PerformanceScaler) ScaleDuration

func (ps *PerformanceScaler) ScaleDuration(base float64) float64

ScaleDuration adjusts a duration based on runtime conditions IMPORTANT: Conservative scaling - only for known constraints, not general loosening

func (*PerformanceScaler) ScaleIterations

func (ps *PerformanceScaler) ScaleIterations(base int) int

ScaleIterations adjusts iteration counts for performance tests

func (*PerformanceScaler) ScaleThroughput

func (ps *PerformanceScaler) ScaleThroughput(base float64) float64

ScaleThroughput adjusts throughput expectations (ops/sec) IMPORTANT: Conservative scaling - maintain high standards for normal development

type PerformanceTestResult

type PerformanceTestResult struct {
	Pattern        string      `json:"pattern"`
	Options        interface{} `json:"options"`
	AvgResultCount float64     `json:"avg_result_count"`
	Iterations     int         `json:"iterations"`
}

PerformanceTestResult represents the result of a performance test

type PerformanceThreshold

type PerformanceThreshold struct {
	Name           string
	MaxDuration    time.Duration
	MaxAllocations int64         // Maximum heap allocations
	MaxAllocBytes  int64         // Maximum allocated bytes
	P50Threshold   time.Duration // 50th percentile threshold
	P95Threshold   time.Duration // 95th percentile threshold
	P99Threshold   time.Duration // 99th percentile threshold
}

PerformanceThreshold defines acceptable performance bounds

type PoolTestResults

type PoolTestResults struct {
}

func RunPoolTest

func RunPoolTest(t *testing.T, helper *IndexCoordinationTestHelper, scenario *LoadTestScenario) *PoolTestResults

RunPoolTest runs a pool test

type PoolType

type PoolType int

PoolType represents the type of resource pool

const (
	PoolTypeIndexing PoolType = iota
	PoolTypeSearch
)

type PriorityQueueMetrics

type PriorityQueueMetrics struct {
	TotalQueued       int64
	PriorityAdherence float64
}

PriorityQueueMetrics represents priority queue metrics

type ProjectGenerator

type ProjectGenerator interface {
	CreateProject(basePath string)
	GetProjectConfig() *config.Config
}

ProjectGenerator interface for creating test projects

type ProjectSnapshot

type ProjectSnapshot struct {
	ProjectName string                       `json:"project_name"`
	Language    string                       `json:"language"`
	FileCount   int                          `json:"file_count"`
	SymbolCount int                          `json:"symbol_count"`
	References  map[string]ReferenceSnapshot `json:"references"`
}

ProjectSnapshot represents reference data for an entire project

func LoadSnapshot

func LoadSnapshot(testName string) (*ProjectSnapshot, error)

LoadSnapshot loads a snapshot from disk

type ReallocationMetrics

type ReallocationMetrics struct {
	Reallocations   int64
	AdaptationSpeed float64
}

ReallocationMetrics represents dynamic reallocation metrics

type RecoveryMetrics

type RecoveryMetrics struct {
	RecoveryTime     time.Duration
	RecoveredIndexes int64
	ImprovementScore float64
}

RecoveryMetrics represents recovery metrics

type RecoveryScenario

type RecoveryScenario struct {
	Name       string
	CauseError func() error
	Recover    func() error
	Verify     func(t *testing.T) bool
}

RecoveryScenario tests that system can recover from errors

type RecoveryTestResults

type RecoveryTestResults struct {
	RecoverySuccessful bool
	RecoveryScore      float64
}

func RunRecoveryTest

func RunRecoveryTest(t *testing.T, helper *IndexCoordinationTestHelper, scenario *LoadTestScenario) *RecoveryTestResults

RunRecoveryTest runs a recovery test

type ReferenceExpectation

type ReferenceExpectation struct {
	SymbolName        string
	MinIncoming       int
	MinOutgoing       int
	ExpectDeclaration bool
}

ReferenceExpectation defines expected reference counts for a symbol

type ReferenceSnapshot

type ReferenceSnapshot struct {
	SymbolName    string `json:"symbol_name"`
	IncomingCount int    `json:"incoming_count"`
	OutgoingCount int    `json:"outgoing_count"`
	HasID         bool   `json:"has_id"`
	HasFileID     bool   `json:"has_file_id"`
	IncomingRefs  int    `json:"incoming_refs_length"`
	OutgoingRefs  int    `json:"outgoing_refs_length"`
}

ReferenceSnapshot represents a snapshot of symbol reference data

type RegressionGuard

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

RegressionGuard detects performance regressions by comparing to baselines

func NewRegressionGuard

func NewRegressionGuard(maxDeltaPct float64) *RegressionGuard

NewRegressionGuard creates a new regression guard

func (*RegressionGuard) AssertNoRegressions

func (g *RegressionGuard) AssertNoRegressions(t *testing.T)

AssertNoRegressions fails the test if any regressions are detected

func (*RegressionGuard) CheckAllRegressions

func (g *RegressionGuard) CheckAllRegressions() map[string]float64

CheckAllRegressions checks all measurements for regressions

func (*RegressionGuard) CheckRegression

func (g *RegressionGuard) CheckRegression(name string) (hasRegression bool, delta float64)

CheckRegression checks if there's a regression for a specific measurement

func (*RegressionGuard) RecordMeasurement

func (g *RegressionGuard) RecordMeasurement(name string, duration time.Duration)

RecordMeasurement records a current measurement

func (*RegressionGuard) SetBaseline

func (g *RegressionGuard) SetBaseline(name string, duration time.Duration)

SetBaseline sets a baseline duration for a measurement

type ResourceAllocationMetrics

type ResourceAllocationMetrics struct {
	TotalAllocations int64
}

ResourceAllocationMetrics represents resource allocation metrics

type ResourceBalancerConfig

type ResourceBalancerConfig struct {
	MaxConcurrentIndexing int
	MaxConcurrentSearches int
	IndexingPriority      float64
	SearchPriority        float64
	AdaptiveBalancing     bool
}

ResourceBalancerConfig represents resource balancer configuration

type ResourcePool

type ResourcePool struct {
	Name              string
	Type              PoolType
	MinResources      int
	MaxResources      int
	TargetUtilization float64
}

ResourcePool represents a resource pool

type ResourcePoolEfficiencyMetrics

type ResourcePoolEfficiencyMetrics struct {
	OverallEfficiency   float64
	ResourceUtilization float64
	ActualResources     int
	MinResources        int
	MaxResources        int
}

ResourcePoolEfficiencyMetrics represents resource pool efficiency metrics

type SearchBehaviorSnapshot

type SearchBehaviorSnapshot struct {
	ProjectName string                      `json:"project_name"`
	Language    string                      `json:"language"`
	FileCount   int                         `json:"file_count"`
	SymbolCount int                         `json:"symbol_count"`
	SearchTests map[string]SearchTestResult `json:"search_tests"`
}

SearchBehaviorSnapshot represents comprehensive search behavior test results

type SearchDependencyAnalysis

type SearchDependencyAnalysis struct {
	RequiredIndexes  []core.IndexType
	DependencyGraph  map[core.IndexType][]core.IndexType
	OptimizedOrder   []core.IndexType
	ValidationErrors []string
}

SearchDependencyAnalysis represents the result of dependency analysis

func (*SearchDependencyAnalysis) GetDependencyGraph

func (sda *SearchDependencyAnalysis) GetDependencyGraph() map[core.IndexType][]core.IndexType

GetDependencyGraph returns the dependency graph

func (*SearchDependencyAnalysis) Validate

func (sda *SearchDependencyAnalysis) Validate() error

Validate validates the dependency analysis

type SearchDependencyResolution

type SearchDependencyResolution struct {
	Strategy                string
	ResolvedRequirements    core.SearchRequirements
	IsDegraded              bool
	FallbackReason          string
	AvailableIndexes        []core.IndexType
	UnavailableIndexes      []core.IndexType
	IsBlocked               bool
	Error                   error
	DirectDependencies      []core.IndexType
	TransitiveDependencies  []core.IndexType
	HasOptimization         bool
	OptimizedOrder          []core.IndexType
	UnavailableDependencies []core.IndexType
	ResolutionHistory       []SearchDependencyResolution
	GetRecoveryMetrics      func() *RecoveryMetrics
	HasCircularDependencies bool
	ResolvedOrder           []core.IndexType
	HasDeadlock             bool
}

SearchDependencyResolution represents dependency resolution result

type SearchPerformanceSnapshot

type SearchPerformanceSnapshot struct {
	ProjectName      string                           `json:"project_name"`
	FileCount        int                              `json:"file_count"`
	SymbolCount      int                              `json:"symbol_count"`
	IndexSizeMB      float64                          `json:"index_size_mb"`
	PerformanceTests map[string]PerformanceTestResult `json:"performance_tests"`
}

SearchPerformanceSnapshot represents performance test results

type SearchResult

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

SearchResult represents a simplified search result for testing

func (*SearchResult) ComponentCount

func (r *SearchResult) ComponentCount() int

ComponentCount returns the number of components in the result

func (*SearchResult) HasLocations

func (r *SearchResult) HasLocations() bool

HasLocations returns whether the result has location data

func (*SearchResult) HasPostings

func (r *SearchResult) HasPostings() bool

HasPostings returns whether the result has postings data

func (*SearchResult) HasReferences

func (r *SearchResult) HasReferences() bool

HasReferences returns whether the result has reference data

func (*SearchResult) HasSymbols

func (r *SearchResult) HasSymbols() bool

HasSymbols returns whether the result has symbol data

func (*SearchResult) HasTrigrams

func (r *SearchResult) HasTrigrams() bool

HasTrigrams returns whether the result has trigram data

type SearchTest

type SearchTest struct {
	Name    string      `json:"name"`
	Pattern string      `json:"pattern"`
	Options interface{} `json:"options"` // types.SearchOptions
}

SearchTest represents a search test case

type SearchTestResult

type SearchTestResult struct {
	Pattern             string      `json:"pattern"`
	Options             interface{} `json:"options"`
	BasicResultCount    int         `json:"basic_result_count"`
	EnhancedResultCount int         `json:"enhanced_result_count"`
	FirstResultLine     int         `json:"first_result_line"`
	FirstResultPath     string      `json:"first_result_path"`
	HasRelationalData   bool        `json:"has_relational_data"`
	SymbolTypesFound    []string    `json:"symbol_types_found"`
}

SearchTestResult represents the result of a search test

type SnapshotDifference

type SnapshotDifference struct {
	ChecksumMatch         bool
	SizeMatch             bool
	FirstDifferenceOffset int
	Message               string
}

SnapshotDifference describes differences between snapshots

func SnapshotDiff

func SnapshotDiff(snap1, snap2 *BinarySnapshot) (*SnapshotDifference, error)

SnapshotDiff returns differences between two snapshots

type SnapshotMode

type SnapshotMode string

SnapshotMode determines how snapshots are handled

const (
	// SnapshotModeCompare compares against existing snapshots
	SnapshotModeCompare SnapshotMode = "compare"
	// SnapshotModeUpdate updates snapshots with current values
	SnapshotModeUpdate SnapshotMode = "update"
)

func GetSnapshotMode

func GetSnapshotMode() SnapshotMode

GetSnapshotMode returns the current snapshot mode from environment

type StabilityMetrics

type StabilityMetrics struct {
	Uptime         float64
	MemoryLeakRate float64
}

StabilityMetrics represents system stability metrics

type StarvationMetrics

type StarvationMetrics struct {
	MaxWaitTime     time.Duration
	StarvationCount int64
}

StarvationMetrics represents starvation prevention metrics

type StressTestResults

type StressTestResults struct {
	CompletedOperations  int
	ErrorRate            float64
	SystemStabilityScore float64
}

func RunStressTest

func RunStressTest(t *testing.T, helper *IndexCoordinationTestHelper, scenario *LoadTestScenario) *StressTestResults

RunStressTest runs a stress test

type SystemLoadChange

type SystemLoadChange int

SystemLoadChange represents system load changes

const (
	SystemLoadIncrease SystemLoadChange = iota
	SystemLoadDecrease
)

type TestFile

type TestFile struct {
	Path    string
	Content string
	IsDir   bool
}

TestFile represents a test file with path and content

type TestFiles

type TestFiles []TestFile

TestFiles represents a collection of test files

func (*TestFiles) AddDirectory

func (tf *TestFiles) AddDirectory(path string)

AddDirectory adds a directory to the test collection

func (*TestFiles) AddFile

func (tf *TestFiles) AddFile(path, content string)

AddFile adds a file to the test collection

func (TestFiles) CreateFiles

func (tf TestFiles) CreateFiles(basePath string) error

CreateFiles creates all files in the test collection

type TestFilesystem

type TestFilesystem struct {
	*testing.T
	*MockFilesystem
	// contains filtered or unexported fields
}

TestFilesystem provides an isolated mock filesystem for LCI testing

func NewTestFilesystem

func NewTestFilesystem(t *testing.T) *TestFilesystem

NewTestFilesystem creates an isolated test filesystem with sensible defaults

func (*TestFilesystem) AddProjectDir

func (tfs *TestFilesystem) AddProjectDir(path string)

AddProjectDir adds a directory relative to the test project root

func (*TestFilesystem) AddProjectFile

func (tfs *TestFilesystem) AddProjectFile(path, content string)

AddProjectFile adds a file relative to the test project root

func (*TestFilesystem) CreateComplexProject

func (tfs *TestFilesystem) CreateComplexProject()

CreateComplexProject creates a project with various edge cases for testing gitignore functionality

func (*TestFilesystem) CreateFileService

func (tfs *TestFilesystem) CreateFileService() *core.FileService

CreateFileService creates a FileService backed by this mock filesystem

func (*TestFilesystem) CreateGoProject

func (tfs *TestFilesystem) CreateGoProject()

CreateGoProject creates a typical Go project structure using the GoProjectGenerator

func (*TestFilesystem) CreateNodeProject

func (tfs *TestFilesystem) CreateNodeProject()

CreateNodeProject creates a typical Node.js project structure using the NodeProjectGenerator

func (*TestFilesystem) CreateWebProject

func (tfs *TestFilesystem) CreateWebProject()

CreateWebProject creates a modern web project with Next.js-like structure using the WebProjectGenerator

func (*TestFilesystem) GetConfig

func (tfs *TestFilesystem) GetConfig() *config.Config

GetConfig returns the test configuration

func (*TestFilesystem) GetGitignoreContent

func (tfs *TestFilesystem) GetGitignoreContent() string

GetGitignoreContent returns the current gitignore content

func (*TestFilesystem) SetGitignore

func (tfs *TestFilesystem) SetGitignore(patterns ...string)

SetGitignore configures gitignore patterns for testing

type TestFilesystemAdapter

type TestFilesystemAdapter struct {
	*TestFilesystem
}

TestFilesystemAdapter adapts TestFilesystem to core.FileSystemInterface

func (*TestFilesystemAdapter) Exists

func (tfsa *TestFilesystemAdapter) Exists(path string) bool

Exists implements core.FileSystemInterface

func (*TestFilesystemAdapter) IsDir

func (tfsa *TestFilesystemAdapter) IsDir(path string) bool

IsDir implements core.FileSystemInterface

func (*TestFilesystemAdapter) IsFile

func (tfsa *TestFilesystemAdapter) IsFile(path string) bool

IsFile implements core.FileSystemInterface

func (*TestFilesystemAdapter) ReadDir

func (tfsa *TestFilesystemAdapter) ReadDir(path string) ([]fs.DirEntry, error)

ReadDir implements core.FileSystemInterface

func (*TestFilesystemAdapter) ReadFile

func (tfsa *TestFilesystemAdapter) ReadFile(path string) ([]byte, error)

ReadFile implements core.FileSystemInterface

func (*TestFilesystemAdapter) Stat

func (tfsa *TestFilesystemAdapter) Stat(path string) (fs.FileInfo, error)

Stat implements core.FileSystemInterface

type TestResult

type TestResult struct {
	GoroutineID int
	OperationID int
	Success     bool
	Error       error
	Duration    time.Duration
	StartTime   time.Time
	EndTime     time.Time
}

TestResult represents the result of a single test operation

func RunCoordinationTest

func RunCoordinationTest(t *testing.T, scenario *MultiIndexCoordinationScenario) *TestResult

RunCoordinationTest runs a coordination test

type ThroughputGuard

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

ThroughputGuard monitors operation throughput

func NewThroughputGuard

func NewThroughputGuard(t *testing.T, minOpsPerSec float64) *ThroughputGuard

NewThroughputGuard creates a new throughput guard

func (*ThroughputGuard) AssertMinThroughput

func (g *ThroughputGuard) AssertMinThroughput()

AssertMinThroughput fails if throughput is below minimum

func (*ThroughputGuard) GetAverageThroughput

func (g *ThroughputGuard) GetAverageThroughput() float64

GetAverageThroughput returns the average throughput

func (*ThroughputGuard) MeasureOps

func (g *ThroughputGuard) MeasureOps(ops int, fn func()) float64

MeasureOps measures the throughput of an operation

func (*ThroughputGuard) RecordOps

func (g *ThroughputGuard) RecordOps(ops int, duration time.Duration)

RecordOps records operations completed in a duration

type TimeoutScenario

type TimeoutScenario struct {
	Name      string
	Timeout   time.Duration
	Operation func(ctx context.Context) error
	ExpectErr error
}

TimeoutScenario represents a test scenario for timeout handling

type TrigramEntrySnapshot

type TrigramEntrySnapshot struct {
	Hash      uint64
	Locations []LocationSnapshot
}

TrigramEntrySnapshot represents a single trigram entry

type TrigramSnapshot

type TrigramSnapshot struct {
	TrigramCount int
	FileCount    int
	Trigrams     []TrigramEntrySnapshot
}

TrigramSnapshot captures TrigramIndex state for comparison

func CreateTrigramTestSnapshot

func CreateTrigramTestSnapshot(trigrams map[uint64][]LocationSnapshot) *TrigramSnapshot

CreateTrigramTestSnapshot creates a snapshot from test data for validation

type UnicodeEdgeCases

type UnicodeEdgeCases struct {
	TempDir string
}

UnicodeEdgeCases provides test scenarios for Unicode edge conditions

func NewUnicodeEdgeCases

func NewUnicodeEdgeCases(t *testing.T) *UnicodeEdgeCases

NewUnicodeEdgeCases creates Unicode edge case scenarios

func (*UnicodeEdgeCases) CreateUnicodeFile

func (u *UnicodeEdgeCases) CreateUnicodeFile(t *testing.T, name string, content []byte) string

CreateUnicodeFile creates a file with Unicode content

func (*UnicodeEdgeCases) GetTestCases

func (u *UnicodeEdgeCases) GetTestCases() map[string][]byte

GetTestCases returns various Unicode test strings

type Violation

type Violation struct {
	File     string `json:"file"`
	Line     int    `json:"line"`
	Column   int    `json:"column"`
	Pattern  string `json:"pattern"`
	Code     string `json:"code"`
	Message  string `json:"message"`
	Severity string `json:"severity"` // "error", "warning", "info"
}

Violation represents a FileService abstraction violation

type WebProjectGenerator

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

WebProjectGenerator creates modern web project structures

func NewWebProjectGenerator

func NewWebProjectGenerator(gitignorePatterns ...string) *WebProjectGenerator

NewWebProjectGenerator creates a new web project generator

func (*WebProjectGenerator) CreateProject

func (gen *WebProjectGenerator) CreateProject(basePath string)

CreateProject creates a web project structure

func (*WebProjectGenerator) GetProjectConfig

func (gen *WebProjectGenerator) GetProjectConfig() *config.Config

GetProjectConfig returns the project configuration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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