testing

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const AksLinuxNode1 = "akslinux001"
View Source
const AksLinuxNode2 = "akslinux002"
View Source
const AksLinuxNode3 = "akslinux003"
View Source
const AksWindowsNode1 = "akswin001"
View Source
const AksWindowsNode2 = "akswin002"
View Source
const AksWindowsNode3NeverReady = "akswin003-never-ready"

Variables

This section is empty.

Functions

func GenerateNode

func GenerateNode(name string, isWindows bool, isHealedAnnotationPresent bool, isHealed bool, isReady bool) *apicorev1.Node

func GenerateNodesLikeInHealedCluster

func GenerateNodesLikeInHealedCluster() []*apicorev1.Node

func GenerateNodesSimilarToInitialNonHealedCluster

func GenerateNodesSimilarToInitialNonHealedCluster() []*apicorev1.Node

func UpdateNodeCondition

func UpdateNodeCondition(node *apicorev1.Node, isReady bool)

Types

type KubernetesServiceMock

type KubernetesServiceMock struct {
	services.KubernetesService

	// This is a fake in-memory representation of the cluster state, which can also be used in tests. This Mock
	// service will manipulate this state so that the tests can verify more on behaviours and effects, and less by checking
	// expected method calls. Set this before
	TestData_Nodes []*apicorev1.Node

	// TestData_Pods is the current collection of tracked pods created through this mock service. Key is the pod name.
	// Please do not set this field value yourself.
	TestData_Pods map[string]*apicorev1.Pod

	// TestData_DeletedPods is the collection of pod names deleted through this mock service. Key and the value are both the pod name.
	// Please do not set this field value yourself.
	TestData_DeletedPods map[string]string

	// Clock can be used to influence timestamps set in this mock service, which can be helpful to determine when test data was created / updated
	Clock clock.Clock

	// Error_CreatePod can be set to make CreatePod always return errors
	Error_CreatePod error
}

func NewKubernetesServiceMock

func NewKubernetesServiceMock(clock clock.Clock) *KubernetesServiceMock

func (*KubernetesServiceMock) AddNodeAnnotation

func (m *KubernetesServiceMock) AddNodeAnnotation(nodeName string, annotationKey string, annotationValue string) error

func (*KubernetesServiceMock) CreatePod

func (m *KubernetesServiceMock) CreatePod(pod *apicorev1.Pod) error

func (*KubernetesServiceMock) DeletePod

func (m *KubernetesServiceMock) DeletePod(namespace string, name string) error

func (*KubernetesServiceMock) GetAllNodes

func (m *KubernetesServiceMock) GetAllNodes() ([]*apicorev1.Node, error)

type SnatMetricsRecorderMock

type SnatMetricsRecorderMock struct {
	mock.Mock
	metrics.SnatMetrics
}

func (*SnatMetricsRecorderMock) IncHealAttemptsCounter

func (m *SnatMetricsRecorderMock) IncHealAttemptsCounter()

func (*SnatMetricsRecorderMock) IncNumberOfNotReadyNodesSeen

func (m *SnatMetricsRecorderMock) IncNumberOfNotReadyNodesSeen()

Jump to

Keyboard shortcuts

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