fuzztesting

package
v1.134.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterFuzzer

func RegisterFuzzer(fuzzer FuzzFn)

func RegisterKRMFuzzer

func RegisterKRMFuzzer(fuzzer KRMFuzzer)

func RegisterKRMFuzzer_NoProto added in v1.134.0

func RegisterKRMFuzzer_NoProto(fuzzer KRMFuzzer_NoProto)

func RegisterKRMSpecFuzzer added in v1.129.2

func RegisterKRMSpecFuzzer(fuzzer KRMFuzzer)

func RegisterKRMSpecFuzzer_NoProto added in v1.134.0

func RegisterKRMSpecFuzzer_NoProto(fuzzer KRMFuzzer_NoProto)

Types

type FuzzFn

type FuzzFn func(t *testing.T, seed int64)

func ChooseFuzzer

func ChooseFuzzer(n int64) FuzzFn

type FuzzTest

type FuzzTest[ProtoT proto.Message, KRMType any] struct {
	ProtoType ProtoT

	FromProto func(ctx *direct.MapContext, in ProtoT) *KRMType
	ToProto   func(ctx *direct.MapContext, in *KRMType) ProtoT

	UnimplementedFields sets.Set[string]
	IgnoreFields        sets.Set[string]
}

func NewFuzzTest

func NewFuzzTest[ProtoT proto.Message, KRMType any](protoType ProtoT, fromProto func(ctx *direct.MapContext, in ProtoT) *KRMType, toProto func(ctx *direct.MapContext, in *KRMType) ProtoT) *FuzzTest[ProtoT, KRMType]

func (*FuzzTest[ProtoT, KRMType]) Fuzz

func (f *FuzzTest[ProtoT, KRMType]) Fuzz(t *testing.T, seed int64)

type FuzzTest_NoProto added in v1.134.0

type FuzzTest_NoProto[APIType any, KRMType any] struct {
	APIType APIType

	FromAPI func(ctx *direct.MapContext, in APIType) *KRMType
	ToAPI   func(ctx *direct.MapContext, in *KRMType) APIType

	UnimplementedFields sets.Set[string]
	IgnoreFields        sets.Set[string]
}

func NewFuzzTest_NoProto added in v1.134.0

func NewFuzzTest_NoProto[APIType any, KRMType any](apiType APIType, fromAPI func(ctx *direct.MapContext, in APIType) *KRMType, toAPI func(ctx *direct.MapContext, in *KRMType) APIType) *FuzzTest_NoProto[APIType, KRMType]

func (*FuzzTest_NoProto[APIType, KRMType]) Fuzz added in v1.134.0

func (f *FuzzTest_NoProto[APIType, KRMType]) Fuzz(t *testing.T, seed int64)

type KRMFuzzer

type KRMFuzzer interface {
	FuzzSpec(t *testing.T, seed int64)
	FuzzStatus(t *testing.T, seed int64)
}

type KRMFuzzer_NoProto added in v1.134.0

type KRMFuzzer_NoProto interface {
	FuzzSpec(t *testing.T, seed int64)
	FuzzStatus(t *testing.T, seed int64)
}

type KRMTypedFuzzer

type KRMTypedFuzzer[ProtoT proto.Message, SpecType any, StatusType any] struct {
	ProtoType ProtoT

	SpecFromProto func(ctx *direct.MapContext, in ProtoT) *SpecType
	SpecToProto   func(ctx *direct.MapContext, in *SpecType) ProtoT

	StatusFromProto func(ctx *direct.MapContext, in ProtoT) *StatusType
	StatusToProto   func(ctx *direct.MapContext, in *StatusType) ProtoT

	UnimplementedFields sets.Set[string]
	SpecFields          sets.Set[string]
	StatusFields        sets.Set[string]
}

func NewKRMTypedFuzzer

func NewKRMTypedFuzzer[ProtoT proto.Message, SpecType any, StatusType any](
	protoType ProtoT,
	specFromProto func(ctx *direct.MapContext, in ProtoT) *SpecType, specToProto func(ctx *direct.MapContext, in *SpecType) ProtoT,
	statusFromProto func(ctx *direct.MapContext, in ProtoT) *StatusType, statusToProto func(ctx *direct.MapContext, in *StatusType) ProtoT,
) *KRMTypedFuzzer[ProtoT, SpecType, StatusType]

func NewKRMTypedSpecFuzzer added in v1.129.2

func NewKRMTypedSpecFuzzer[ProtoT proto.Message, SpecType any](
	protoType ProtoT,
	specFromProto func(ctx *direct.MapContext, in ProtoT) *SpecType,
	specToProto func(ctx *direct.MapContext, in *SpecType) ProtoT,
) *KRMTypedFuzzer[ProtoT, SpecType, NoStatus]

NewKRMTypedSpecFuzzer is a convenience function for creating a fuzzer that only fuzzes the spec fields of a KRM type.

func (*KRMTypedFuzzer[ProtoT, SpecType, StatusType]) FuzzSpec

func (f *KRMTypedFuzzer[ProtoT, SpecType, StatusType]) FuzzSpec(t *testing.T, seed int64)

func (*KRMTypedFuzzer[ProtoT, SpecType, StatusType]) FuzzStatus

func (f *KRMTypedFuzzer[ProtoT, SpecType, StatusType]) FuzzStatus(t *testing.T, seed int64)

type KRMTypedFuzzer_NoProto added in v1.134.0

type KRMTypedFuzzer_NoProto[APIType any, SpecType any, StatusType any] struct {
	APIType APIType

	SpecFromAPI func(ctx *direct.MapContext, in APIType) *SpecType
	SpecToAPI   func(ctx *direct.MapContext, in *SpecType) APIType

	StatusFromAPI func(ctx *direct.MapContext, in APIType) *StatusType
	StatusToAPI   func(ctx *direct.MapContext, in *StatusType) APIType

	UnimplementedFields sets.Set[string]
	SpecFields          sets.Set[string]
	StatusFields        sets.Set[string]
}

func NewKRMTypedFuzzer_NoProto added in v1.134.0

func NewKRMTypedFuzzer_NoProto[APIType any, SpecType any, StatusType any](
	apiType APIType,
	specFromAPI func(ctx *direct.MapContext, in APIType) *SpecType, specToAPI func(ctx *direct.MapContext, in *SpecType) APIType,
	statusFromAPI func(ctx *direct.MapContext, in APIType) *StatusType, statusToAPI func(ctx *direct.MapContext, in *StatusType) APIType,
) *KRMTypedFuzzer_NoProto[APIType, SpecType, StatusType]

func (*KRMTypedFuzzer_NoProto[APIType, SpecType, StatusType]) FuzzSpec added in v1.134.0

func (f *KRMTypedFuzzer_NoProto[APIType, SpecType, StatusType]) FuzzSpec(t *testing.T, seed int64)

func (*KRMTypedFuzzer_NoProto[APIType, SpecType, StatusType]) FuzzStatus added in v1.134.0

func (f *KRMTypedFuzzer_NoProto[APIType, SpecType, StatusType]) FuzzStatus(t *testing.T, seed int64)

type NoStatus added in v1.129.2

type NoStatus struct{}

Jump to

Keyboard shortcuts

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