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"}`)}
		},
		func(r *resource.AllocatedDeviceStatus, c fuzz.Continue) {
			c.FuzzNoCustom(r)

			r.Data = 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.32.0-rc.0
Published
Nov 26, 2024
Platform
js/wasm
Imports
4 packages
Last checked
16 minutes ago

Tools for package owners.