Documentation
¶
Index ¶
- func CompareJSON(expected, actual interface{}) error
- func ExtractVerifyRulesForTarget(rules []types.VerifyRule, targetType string) []types.VerifyRule
- func MakeJSONBodyMatcher(actualBody, sourceLabel string, resolver *interpolate.Resolver) func(withFile, baseDir string) bool
- func VerifyGRPC(req *GRPCRequest, rules []types.VerifyRule) error
- func VerifyHTTP(req *HTTPRequest, rules []types.VerifyRule) error
- func VerifyKafka(msg *KafkaMessage, rules []types.VerifyRule) error
- func VerifyRedis(cmd *RedisCommand, rules []types.VerifyRule) error
- func VerifySQL(query string, rules []types.VerifyRule) error
- func VerifyTarget(targetName string, actual string, rules []types.VerifyRule) error
- type GRPCRequest
- type HTTPRequest
- type KafkaMessage
- type RedisCommand
- type VerificationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareJSON ¶
func CompareJSON(expected, actual interface{}) error
CompareJSON does a deep subset comparison of two JSON-decoded values: every key present in expected must exist in actual with a matching value. Extra keys in actual are ignored. Array elements are compared positionally and must match exactly (same length, same element values).
func ExtractVerifyRulesForTarget ¶
func ExtractVerifyRulesForTarget(rules []types.VerifyRule, targetType string) []types.VerifyRule
ExtractVerifyRulesForTarget filters verification rules for a specific target type This helps proxies only process rules relevant to their protocol
func MakeJSONBodyMatcher ¶
func MakeJSONBodyMatcher(actualBody, sourceLabel string, resolver *interpolate.Resolver) func(withFile, baseDir string) bool
MakeJSONBodyMatcher returns a registry body-match callback shared by the HTTP and Kafka interceptors. When the mock has no WithFile the callback always returns true (match-any). Otherwise it loads the expected payload from withFile, parses actualBody as JSON, and delegates to CompareJSON. sourceLabel names the body source in the parse-failure debug log (e.g. "request body" or "Kafka message value").
func VerifyGRPC ¶
func VerifyGRPC(req *GRPCRequest, rules []types.VerifyRule) error
VerifyGRPC checks a gRPC request against a set of verification rules
func VerifyHTTP ¶
func VerifyHTTP(req *HTTPRequest, rules []types.VerifyRule) error
VerifyHTTP checks an HTTP request against a set of verification rules
func VerifyKafka ¶
func VerifyKafka(msg *KafkaMessage, rules []types.VerifyRule) error
VerifyKafka checks a Kafka message against a set of verification rules
func VerifyRedis ¶
func VerifyRedis(cmd *RedisCommand, rules []types.VerifyRule) error
VerifyRedis checks a Redis command against a set of verification rules
func VerifySQL ¶
func VerifySQL(query string, rules []types.VerifyRule) error
VerifySQL checks a SQL query against a set of verification rules
func VerifyTarget ¶
func VerifyTarget(targetName string, actual string, rules []types.VerifyRule) error
VerifyTarget checks a target value against a set of verification rules
Types ¶
type GRPCRequest ¶
type GRPCRequest struct {
Service string
Method string
Body string // JSON representation of the request message
Metadata map[string]string // gRPC metadata (like HTTP headers)
}
GRPCRequest holds gRPC request data for verification
type HTTPRequest ¶
type HTTPRequest struct {
Method string
URL string
Path string
Headers map[string]string
Body string
}
HTTPRequest holds HTTP request data for verification
type KafkaMessage ¶
KafkaMessage holds Kafka message data for verification
type RedisCommand ¶
RedisCommand holds Redis command data for verification
type VerificationError ¶
type VerificationError struct {
Target string
Rule types.VerifyRule
Actual string
Message string
}
VerificationError represents a failed verification
func (*VerificationError) Error ¶
func (e *VerificationError) Error() string