fuzztesting

package
v1.129.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: Apache-2.0 Imports: 9 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 RegisterKRMSpecFuzzer added in v1.129.2

func RegisterKRMSpecFuzzer(fuzzer KRMFuzzer)

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 KRMFuzzer

type KRMFuzzer 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 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