Documentation
¶
Index ¶
- type MockRegistry
- func (r *MockRegistry) AddPassthroughs(passthroughs []string)
- func (r *MockRegistry) AddVerifyErrors(errors []string)
- func (r *MockRegistry) CheckNegativeGRPCMocks(service, method string)
- func (r *MockRegistry) CheckNegativeHTTPMocks(url string, method string)
- func (r *MockRegistry) CheckNegativeMocks(key string, query string)
- func (r *MockRegistry) CheckNegativeRedisMocks(command, key string)
- func (r *MockRegistry) ClearState()
- func (r *MockRegistry) FindGRPCMock(service, method string) (*types.ExpectStatement, bool)
- func (r *MockRegistry) FindHTTPMock(url string, method string) (*types.ExpectStatement, bool)
- func (r *MockRegistry) FindHTTPMockWithHeaders(url string, method string, headers map[string]string) (*types.ExpectStatement, bool)
- func (r *MockRegistry) FindMock(key string, query string) (*types.ExpectStatement, bool)
- func (r *MockRegistry) FindRedisMock(command, key string) (*types.ExpectStatement, bool)
- func (r *MockRegistry) GetEventTopics() []string
- func (r *MockRegistry) GetHits() map[string]int
- func (r *MockRegistry) GetPassthroughs() []string
- func (r *MockRegistry) GetSeeds() map[string][][]byte
- func (r *MockRegistry) GetTables() []string
- func (r *MockRegistry) GetVerifyErrors() []string
- func (r *MockRegistry) IncrementHit(mock *types.ExpectStatement)
- func (r *MockRegistry) LoadFromBytes(data []byte) error
- func (r *MockRegistry) LoadFromFile(path string) error
- func (r *MockRegistry) PeekMock(key string, query string) (*types.ExpectStatement, bool)
- func (r *MockRegistry) RecordPassthrough(description string)
- func (r *MockRegistry) RecordVerifyError(msg string)
- func (r *MockRegistry) Register(spec *types.TestSpec)
- func (r *MockRegistry) ResetHits()
- func (r *MockRegistry) SaveToFile(path string) error
- func (r *MockRegistry) SeedTopic(topic string, value []byte)
- func (r *MockRegistry) SetHits(hostHits map[string]int)
- func (r *MockRegistry) ToBytes() ([]byte, error)
- func (r *MockRegistry) VerifyAll() error
- func (r *MockRegistry) VerifyPassthroughs(strict bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockRegistry ¶
func NewMockRegistry ¶
func NewMockRegistry() *MockRegistry
func (*MockRegistry) AddPassthroughs ¶ added in v1.4.1
func (r *MockRegistry) AddPassthroughs(passthroughs []string)
AddPassthroughs merges passthrough records from a proxy container into this registry.
func (*MockRegistry) AddVerifyErrors ¶ added in v1.4.2
func (r *MockRegistry) AddVerifyErrors(errors []string)
AddVerifyErrors merges VERIFY failure records from a proxy container into this registry.
func (*MockRegistry) CheckNegativeGRPCMocks ¶ added in v1.4.1
func (r *MockRegistry) CheckNegativeGRPCMocks(service, method string)
CheckNegativeGRPCMocks checks incoming gRPC requests against negative expectations.
func (*MockRegistry) CheckNegativeHTTPMocks ¶ added in v1.4.1
func (r *MockRegistry) CheckNegativeHTTPMocks(url string, method string)
CheckNegativeHTTPMocks checks incoming HTTP requests against negative expectations and increments their hit counters if matched. Called by the HTTP proxy alongside FindHTTPMock so that EXPECT_NOT violations are detected at verification time.
func (*MockRegistry) CheckNegativeMocks ¶ added in v1.4.1
func (r *MockRegistry) CheckNegativeMocks(key string, query string)
CheckNegativeMocks checks incoming DB/Kafka requests against negative expectations and increments their hit counters if matched. Called by proxies alongside FindMock so that EXPECT_NOT violations are detected at verification time.
func (*MockRegistry) CheckNegativeRedisMocks ¶ added in v1.4.1
func (r *MockRegistry) CheckNegativeRedisMocks(command, key string)
CheckNegativeRedisMocks checks incoming Redis commands against negative expectations.
func (*MockRegistry) ClearState ¶ added in v1.4.2
func (r *MockRegistry) ClearState()
ClearState resets hits, passthroughs, and verifyErrors without touching mocks. Used after LoadFromBytes/LoadFromFile when hot-reloading between test runs.
func (*MockRegistry) FindGRPCMock ¶ added in v1.4.1
func (r *MockRegistry) FindGRPCMock(service, method string) (*types.ExpectStatement, bool)
FindGRPCMock finds a gRPC mock matching the service and method.
func (*MockRegistry) FindHTTPMock ¶
func (r *MockRegistry) FindHTTPMock(url string, method string) (*types.ExpectStatement, bool)
FindHTTPMock finds an HTTP mock matching both URL and method
func (*MockRegistry) FindHTTPMockWithHeaders ¶
func (r *MockRegistry) FindHTTPMockWithHeaders(url string, method string, headers map[string]string) (*types.ExpectStatement, bool)
FindHTTPMockWithHeaders finds an HTTP mock matching URL, method, and headers
func (*MockRegistry) FindMock ¶
func (r *MockRegistry) FindMock(key string, query string) (*types.ExpectStatement, bool)
func (*MockRegistry) FindRedisMock ¶ added in v1.4.1
func (r *MockRegistry) FindRedisMock(command, key string) (*types.ExpectStatement, bool)
FindRedisMock finds a Redis mock matching the command and key.
func (*MockRegistry) GetEventTopics ¶ added in v1.4.1
func (r *MockRegistry) GetEventTopics() []string
GetEventTopics returns all distinct Kafka topic names from EVENT channel mocks.
func (*MockRegistry) GetHits ¶
func (r *MockRegistry) GetHits() map[string]int
func (*MockRegistry) GetPassthroughs ¶ added in v1.4.1
func (r *MockRegistry) GetPassthroughs() []string
GetPassthroughs returns a copy of all recorded passthrough descriptions.
func (*MockRegistry) GetSeeds ¶ added in v1.4.1
func (r *MockRegistry) GetSeeds() map[string][][]byte
GetSeeds returns a copy of all seeded Kafka messages.
func (*MockRegistry) GetTables ¶
func (r *MockRegistry) GetTables() []string
GetTables returns a list of unique table names registered in the registry
func (*MockRegistry) GetVerifyErrors ¶ added in v1.4.2
func (r *MockRegistry) GetVerifyErrors() []string
GetVerifyErrors returns a copy of all recorded VERIFY failures.
func (*MockRegistry) IncrementHit ¶ added in v1.4.0
func (r *MockRegistry) IncrementHit(mock *types.ExpectStatement)
IncrementHit increments the hit count for a specific mock (thread-safe)
func (*MockRegistry) LoadFromBytes ¶ added in v1.4.2
func (r *MockRegistry) LoadFromBytes(data []byte) error
LoadFromBytes replaces the registry contents from JSON bytes (same format as SaveToFile).
func (*MockRegistry) LoadFromFile ¶
func (r *MockRegistry) LoadFromFile(path string) error
func (*MockRegistry) PeekMock ¶
func (r *MockRegistry) PeekMock(key string, query string) (*types.ExpectStatement, bool)
PeekMock checks if a mock exists without incrementing hit count (used for testing intercept)
func (*MockRegistry) RecordPassthrough ¶ added in v1.4.1
func (r *MockRegistry) RecordPassthrough(description string)
RecordPassthrough records that a request bypassed the mock layer (no matching mock found). description should be a short human-readable string identifying the request, e.g. "SELECT users".
func (*MockRegistry) RecordVerifyError ¶ added in v1.4.2
func (r *MockRegistry) RecordVerifyError(msg string)
RecordVerifyError records a VERIFY rule failure. Called by proxies when a VERIFY check fails.
func (*MockRegistry) Register ¶
func (r *MockRegistry) Register(spec *types.TestSpec)
func (*MockRegistry) ResetHits ¶
func (r *MockRegistry) ResetHits()
ResetHits resets the hit count for all mocks (useful for testing)
func (*MockRegistry) SaveToFile ¶
func (r *MockRegistry) SaveToFile(path string) error
func (*MockRegistry) SeedTopic ¶ added in v1.4.1
func (r *MockRegistry) SeedTopic(topic string, value []byte)
SeedTopic adds a raw payload to be served to Kafka consumers on a given topic.
func (*MockRegistry) SetHits ¶
func (r *MockRegistry) SetHits(hostHits map[string]int)
func (*MockRegistry) ToBytes ¶ added in v1.4.2
func (r *MockRegistry) ToBytes() ([]byte, error)
ToBytes serialises the registry mocks and seeds to JSON.
func (*MockRegistry) VerifyAll ¶
func (r *MockRegistry) VerifyAll() error
func (*MockRegistry) VerifyPassthroughs ¶ added in v1.4.1
func (r *MockRegistry) VerifyPassthroughs(strict bool) error
VerifyPassthroughs logs a warning for every recorded passthrough. If strict is true and any passthroughs were recorded, it returns an error so the test fails.