testbase

package
v0.0.0-...-43dbc5b Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

README

Testing instructions

In order to run the tests locally, “envtest” requires some k8s binaries. To install them, run once:

go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
source <(setup-envtest use -p env)
sudo mkdir -p /usr/local/kubebuilder
sudo ln -s "$KUBEBUILDER_ASSETS" /usr/local/kubebuilder/bin

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchPatch

func MatchPatch(patch client.Patch) gomock.Matcher

Types

type ClientPatch

type ClientPatch struct {
	client.Patch
}

func (ClientPatch) Matches

func (p ClientPatch) Matches(x interface{}) bool

func (ClientPatch) String

func (p ClientPatch) String() string

type ControllerManagerTestSuiteBase

type ControllerManagerTestSuiteBase struct {
	suite.Suite

	TestNamespace   string
	K8sDirectClient *kubernetes.Clientset

	Mgr manager.Manager
	// contains filtered or unexported fields
}

func (*ControllerManagerTestSuiteBase) AddClusterIPService

func (s *ControllerManagerTestSuiteBase) AddClusterIPService(name string, selector map[string]string, serviceIp string, pods []*corev1.Pod) *corev1.Service

func (*ControllerManagerTestSuiteBase) AddDaemonSet

func (s *ControllerManagerTestSuiteBase) AddDaemonSet(name string, podIps []string, podLabels map[string]string) (*appsv1.DaemonSet, []*corev1.Pod)

func (*ControllerManagerTestSuiteBase) AddDaemonSetWithService

func (s *ControllerManagerTestSuiteBase) AddDaemonSetWithService(name string, podIps []string, podLabels map[string]string, serviceIp string) (*appsv1.DaemonSet, *corev1.Service)

func (*ControllerManagerTestSuiteBase) AddDeployment

func (s *ControllerManagerTestSuiteBase) AddDeployment(name string, podIps []string, podLabels map[string]string) (*appsv1.Deployment, []*corev1.Pod)

func (*ControllerManagerTestSuiteBase) AddDeploymentWithIngressService

func (s *ControllerManagerTestSuiteBase) AddDeploymentWithIngressService(name string, podIps []string, podLabels map[string]string, serviceIp string, externalIP string, port int) (*appsv1.Deployment, *corev1.Service, []*corev1.Pod)

func (*ControllerManagerTestSuiteBase) AddDeploymentWithService

func (s *ControllerManagerTestSuiteBase) AddDeploymentWithService(name string, podIps []string, podLabels map[string]string, serviceIp string) (*appsv1.Deployment, *corev1.Service, []*corev1.Pod)

func (*ControllerManagerTestSuiteBase) AddEndpoints

func (s *ControllerManagerTestSuiteBase) AddEndpoints(name string, pods []*corev1.Pod, port *int) *corev1.Endpoints

func (*ControllerManagerTestSuiteBase) AddIngress

func (s *ControllerManagerTestSuiteBase) AddIngress(name string, serviceName string, serviceNamespace, externalIP string, port int) *networkingv1.Ingress

func (*ControllerManagerTestSuiteBase) AddLoadBalancerService

func (s *ControllerManagerTestSuiteBase) AddLoadBalancerService(name string, selector map[string]string, serviceIp string, pods []*corev1.Pod) *corev1.Service

func (*ControllerManagerTestSuiteBase) AddPod

func (s *ControllerManagerTestSuiteBase) AddPod(name string, podIp string, labels map[string]string, ownerRefs []metav1.OwnerReference) *corev1.Pod

func (*ControllerManagerTestSuiteBase) AddPodWithHostNetwork

func (s *ControllerManagerTestSuiteBase) AddPodWithHostNetwork(name, ip string, labels, annotations map[string]string, hostNetwork bool) *corev1.Pod

func (*ControllerManagerTestSuiteBase) AddReplicaSet

func (s *ControllerManagerTestSuiteBase) AddReplicaSet(name string, podIps []string, podLabels map[string]string) (*appsv1.ReplicaSet, []*corev1.Pod)

func (*ControllerManagerTestSuiteBase) AddService

func (s *ControllerManagerTestSuiteBase) AddService(name string, selector map[string]string, serviceIp string, pods []*corev1.Pod, serviceType corev1.ServiceType) *corev1.Service

func (*ControllerManagerTestSuiteBase) AddServiceWithIngress

func (s *ControllerManagerTestSuiteBase) AddServiceWithIngress(name string, selector map[string]string, serviceIp string, externalIP string, pods []*corev1.Pod, port int) *corev1.Service

func (*ControllerManagerTestSuiteBase) BeforeTest

func (s *ControllerManagerTestSuiteBase) BeforeTest(_, testName string)

BeforeTest happens AFTER the SetupTest()

func (*ControllerManagerTestSuiteBase) GetAPIServerService

func (s *ControllerManagerTestSuiteBase) GetAPIServerService() *corev1.Service

func (*ControllerManagerTestSuiteBase) SetupTest

func (s *ControllerManagerTestSuiteBase) SetupTest()

func (*ControllerManagerTestSuiteBase) TearDownTest

func (s *ControllerManagerTestSuiteBase) TearDownTest()

Jump to

Keyboard shortcuts

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