testutil

package
v0.0.0-...-1a63a6d Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PkgKubernetes        = "k8s.io/client-go/kubernetes"
	PkgRest              = "k8s.io/client-go/rest"
	PkgDynamic           = "k8s.io/client-go/dynamic"
	PkgDiscovery         = "k8s.io/client-go/discovery"
	PkgRestMapper        = "k8s.io/client-go/restmapper"
	PkgControllerRuntime = "sigs.k8s.io/controller-runtime/pkg/client"
	PkgReconcile         = "sigs.k8s.io/controller-runtime/pkg/reconcile"
	PkgMetaV1            = "k8s.io/apimachinery/pkg/apis/meta/v1"
	PkgTime              = "time"
)

Variables

This section is empty.

Functions

func RunAnalyzerOnSrc

func RunAnalyzerOnSrc(an *analysis.Analyzer, src string, spoofs ...func(f *ast.File, info *types.Info)) ([]analysis.Diagnostic, error)

RunAnalyzerOnSrc parses src, builds a minimal analysis.Pass with inspector and types info, applies optional spoof callbacks, runs the analyzer, and returns collected diagnostics.

func SpoofCommonK8s

func SpoofCommonK8s(f *ast.File, info *types.Info)

SpoofCommonK8s applies common Kubernetes type spoofing

func SpoofCommonStdLib

func SpoofCommonStdLib(f *ast.File, info *types.Info)

SpoofCommonStdLib applies standard library spoofing (e.g., time.Sleep)

func SpoofControllerRuntimeResult

func SpoofControllerRuntimeResult(f *ast.File, info *types.Info)

SpoofControllerRuntimeResult applies Result type spoofing for controller-runtime

func SpoofInformers

func SpoofInformers(f *ast.File, info *types.Info)

SpoofInformers applies informer-specific spoofing for Kubernetes informers

func SpoofListOptionsType

func SpoofListOptionsType(f *ast.File, info *types.Info)

SpoofListOptionsType adds ListOptions type spoofing to types.Info

func SpoofRBACTypes

func SpoofRBACTypes(f *ast.File, info *types.Info)

SpoofRBACTypes applies RBAC type spoofing for ClusterRole, PolicyRule, etc.

func SpoofReconcileSignature

func SpoofReconcileSignature(f *ast.File, info *types.Info)

SpoofReconcileSignature adds a Reconcile method signature to the types.Info

func SpoofRestConfig

func SpoofRestConfig(f *ast.File, info *types.Info)

SpoofRestConfig applies rest.Config type spoofing

func SpoofRestMapper

func SpoofRestMapper(f *ast.File, info *types.Info)

SpoofRestMapper applies REST mapper function spoofing

func SpoofUnstructuredTypes

func SpoofUnstructuredTypes(f *ast.File, info *types.Info)

SpoofUnstructuredTypes applies Unstructured type spoofing

func SpoofUsesFromMap

func SpoofUsesFromMap(m SpoofMap) func(f *ast.File, info *types.Info)

SpoofUsesFromMap returns a spoof function that assigns types.Func objects for callees whose name appears in the provided map, using the map's pkg path.

func SpoofWorkqueue

func SpoofWorkqueue(f *ast.File, info *types.Info)

SpoofWorkqueue applies workqueue function spoofing

Types

type SpoofMap

type SpoofMap map[string]string

SpoofMap maps function names to package import paths for creating fake Uses.

func CommonK8sSpoofMap

func CommonK8sSpoofMap() SpoofMap

CommonK8sSpoofMap returns a SpoofMap with common Kubernetes function names

func CommonStdLibSpoofMap

func CommonStdLibSpoofMap() SpoofMap

CommonStdLibSpoofMap returns a SpoofMap with Go standard library functions

func RestMapperSpoofMap

func RestMapperSpoofMap() SpoofMap

RestMapperSpoofMap returns functions for REST mapper spoofing

func WorkqueueSpoofMap

func WorkqueueSpoofMap() SpoofMap

WorkqueueSpoofMap returns functions for workqueue spoofing

Jump to

Keyboard shortcuts

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