kubernetesk8s.io/kubernetes/pkg/apis/resource/fuzzer Index | Files

package fuzzer

import "k8s.io/kubernetes/pkg/apis/resource/fuzzer"

Index

Variables

var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
	return []interface{}{
		func(r *resource.DeviceRequest, c fuzz.Continue) {
			c.FuzzNoCustom(r)

			if r.AllocationMode == "" {
				r.AllocationMode = []resource.DeviceAllocationMode{
					resource.DeviceAllocationModeAll,
					resource.DeviceAllocationModeExactCount,
				}[c.Int31n(2)]
			}
		},
		func(r *resource.DeviceAllocationConfiguration, c fuzz.Continue) {
			c.FuzzNoCustom(r)
			if r.Source == "" {
				r.Source = []resource.AllocationConfigSource{
					resource.AllocationConfigSourceClass,
					resource.AllocationConfigSourceClaim,
				}[c.Int31n(2)]
			}
		},
		func(r *resource.OpaqueDeviceConfiguration, c fuzz.Continue) {
			c.FuzzNoCustom(r)

			r.Parameters = runtime.RawExtension{Raw: []byte(`{"apiVersion":"unknown.group/unknown","kind":"Something","someKey":"someValue"}`)}
		},
	}
}

Funcs contains the fuzzer functions for the resource group.

Leaving fields empty which then get replaced by the default leads to errors during roundtrip tests.

Source Files

fuzzer.go

Version
v1.31.3
Published
Nov 19, 2024
Platform
linux/amd64
Imports
4 packages
Last checked
8 seconds ago

Tools for package owners.