mocks

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockLintContext

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

MockLintContext is mock implementation of the LintContext used in unit tests

func NewMockContext

func NewMockContext() *MockLintContext

NewMockContext returns an empty mockLintContext

func (*MockLintContext) AddContainerToDeployment

func (l *MockLintContext) AddContainerToDeployment(t *testing.T, deploymentName string, container v1.Container)

AddContainerToDeployment adds a mock container to the specified pod under context

func (*MockLintContext) AddMockClusterRole

func (l *MockLintContext) AddMockClusterRole(t *testing.T, name string)

AddMockClusterRole adds a mock ClusterRole to LintContext

func (*MockLintContext) AddMockClusterRoleBinding

func (l *MockLintContext) AddMockClusterRoleBinding(t *testing.T, name string)

AddMockClusterRoleBinding adds a mock ClusterRoleBinding to LintContext

func (*MockLintContext) AddMockDaemonSet

func (l *MockLintContext) AddMockDaemonSet(t *testing.T, name string)

AddMockDaemonSet adds a mock DaemonSet to LintContext

func (*MockLintContext) AddMockDeployment

func (l *MockLintContext) AddMockDeployment(t *testing.T, name string)

AddMockDeployment adds a mock Deployment to LintContext

func (*MockLintContext) AddMockDeploymentConfig

func (l *MockLintContext) AddMockDeploymentConfig(t *testing.T, name string)

AddMockDeploymentConfig adds a mock DeploymentConfig to LintContext

func (*MockLintContext) AddMockHorizontalPodAutoscaler

func (l *MockLintContext) AddMockHorizontalPodAutoscaler(t *testing.T, name, version string)

AddMockHorizontalPodAutoscaler adds a mock HorizontalPodAutoscaler to LintContext

func (*MockLintContext) AddMockIngress added in v0.6.1

func (l *MockLintContext) AddMockIngress(t *testing.T, name string)

func (*MockLintContext) AddMockNetworkPolicy

func (l *MockLintContext) AddMockNetworkPolicy(t *testing.T, name string)

AddMockNetworkPolicy adds a mock NetworkPolicy to LintContext

func (*MockLintContext) AddMockPodDisruptionBudget added in v0.6.3

func (l *MockLintContext) AddMockPodDisruptionBudget(t *testing.T, name string)

func (*MockLintContext) AddMockReplicationController

func (l *MockLintContext) AddMockReplicationController(t *testing.T, name string)

AddMockReplicationController adds a mock ReplicationController to LintContext

func (*MockLintContext) AddMockRole

func (l *MockLintContext) AddMockRole(t *testing.T, name, namespace string)

AddMockRole adds a mock Role to LintContext

func (*MockLintContext) AddMockRoleBinding

func (l *MockLintContext) AddMockRoleBinding(t *testing.T, name, namespace string)

AddMockRoleBinding adds a mock RoleBinding to LintContext

func (*MockLintContext) AddMockScaledObject added in v0.6.8

func (l *MockLintContext) AddMockScaledObject(t *testing.T, name, version string)

AddMockScaledObject adds a mock ScaledObject to LintContext

func (*MockLintContext) AddMockSecurityContextConstraints added in v0.6.5

func (l *MockLintContext) AddMockSecurityContextConstraints(t *testing.T, name string, allowFlag bool)

AddMockSecurityContextConstraints adds a mock SecurityContextConstraints to LintContext

func (*MockLintContext) AddMockService

func (l *MockLintContext) AddMockService(t *testing.T, name string)

AddMockService adds a mock Service to LintContext

func (*MockLintContext) AddMockServiceMonitor added in v0.6.5

func (l *MockLintContext) AddMockServiceMonitor(t *testing.T, name string)

AddMockServiceMonitor adds a mock ServiceMonitor to LintContext

func (*MockLintContext) AddSecurityContextToDeployment

func (l *MockLintContext) AddSecurityContextToDeployment(t *testing.T, deploymentName string,
	securityContext *v1.PodSecurityContext)

AddSecurityContextToDeployment adds a security context to the deployment specified by name

func (*MockLintContext) InvalidObjects

func (l *MockLintContext) InvalidObjects() []lintcontext.InvalidObject

InvalidObjects is not implemented. For now we don't care about invalid objects for mock context.

func (*MockLintContext) ModifyClusterRole

func (l *MockLintContext) ModifyClusterRole(t *testing.T, name string, f func(clusterrole *rbacV1.ClusterRole))

ModifyClusterRole modifies a given clusterrole in the context via the passed function.

func (*MockLintContext) ModifyClusterRoleBinding

func (l *MockLintContext) ModifyClusterRoleBinding(t *testing.T, name string, f func(clusterrolebinding *rbacV1.ClusterRoleBinding))

ModifyClusterRoleBinding modifies a given ClusterRoleBinding in the context via the passed function.

func (*MockLintContext) ModifyDaemonSet

