testutil

package
v3.28.6 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Testdata124 = "1_24"
	Testdata125 = "1_25"
	Testdata126 = "1_26"
	Testdata127 = "1_27"
	Testdata128 = "1_28"
)

Variables

This section is empty.

Functions

func IsBelow added in v3.2.1

func IsBelow(a, b Version) bool

IsBelow returns true when a is below b in the versions we have test data for. It assumes test data for both versions exists and the corresponding `AllVersions()` list is properly sorted.

func NewIntegration

func NewIntegration(t *testing.T) *integration.Integration

NewIntegration returns a new integration.Integration ready for use in testing and mocks. Integration will use the test name and will fail the test if creation is unsuccessful.

Types

type K8s

type K8s struct {
	// contains filtered or unexported fields
}

func (K8s) Endpoints

func (k K8s) Endpoints() runtime.Object

func (K8s) Everything

func (k K8s) Everything() []runtime.Object

func (K8s) Namespaces

func (k K8s) Namespaces() runtime.Object

func (K8s) Nodes

func (k K8s) Nodes() runtime.Object

func (K8s) Pods

func (k K8s) Pods() runtime.Object

func (K8s) Services

func (k K8s) Services() runtime.Object

type Server

type Server struct {
	*httptest.Server
}

func (*Server) ControlPlaneEndpoint

func (s *Server) ControlPlaneEndpoint(component string) string

func (*Server) KSMEndpoint

func (s *Server) KSMEndpoint() string

func (*Server) KubeletEndpoint

func (s *Server) KubeletEndpoint() string

type Version

type Version string

Version represents a kubernetes version. Mock servers can be instantiated to return known output for a given version.

func AllVersions

func AllVersions() []Version

AllVersions returns a list of versions we have test data for. PLEASE ADD NEW VERSIONS HERE AS WELL. PLEASE KEEP THIS LIST SORTED, WITH NEWER RELEASES LAST IN THE LIST.

func LatestVersion

func LatestVersion() Version

LatestVersion returns the latest version we have test data for.

func (Version) K8s

func (v Version) K8s() (K8s, error)

K8s returns a helper that provide fake instances of K8s objects, ready to use with the kubernetes fake client.

func (Version) Server

func (v Version) Server() (*Server, error)

Server returns an HTTP Server for the given version, ready to serve static endpoints for KSM, Kubelet and CP components.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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