registry

package
v1.4.4-beta Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockRegistry

type MockRegistry struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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) 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) 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) 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) 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) 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) 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.

Jump to

Keyboard shortcuts

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