func (l *MockLintContext) ModifyDaemonSet(t *testing.T, name string, f func(ds *appsV1.DaemonSet))

ModifyDaemonSet modifies a given DaemonSet in the context via the passed function.

func (*MockLintContext) ModifyDeployment

func (l *MockLintContext) ModifyDeployment(t *testing.T, name string, f func(deployment *appsV1.Deployment))

ModifyDeployment modifies a given deployment in the context via the passed function.

func (*MockLintContext) ModifyDeploymentConfig

func (l *MockLintContext) ModifyDeploymentConfig(t *testing.T, name string, f func(ds *ocsAppsV1.DeploymentConfig))

ModifyDeploymentConfig modifies a given DeploymentConfig in the context via the passed function.

func (*MockLintContext) ModifyHorizontalPodAutoscalerV1

func (l *MockLintContext) ModifyHorizontalPodAutoscalerV1(t *testing.T, name string, f func(hpa *autoscalingV1.HorizontalPodAutoscaler))

ModifyHorizontalPodAutoscalerV1 modifies a given HorizontalPodAutoscaler in the context via the passed function.

func (*MockLintContext) ModifyHorizontalPodAutoscalerV2

func (l *MockLintContext) ModifyHorizontalPodAutoscalerV2(t *testing.T, name string, f func(hpa *autoscalingV2.HorizontalPodAutoscaler))

ModifyHorizontalPodAutoscalerV2 modifies a given HorizontalPodAutoscaler in the context via the passed function.

func (*MockLintContext) ModifyHorizontalPodAutoscalerV2Beta1

func (l *MockLintContext) ModifyHorizontalPodAutoscalerV2Beta1(t *testing.T, name string, f func(hpa *autoscalingV2Beta1.HorizontalPodAutoscaler))

ModifyHorizontalPodAutoscalerV2Beta1 modifies a given HorizontalPodAutoscaler in the context via the passed function.

func (*MockLintContext) ModifyHorizontalPodAutoscalerV2Beta2

func (l *MockLintContext) ModifyHorizontalPodAutoscalerV2Beta2(t *testing.T, name string, f func(hpa *autoscalingV2Beta2.HorizontalPodAutoscaler))

ModifyHorizontalPodAutoscalerV2Beta2 modifies a given HorizontalPodAutoscaler in the context via the passed function.

func (*MockLintContext) ModifyIngress added in v0.6.1

func (l *MockLintContext) ModifyIngress(t *testing.T, name string, f func(ingress *networkingV1.Ingress))

ModifyIngress modifies a given networkpolicy in the context via the passed function.

func (*MockLintContext) ModifyNetworkPolicy

func (l *MockLintContext) ModifyNetworkPolicy(t *testing.T, name string, f func(networkpolicy *networkingV1.NetworkPolicy))

ModifyNetworkPolicy modifies a given networkpolicy in the context via the passed function.

func (*MockLintContext) ModifyPodDisruptionBudget added in v0.6.3

func (l *MockLintContext) ModifyPodDisruptionBudget(t *testing.T, name string, f func(pdb *pdbV1.PodDisruptionBudget))

func (*MockLintContext) ModifyReplicationController

func (l *MockLintContext) ModifyReplicationController(t *testing.T, name string, f func(deployment *v1.ReplicationController))

ModifyReplicationController modifies a given replication controller in the context via the passed function.

func (*MockLintContext) ModifyRole

func (l *MockLintContext) ModifyRole(t *testing.T, name string, f func(role *rbacV1.Role))

ModifyRole modifies a given Role in the context via the passed function.

func (*MockLintContext) ModifyRoleBinding

func (l *MockLintContext) ModifyRoleBinding(t *testing.T, name string, f func(rolebinding *rbacV1.RoleBinding))

ModifyRoleBinding modifies a given RoleBinding in the context via the passed function.

func (*MockLintContext) ModifyScaledObjectV1Alpha1 added in v0.6.8

func (l *MockLintContext) ModifyScaledObjectV1Alpha1(t *testing.T, name string, f func(hpa *kedaV1Alpha1.ScaledObject))

ModifyScaledObjectV1Alpha1 modifies a given ScaledObject in the context via the passed function.

func (*MockLintContext) ModifyService

func (l *MockLintContext) ModifyService(t *testing.T, name string, f func(service *coreV1.Service))

ModifyService modifies a given service in the context via the passed function

func (*MockLintContext) ModifyServiceMonitor added in v0.6.5

func (l *MockLintContext) ModifyServiceMonitor(t *testing.T, name string, f func(servicemonitor *k8sMonitoring.ServiceMonitor))

ModifyServiceMonitor modifies a given servicemonitor in the context via the passed function

func (*MockLintContext) Objects

func (l *MockLintContext) Objects() []lintcontext.Object

Objects returns all the objects under this MockLintContext

Jump to

Keyboard shortcuts

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