framework

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: Apache-2.0 Imports: 80 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Poll is the default polling period when checking lifecycle status.
	Poll = 15 * time.Second
	// Poll defines how regularly to poll kubernetes resources.
	K8sResourcePoll = 2 * time.Second
	// DefaultTimeout is how long we wait for long-running operations in the
	// test suite before giving up.
	DefaultTimeout = 10 * time.Minute

	JobCompletionTimeout = 5 * time.Minute

	CloneAvailableTimeout = 10 * time.Minute

	DefaultClusterKubeconfig = "/tmp/clusterkubeconfig"
	DefaultCloudConfig       = "/tmp/cloudconfig"

	ClassOCI           = "oci"
	ClassOCICSI        = "oci-bv"
	ClassCustom        = "oci-bv-custom"
	ClassOCICSIExpand  = "oci-bv-expand"
	ClassOCILowCost    = "oci-bv-low"
	ClassOCIBalanced   = "oci-bal"
	ClassOCIHigh       = "oci-bv-high"
	ClassOCIKMS        = "oci-kms"
	ClassOCIExt3       = "oci-ext3"
	ClassOCIXfs        = "oci-xfs"
	ClassFssDynamic    = "oci-file-storage-test"
	FssProvisionerType = "fss.csi.oraclecloud.com"
	ClassSnapshot      = "oci-snapshot-sc"
	MinVolumeBlock     = "50Gi"
	MaxVolumeBlock     = "100Gi"
	VolumeFss          = "1Gi"

	VSClassDefault = "oci-snapclass"
)
View Source
const (
	EndpointHttpPort      = 8080
	EndpointHttpsPort     = 443
	EndpointUdpPort       = 8081
	TestContainerHttpPort = 8080
	ClusterHttpPort       = 80
	ClusterUdpPort        = 90

	// Number of checks to hit a given set of endpoints when enable session affinity.
	SessionAffinityChecks = 10
)
View Source
const (
	KmsKey                           = "kms-key-id"
	AttachmentTypeISCSI              = "iscsi"
	AttachmentTypeParavirtualized    = "paravirtualized"
	AttachmentType                   = "attachment-type"
	FstypeKey                        = "csi.storage.k8s.io/fstype"
	DataSourceVolumeSnapshotKind     = "VolumeSnapshot"
	DataSourceVolumeSnapshotAPIGroup = "snapshot.storage.k8s.io"
	DataSourceVolumePVCKind          = "PersistentVolumeClaim"
)
View Source
const (
	// KubeProxyLagTimeout is the maximum time a kube-proxy daemon on a node is allowed
	// to not notice a Service update, such as type=NodePort.
	// TODO: This timeout should be O(10s), observed values are O(1m), 5m is very
	// liberal. Fix tracked in #20567.
	KubeProxyLagTimeout = 5 * time.Minute

	// KubeProxyEndpointLagTimeout is the maximum time a kube-proxy daemon on a node is allowed
	// to not notice an Endpoint update.
	KubeProxyEndpointLagTimeout = 30 * time.Second

	// LoadBalancerLagTimeoutDefault is the maximum time a load balancer is allowed to
	// not respond after creation.
	LoadBalancerLagTimeoutDefault = 5 * time.Minute

	// LoadBalancerLagTimeoutAWS is the delay between ELB creation and serving traffic
	// on AWS. A few minutes is typical, so use 10m.
	LoadBalancerLagTimeoutAWS = 10 * time.Minute

	// How long to wait for a load balancer to be created/modified.
	//TODO: once support ticket 21807001 is resolved, reduce this timeout back to something reasonable
	LoadBalancerCreateTimeoutDefault = 20 * time.Minute
	LoadBalancerCreateTimeoutLarge   = 2 * time.Hour

	// Time required by the loadbalancer to cleanup, proportional to numApps/Ing.
	// Bring the cleanup timeout back down to 5m once b/33588344 is resolved.
	LoadBalancerCleanupTimeout = 15 * time.Minute

	// On average it takes ~6 minutes for a single backend to come online in GCE.
	LoadBalancerPollTimeout  = 15 * time.Minute
	LoadBalancerPollInterval = 30 * time.Second

	LargeClusterMinNodesNumber = 100

	// Don't test with more than 3 nodes.
	// Many tests create an endpoint per node, in large clusters, this is
	// resource and time intensive.
	MaxNodesForEndpointsTests = 3

	// ServiceTestTimeout is used for most polling/waiting activities
	ServiceTestTimeout = 60 * time.Second

	// GCPMaxInstancesInInstanceGroup is the maximum number of instances supported in
	// one instance group on GCP.
	GCPMaxInstancesInInstanceGroup = 2000

	// OCI LB Shape Update Timeout
	OCILBShapeUpdateTimeout = 5 * time.Minute

	// OCI LB NSG Update Timeout
	OCILBNSGUpdateTimeout = 5 * time.Minute
)
View Source
const (
	BackupType            = "backupType"
	BackupTypeIncremental = "incremental"
	BackupTypeFull        = "full"
)
View Source
const (
	// How long to try single API calls (like 'get' or 'list'). Used to prevent
	// transient failures from failing tests.
	// TODO: client should not apply this timeout to Watch calls. Increased from 30s until that is fixed.
	SingleCallTimeout = 5 * time.Minute
)

Variables

View Source
var (
	// SSL CAData is a CA certificate not being used anywhere else; it only is utilised to check the load
	// balancer SSL connection during tests
	SSLCAData = `` /* 976-byte string literal not displayed */

	SSLCertificateData = `` /* 1451-byte string literal not displayed */

	SSLPrivateData = `` /* 1674-byte string literal not displayed */

	SSLPassphrase = ""
)
View Source
var ErrJobFailed = fmt.Errorf("Job failed")
View Source
var ServiceNodePortRange = utilnet.PortRange{Base: 30000, Size: 2768}

This should match whatever the default/configured range is

Functions

func CheckPodsCondition

func CheckPodsCondition(c clientset.Interface, ns string, podNames []string, timeout time.Duration, condition podCondition, desc string) bool

CheckPodsCondition returns whether all pods whose names are listed in podNames in namespace ns are in the condition, using c and waiting at most timeout.

func CheckPodsRunningReady

func CheckPodsRunningReady(c clientset.Interface, ns string, podNames []string, timeout time.Duration) bool

CheckPodsRunningReady returns whether all pods whose names are listed in podNames in namespace ns are running and ready, using c and waiting at most timeout.

func CollectAddresses

func CollectAddresses(nodes *v1.NodeList, addressType v1.NodeAddressType) []string

func CountEgressSinglePortRules

func CountEgressSinglePortRules(oci client.Interface, seclistID string, port int) int

CountEgressSinglePortRules counts the number of 'single port' (non-ranged) egress rules for the specified seclist and port. If no client or seclist is provided, then 0 is returned.

func CountIngressSinglePortRules

func CountIngressSinglePortRules(oci client.Interface, seclistID string, port int) int

CountIngressSinglePortRules counts the number of 'single port' (non-ranged) ingress rules for the specified seclist and port. If no client or seclist is provided, then 0 is returned.

func CountSinglePortSecListRules

func CountSinglePortSecListRules(oci client.Interface, egressSecListID, ingressSecListID string, port int) (int, int)

CountSinglePortSecListRules counts the number of 'single port' (non-ranged) egress/ingress rules for the specified list and port.

func CreateExecPodOrFail

func CreateExecPodOrFail(client clientset.Interface, ns, generateName string, tweak func(*v1.Pod)) string

CreateExecPodOrFail creates a simple busybox pod in a sleep loop used as a vessel for kubectl exec commands. Returns the name of the created pod.

func CreateServiceSpec

func CreateServiceSpec(serviceName, externalName string, isHeadless bool, selector map[string]string) *v1.Service

func DeleteRCAndWaitForGC

func DeleteRCAndWaitForGC(c clientset.Interface, ns, name string) error

DeleteRCAndWaitForGC deletes only the Replication Controller and waits for GC to delete the pods.

func DeleteResourceAndWaitForGC

func DeleteResourceAndWaitForGC(c clientset.Interface, kind schema.GroupKind, ns, name string) error

DeleteResourceAndWaitForGC deletes only given resource and waits for GC to delete the pods.

func EnableAndDisableInternalLB

func EnableAndDisableInternalLB() (enable func(svc *v1.Service), disable func(svc *v1.Service))

EnableAndDisableInternalLB returns two functions for enabling and disabling the internal load balancer setting for the supported cloud providers: GCE/GKE and Azure

func EnsureLoadBalancerResourcesDeleted

func EnsureLoadBalancerResourcesDeleted(ip, portRange string) error

EnsureLoadBalancerResourcesDeleted ensures that cloud load balancer resources that were created are actually cleaned up.

func ExpectNoError

func ExpectNoError(err error, explain ...interface{})

func ExpectNoErrorWithOffset

func ExpectNoErrorWithOffset(offset int, err error, explain ...interface{})

ExpectNoErrorWithOffset checks if "err" is set, and if so, fails assertion while logging the error at "offset" levels above its caller (for example, for call chain f -> g -> ExpectNoErrorWithOffset(1, ...) error would be logged for "f").

func Failf

func Failf(format string, args ...interface{})

func FailfWithOffset

func FailfWithOffset(offset int, format string, args ...interface{})

FailfWithOffset calls "Fail" and logs the error at "offset" levels above its caller (for example, for call chain f -> g -> FailfWithOffset(1, ...) error would be logged for "f").

func FilterNodes

func FilterNodes(nodeList *v1.NodeList, fn func(node v1.Node) bool)

Filters nodes in NodeList in place, removing nodes that do not satisfy the given condition TODO: consider merging with pkg/client/cache.NodeLister

func GetIngressPoint

func GetIngressPoint(ing *v1.LoadBalancerIngress) string

func GetNodeAddresses

func GetNodeAddresses(node *v1.Node, addressType v1.NodeAddressType) (ips []string)

func GetNodePublicIps

func GetNodePublicIps(c clientset.Interface) ([]string, error)

func GetReadySchedulableNodesOrDie

func GetReadySchedulableNodesOrDie(c clientset.Interface) (nodes *v1.NodeList)

GetReadySchedulableNodesOrDie addresses the common use case of getting nodes you can do work on. 1) Needs to be schedulable. 2) Needs to be ready. If EITHER 1 or 2 is not true, most tests will want to ignore the node entirely.

func HasValidSinglePortEgressRulesAfterPortChange

func HasValidSinglePortEgressRulesAfterPortChange(oci client.Interface, seclistID string, expectedRuleCount, oldPort, newPort int) bool

HasValidSinglePortEgressRulesAfterPortChange checks the counts of 'single port' (non-ranged) egress rules in the provided seclist after a service port change.

func HasValidSinglePortIngressRulesAfterPortChange

func HasValidSinglePortIngressRulesAfterPortChange(oci client.Interface, seclistID string, expectedRuleCount, oldPort, newPort int) bool

HasValidSinglePortIngressRulesAfterPortChange checks the counts of 'single port' (non-ranged) egress rules in the provided seclist after a service port change.

func IsNodeConditionSetAsExpected

func IsNodeConditionSetAsExpected(node *v1.Node, conditionType v1.NodeConditionType, wantTrue bool) bool

func IsNodeConditionSetAsExpectedSilent

func IsNodeConditionSetAsExpectedSilent(node *v1.Node, conditionType v1.NodeConditionType, wantTrue bool) bool

func IsNodeConditionUnset

func IsNodeConditionUnset(node *v1.Node, conditionType v1.NodeConditionType) bool

func IsRetryableAPIError

func IsRetryableAPIError(err error) bool

func KubectlCmd

func KubectlCmd(args ...string) *exec.Cmd

KubectlCmd runs the kubectl executable through the wrapper script.

func Logf

func Logf(format string, args ...interface{})

func NewKubectlCommand

func NewKubectlCommand(args ...string) *kubectlBuilder

func PickNodeIP

func PickNodeIP(c clientset.Interface) string

func PodToleratesNodeTaints

func PodToleratesNodeTaints(pod *v1.Pod, nodeInfo *scheduler.NodeInfo) (bool, error)

func RemoveCleanupAction

func RemoveCleanupAction(p CleanupActionHandle)

RemoveCleanupAction removes a function that was installed by AddCleanupAction.

func RunCleanupActions

func RunCleanupActions()

RunCleanupActions runs all functions installed by AddCleanupAction. It does not remove them (see RemoveCleanupAction) but it does run unlocked, so they may remove themselves.

func RunHostCmd

func RunHostCmd(ns, name, cmd string) (string, error)

RunHostCmd runs the given cmd in the context of the given pod using `kubectl exec` inside of a shell.

func RunKubectl

func RunKubectl(args ...string) (string, error)

RunKubectl is a convenience wrapper over kubectlBuilder

func TestHitNodesFromOutside

func TestHitNodesFromOutside(externalIP string, httpPort int32, timeout time.Duration, expectedHosts sets.String) error

func TestHitNodesFromOutsideWithCount

func TestHitNodesFromOutsideWithCount(externalIP string, httpPort int32, timeout time.Duration, expectedHosts sets.String,
	countToSucceed int) error

func TestNotReachableHTTP

func TestNotReachableHTTP(ip string, port int) (bool, error)

func TestNotReachableHTTPTimeout

func TestNotReachableHTTPTimeout(ip string, port int, timeout time.Duration) (bool, error)

func TestNotReachableUDP

func TestNotReachableUDP(ip string, port int, request string) (bool, error)

func TestReachableHTTP

func TestReachableHTTP(secure bool, ip string, port int, request string, expect string) (bool, error)

func TestReachableHTTPWithContent

func TestReachableHTTPWithContent(secure bool, ip string, port int, request string, expect string, content *bytes.Buffer) (bool, error)

func TestReachableHTTPWithContentTimeout

func TestReachableHTTPWithContentTimeout(secure bool, ip string, port int, request string, expect string, content *bytes.Buffer, timeout time.Duration) (bool, error)

func TestReachableHTTPWithContentTimeoutWithRetriableErrorCodes

func TestReachableHTTPWithContentTimeoutWithRetriableErrorCodes(secure bool, ip string, port int, request string, expect string, content *bytes.Buffer, retriableErrCodes []int, timeout time.Duration) (bool, error)

func TestReachableHTTPWithRetriableErrorCodes

func TestReachableHTTPWithRetriableErrorCodes(secure bool, ip string, port int, request string, expect string, retriableErrCodes []int) (bool, error)

func TestReachableUDP

func TestReachableUDP(ip string, port int, request string, expect string) (bool, error)

func UniqueID

func UniqueID() string

UniqueID returns a unique UUID-like identifier for use in generating resources for integration tests.

func UpdateService

func UpdateService(c clientset.Interface, namespace, serviceName string, update func(*v1.Service)) (*v1.Service, error)

UpdateService fetches a service, calls the update function on it, and then attempts to send the updated service. It retries up to 2 times in the face of timeouts and conflicts.

func WaitForPodCondition

func WaitForPodCondition(c clientset.Interface, ns, podName, desc string, timeout time.Duration, condition podCondition) error

WaitForPodCondition waits for a Pod to satisfy a condition.

func WaitForSinglePortEgressRulesAfterPortChangeOrFail

func WaitForSinglePortEgressRulesAfterPortChangeOrFail(oci client.Interface, seclistID string, expectedRuleCount, oldPort, newPort int)

WaitForSinglePortEgressRulesAfterPortChangeOrFail waits for the expected number of 'single port' (non-ranged) egress rules to be present in the specified seclist or fails.

func WaitForSinglePortIngressRulesAfterPortChangeOrFail

func WaitForSinglePortIngressRulesAfterPortChangeOrFail(oci client.Interface, seclistID string, expectedRuleCount, oldPort, newPort int)

WaitForSinglePortIngressRulesAfterPortChangeOrFail waits for the expected number of 'single port' (non-ranged) ingress rules to be present in the specified seclist or fails.

Types

type CleanupActionHandle

type CleanupActionHandle *int

func AddCleanupAction

func AddCleanupAction(fn func()) CleanupActionHandle

AddCleanupAction installs a function that will be called in the event of the whole test being terminated. This allows arbitrary pieces of the overall test to hook into SynchronizedAfterSuite().

type CloudProviderFramework

type CloudProviderFramework struct {
	BaseName string

	InitCloudProvider bool                    // Whether to initialise a cloud provider interface for testing
	CloudProvider     cloudprovider.Interface // Every test has a cloud provider unless initialisation is skipped

	ClientSet     clientset.Interface
	SnapClientSet snapclientset.Interface
	CRDClientSet  crdclientset.Interface

	CloudProviderConfig *providercfg.Config // If specified, the CloudProviderConfig. This provides information on the configuration of the test cluster.
	Client              client.Interface    // An OCI client for checking the state of any provisioned OCI infrastructure during testing.
	NodePortTest        bool                // An optional configuration for E2E testing. If set to true, then will run additional E2E nodePort connectivity checks during testing.
	CCMSecListID        string              // An optional configuration for E2E testing. If present can be used to run additional checks against seclist during testing.
	K8SSecListID        string              // An optional configuration for E2E testing. If present can be used to run additional checks against seclist during testing.

	SkipNamespaceCreation bool          // Whether to skip creating a namespace
	Namespace             *v1.Namespace // Every test has at least one namespace unless creation is skipped
	Secret                *v1.Secret    // Every test has at least one namespace unless creation is skipped

	BlockStorageClient ocicore.BlockstorageClient
	IsBackup           bool
	BackupIDs          []string
	StorageClasses     []string
	VolumeIds          []string

	VolumeSnapshotClasses []string
	// contains filtered or unexported fields
}

CloudProviderFramework is used in the execution of e2e tests.

func NewBackupFramework

func NewBackupFramework(baseName string) *CloudProviderFramework

NewBackupFramework constructs a new e2e test Framework initialising a storage client used to create a backup

func NewCcmFramework

func NewCcmFramework(baseName string, client clientset.Interface, backup bool) *CloudProviderFramework

NewCcmFramework constructs a new e2e test CloudProviderFramework.

func NewDefaultFramework

func NewDefaultFramework(baseName string) *CloudProviderFramework

NewDefaultFramework constructs a new e2e test CloudProviderFramework with default options.

func NewFrameworkWithCloudProvider

func NewFrameworkWithCloudProvider(baseName string) *CloudProviderFramework

NewFrameworkWithCloudProvider constructs a new e2e test CloudProviderFramework for testing cloudprovider.Interface directly.

func (*CloudProviderFramework) AfterEach

func (f *CloudProviderFramework) AfterEach()

AfterEach deletes the namespace(s).

func (*CloudProviderFramework) BeforeEach

func (f *CloudProviderFramework) BeforeEach()

BeforeEach gets a client and makes a namespace.

func (*CloudProviderFramework) CheckExportExists added in v1.24.1

func (f *CloudProviderFramework) CheckExportExists(ctx context.Context, fsId, exportPath, exportSetId string) bool

func (*CloudProviderFramework) CheckFSVolumeExist added in v1.24.1

func (f *CloudProviderFramework) CheckFSVolumeExist(ctx context.Context, fsId string) bool

func (*CloudProviderFramework) CreateCSIDriverOrFail added in v1.22.0

func (f *CloudProviderFramework) CreateCSIDriverOrFail(name string,
	testLabels map[string]string, fsGroupPolicy storagev1.FSGroupPolicy) string

CreateCSIDriverOrFail creates a new storage class based on the jig's defaults.

func (*CloudProviderFramework) CreateNamespace

func (f *CloudProviderFramework) CreateNamespace(baseName string, labels map[string]string) (*v1.Namespace, error)

CreateNamespace creates a e2e test namespace.

func (*CloudProviderFramework) CreateStorageClassOrFail

func (f *CloudProviderFramework) CreateStorageClassOrFail(name string, provisionerType string,
	parameters map[string]string, testLabels map[string]string, bindingMode string, allowVolumeExpansion bool, reclaimPolicy string, mountOptions []string) string

CreateStorageClassOrFail creates a new storage class based on the jig's defaults.

func (*CloudProviderFramework) CreateVolumeSnapshotClassOrFail added in v1.24.2

func (f *CloudProviderFramework) CreateVolumeSnapshotClassOrFail(name string, driverType string,
	parameters map[string]string, deletionPolicy string) string

CreateVolumeSnapshotClassOrFail creates a new volume snapshot class based on the jig's defaults.

func (*CloudProviderFramework) DeleteCSIDriver added in v1.22.0

func (f *CloudProviderFramework) DeleteCSIDriver(name string) error

DeleteCSIDriver deletes a CSI Driver given the name

func (*CloudProviderFramework) DeleteNamespace

func (f *CloudProviderFramework) DeleteNamespace(namespace string, timeout time.Duration) error

DeleteNamespace deletes a given namespace and waits until its contents are deleted.

func (*CloudProviderFramework) DeleteStorageClass

func (f *CloudProviderFramework) DeleteStorageClass(name string) error

DeleteStorageClass deletes a storage class given the name

func (*CloudProviderFramework) DeleteVolumeSnapshotClass added in v1.24.2

func (f *CloudProviderFramework) DeleteVolumeSnapshotClass(name string) error

DeleteVolumeSnapshotClass deletes a volume snapshot class given the name

func (*CloudProviderFramework) GetExportsSetIdByMountTargetId added in v1.24.1

func (f *CloudProviderFramework) GetExportsSetIdByMountTargetId(ctx context.Context, mountTargetId string) (string, error)

func (*CloudProviderFramework) GetFSIdByDisplayName added in v1.24.1

func (f *CloudProviderFramework) GetFSIdByDisplayName(ctx context.Context, compartmentId, adLocation, pvName string) (string, error)

func (*CloudProviderFramework) NewVolumeSnapshotClassTemplate added in v1.24.2

func (f *CloudProviderFramework) NewVolumeSnapshotClassTemplate(name string, parameters map[string]string,
	driverType string, deletionPolicy snapshot.DeletionPolicy) *snapshot.VolumeSnapshotClass

NewVolumeSnapshotClassTemplate returns the default template for this jig, but does not actually create the storage class. The default storage class has the same name as the jig

func (*CloudProviderFramework) UpdateStorageClassOrFail

func (f *CloudProviderFramework) UpdateStorageClassOrFail(storageClass *storagev1.StorageClass, allowVolumeExpansion bool,
	tweak func(sc *storagev1.StorageClass)) (*storagev1.StorageClass, error)

func (*CloudProviderFramework) VerifyHealthCheckConfig

func (f *CloudProviderFramework) VerifyHealthCheckConfig(loadBalancerId string, retries, timeout, interval int, lbtype string) error

func (*CloudProviderFramework) VerifyLoadBalancerConnectionIdleTimeout

func (f *CloudProviderFramework) VerifyLoadBalancerConnectionIdleTimeout(loadBalancerId string, connectionIdleTimeout int) error

func (*CloudProviderFramework) VerifyLoadBalancerPolicy

func (f *CloudProviderFramework) VerifyLoadBalancerPolicy(loadBalancerId string, loadbalancerPolicy string, lbtype string) error

func (*CloudProviderFramework) WaitForLoadBalancerNSGChange

func (f *CloudProviderFramework) WaitForLoadBalancerNSGChange(lb *client.GenericLoadBalancer, nsgIds []string, lbtype string) error

WaitForLoadBalancerNSGChange polls for validating the associated NSGs to be the same as the spec

func (*CloudProviderFramework) WaitForLoadBalancerShapeChange

func (f *CloudProviderFramework) WaitForLoadBalancerShapeChange(lb *client.GenericLoadBalancer, shape, fMin, fMax string) error

WaitForLoadBalancerShapeChange polls for the shape of the LB to be the same as the spec

type Framework

type Framework struct {
	// The compartment1 the cluster is running in.
	Compartment1 string
	// Default adLocation
	AdLocation string

	// Default adLocation
	AdLabel string

	//is cluster creation required
	EnableCreateCluster bool

	ClusterKubeconfigPath string

	CloudConfigPath string

	MntTargetOcid            string
	MntTargetSubnetOcid      string
	MntTargetCompartmentOcid string
	CMEKKMSKey               string
	NsgOCIDS                 string
	ReservedIP               string
	Architecture             string

	VolumeHandle string

	// Compartment ID for cross compartment snapshot test
	StaticSnapshotCompartmentOcid string
}

Framework is the context of the text execution.

func New

func New() *Framework

New creates a new a framework that holds the context of the test execution.

func NewWithConfig

func NewWithConfig() *Framework

NewWithConfig creates a new Framework instance and configures the instance as per the configuration options in the given config.

func (*Framework) Initialize

func (f *Framework) Initialize()

BeforeEach will be executed before each Ginkgo test is executed.

type KubeClient

type KubeClient struct {
	Client clientset.Interface
	// contains filtered or unexported fields
}

func NewKubeClient

func NewKubeClient(kubeConfig string) *KubeClient

func (*KubeClient) AddLabelsToNode

func (kc *KubeClient) AddLabelsToNode(nodeName string, labelValues map[string]string)

The function labels the node specified by the nodeName with labels specified by map labelValues.

func (*KubeClient) CheckNodes

func (kc *KubeClient) CheckNodes(expectedNumNodes int)

func (*KubeClient) CheckPods

func (kc *KubeClient) CheckPods(expectedNumPods int)

Check the number of pods reported by k8s in the cluster

func (*KubeClient) CheckVersion

func (kc *KubeClient) CheckVersion(serverVersion string)

Check that k8s reports the expected server version

func (*KubeClient) CheckVersionSucceeds

func (kc *KubeClient) CheckVersionSucceeds() (string, error)

CheckVersionSucceeds checks that the client can successfully fetch the version

func (*KubeClient) CreatePod

func (kc *KubeClient) CreatePod(pod *v1.Pod) (*v1.Pod, error)

func (*KubeClient) DeletePod

func (kc *KubeClient) DeletePod(namespace string, name string, timeout time.Duration) error

func (*KubeClient) Exec

func (kc *KubeClient) Exec(namespace, podName, containerName string, command []string) (string, error)

Exec executes a command in the specified container, returning stdout, stderr and error. `options` allowed for additional parameters to be passed.

func (*KubeClient) GetPodIP

func (kc *KubeClient) GetPodIP(namespace string, name string) string

func (*KubeClient) NamespaceExists

func (kc *KubeClient) NamespaceExists(ns string) bool

func (*KubeClient) PodLogs

func (kc *KubeClient) PodLogs(namespace string, name string) (string, error)

func (*KubeClient) WaitForPodFailure

func (kc *KubeClient) WaitForPodFailure(namespace string, name string, errorMessage string, timeout time.Duration)

func (*KubeClient) WaitForPodRunning

func (kc *KubeClient) WaitForPodRunning(namespace string, name string, timeout time.Duration)

func (*KubeClient) WaitForPodSuccess

func (kc *KubeClient) WaitForPodSuccess(namespace string, name string, timeout time.Duration)

type PVCTestJig

type PVCTestJig struct {
	ID                 string
	Name               string
	Labels             map[string]string
	BlockStorageClient *ocicore.BlockstorageClient
	KubeClient         clientset.Interface

	SnapClient snapclientset.Interface
	// contains filtered or unexported fields
}

PVCTestJig is a jig to help create PVC tests.

func NewPVCTestJig

func NewPVCTestJig(kubeClient clientset.Interface, name string) *PVCTestJig

NewPVCTestJig allocates and inits a new PVCTestJig.

func (*PVCTestJig) ChangePVReclaimPolicy added in v1.24.2

func (j *PVCTestJig) ChangePVReclaimPolicy(pvName string, newReclaimPolicy string) error

func (*PVCTestJig) CheckAndAwaitPVCOrFail

func (j *PVCTestJig) CheckAndAwaitPVCOrFail(pvc *v1.PersistentVolumeClaim, namespace string,
	pvcPhase v1.PersistentVolumeClaimPhase) *v1.PersistentVolumeClaim

func (*PVCTestJig) CheckAndAwaitVolumeSnapshotOrFail added in v1.24.2

func (j *PVCTestJig) CheckAndAwaitVolumeSnapshotOrFail(vs *snapshot.VolumeSnapshot, namespace string) *snapshot.VolumeSnapshot

func (*PVCTestJig) CheckAttachmentTypeAndEncryptionType

func (j *PVCTestJig) CheckAttachmentTypeAndEncryptionType(compute client.ComputeInterface, pvcName, namespace, podName, expectedAttachmentType string)

CheckAttachmentTypeAndEncryptionType verifies attachment type and encryption type

func (*PVCTestJig) CheckCMEKKey

func (j *PVCTestJig) CheckCMEKKey(bs client.BlockStorageInterface, pvcName, namespace, kmsKeyIDExpected string)

CheckCMEKKey verifies the expected and actual CMEK key

func (*PVCTestJig) CheckDataPersistenceWithDeployment

func (j *PVCTestJig) CheckDataPersistenceWithDeployment(pvcName string, ns string)

func (*PVCTestJig) CheckEncryptionType

func (j *PVCTestJig) CheckEncryptionType(namespace, podName string)

CheckEncryptionType verifies encryption type

func (*PVCTestJig) CheckExpandedVolumeReadWrite

func (j *PVCTestJig) CheckExpandedVolumeReadWrite(namespace string, podName string)

CheckExpandedVolumeReadWrite checks a pvc expanded pod with a dymincally provisioned volume

func (*PVCTestJig) CheckFileCorruption

func (j *PVCTestJig) CheckFileCorruption(namespace string, podName string, dir string, fileName string)

func (*PVCTestJig) CheckFileExists

func (j *PVCTestJig) CheckFileExists(namespace string, podName string, dir string, fileName string)

func (*PVCTestJig) CheckFilesystemTypeOfVolumeInsidePod added in v1.24.0

func (j *PVCTestJig) CheckFilesystemTypeOfVolumeInsidePod(namespace string, podName string, expectedFsType string)

CheckFilesystemTypeOfVolumeInsidePod Checks the volume is provisioned with FsType as requested

func (*PVCTestJig) CheckISCSIQueueDepthOnNode added in v1.19.12

func (j *PVCTestJig) CheckISCSIQueueDepthOnNode(namespace, podName string)

func (*PVCTestJig) CheckMountOptions added in v1.24.1

func (j *PVCTestJig) CheckMountOptions(namespace string, podName string, expectedPath string, expectedOptions []string)

func (*PVCTestJig) CheckMultiplePodReadWrite

func (j *PVCTestJig) CheckMultiplePodReadWrite(namespace string, pvcName string, checkEncryption bool)

func (*PVCTestJig) CheckPVCorFail

func (j *PVCTestJig) CheckPVCorFail(pvc *v1.PersistentVolumeClaim, tweak func(pvc *v1.PersistentVolumeClaim),
	namespace, volumeSize string) *v1.PersistentVolumeClaim

func (*PVCTestJig) CheckPVExists added in v1.24.1

func (j *PVCTestJig) CheckPVExists(pvName string) bool

func (*PVCTestJig) CheckSinglePodReadWrite

func (j *PVCTestJig) CheckSinglePodReadWrite(namespace string, pvcName string, checkEncryption bool, expectedMountOptions []string)

func (*PVCTestJig) CheckUsableVolumeSizeInsidePod

func (j *PVCTestJig) CheckUsableVolumeSizeInsidePod(namespace string, podName string, capacity string)

CheckUsableVolumeSizeInsidePod checks a pvc expanded pod with a dymincally provisioned volume

func (*PVCTestJig) CheckVSContentExists added in v1.24.2

func (j *PVCTestJig) CheckVSContentExists(pvName string) bool

func (*PVCTestJig) CheckVSorFail added in v1.24.2

func (j *PVCTestJig) CheckVSorFail(vs *snapshot.VolumeSnapshot, tweak func(vs *snapshot.VolumeSnapshot),
	namespace string, pvcName string) *snapshot.VolumeSnapshot

func (*PVCTestJig) CheckVolumeCapacity

func (j *PVCTestJig) CheckVolumeCapacity(expected string, name string, namespace string)

CheckVolumeCapacity verifies the Capacity of Volume provisioned.

func (*PVCTestJig) CheckVolumeDirectoryOwnership

func (j *PVCTestJig) CheckVolumeDirectoryOwnership(namespace string, pvcParam *v1.PersistentVolumeClaim)

CheckVolumeDirectoryOwnership creates a pod with a dynamically provisioned volume

func (*PVCTestJig) CheckVolumeMount

func (j *PVCTestJig) CheckVolumeMount(namespace string, pvcParam *v1.PersistentVolumeClaim)

CheckVolumeMount creates a pod with a dynamically provisioned volume

func (*PVCTestJig) CheckVolumePerformanceLevel added in v1.19.12

func (j *PVCTestJig) CheckVolumePerformanceLevel(bs ocicore.BlockstorageClient, namespace, name string, expectedPerformanceLevel int64)

CheckVolumePerformanceLevel verifies the Performance level of Volume provisioned.

func (*PVCTestJig) CheckVolumeReadWrite

func (j *PVCTestJig) CheckVolumeReadWrite(namespace string, pvcParam *v1.PersistentVolumeClaim)

CheckVolumeReadWrite creates a pod with a dynamically provisioned volume

func (*PVCTestJig) CreateAndAwaitClonePVCOrFailCSI added in v1.25.2

func (j *PVCTestJig) CreateAndAwaitClonePVCOrFailCSI(namespace, volumeSize, scName, sourcePvc string,
	tweak func(pvc *v1.PersistentVolumeClaim), volumeMode v1.PersistentVolumeMode, accessMode v1.PersistentVolumeAccessMode, expectedPVCPhase v1.PersistentVolumeClaimPhase) *v1.PersistentVolumeClaim

func (*PVCTestJig) CreateAndAwaitNginxPodOrFail

func (j *PVCTestJig) CreateAndAwaitNginxPodOrFail(ns string, pvc *v1.PersistentVolumeClaim, command string) string

CreateAndAwaitNginxPodOrFail returns a pod definition based on the namespace using nginx image

func (*PVCTestJig) CreateAndAwaitPVCOrFail

func (j *PVCTestJig) CreateAndAwaitPVCOrFail(namespace, volumeSize, scName, adLabel string,
	tweak func(pvc *v1.PersistentVolumeClaim)) *v1.PersistentVolumeClaim

CreateAndAwaitPVCOrFail creates a new PVC based on the jig's defaults, waits for it to become ready, and then sanity checks it and its dependant resources. Callers can provide a function to tweak the PVC object before it is created.

func (*PVCTestJig) CreateAndAwaitPVCOrFailCSI

func (j *PVCTestJig) CreateAndAwaitPVCOrFailCSI(namespace, volumeSize, scName string,
	tweak func(pvc *v1.PersistentVolumeClaim), volumeMode v1.PersistentVolumeMode, accessMode v1.PersistentVolumeAccessMode, expectedPVCPhase v1.PersistentVolumeClaimPhase) *v1.PersistentVolumeClaim

CreateAndAwaitPVCOrFailCSI creates a new PVC based on the jig's defaults, waits for it to become ready, and then sanity checks it and its dependant resources. Callers can provide a function to tweak the PVC object before it is created.

func (*PVCTestJig) CreateAndAwaitPVCOrFailDynamicFSS added in v1.24.1

func (j *PVCTestJig) CreateAndAwaitPVCOrFailDynamicFSS(namespace, volumeSize, scName string,
	phase v1.PersistentVolumeClaimPhase, tweak func(pvc *v1.PersistentVolumeClaim)) *v1.PersistentVolumeClaim

CreateAndAwaitPVCOrFailDynamicFSS creates a new PVC based on the jig's defaults, waits for it to become ready, and then sanity checks it and its dependant resources. Callers can provide a function to tweak the PVC object before it is created.

func (*PVCTestJig) CreateAndAwaitPVCOrFailSnapshotSource added in v1.24.2

func (j *PVCTestJig) CreateAndAwaitPVCOrFailSnapshotSource(namespace, volumeSize, scName string,
	vsName string, phase v1.PersistentVolumeClaimPhase, tweak func(pvc *v1.PersistentVolumeClaim)) *v1.PersistentVolumeClaim

CreateAndAwaitPVCOrFailSnapshotSource creates a new PVC based on the jig's defaults, waits for it to become ready, and then sanity checks it and its dependant resources. Callers can provide a function to tweak the PVC object before it is created.

func (*PVCTestJig) CreateAndAwaitPVCOrFailStaticFSS added in v1.24.1

func (j *PVCTestJig) CreateAndAwaitPVCOrFailStaticFSS(namespace, volumeName, volumeSize string, tweak func(pvc *v1.PersistentVolumeClaim)) *v1.PersistentVolumeClaim

CreateAndAwaitPVCOrFailStaticFSS creates a new PVC based on the jig's defaults, waits for it to become ready, and then sanity checks it and its dependant resources. Callers can provide a function to tweak the PVC object before it is created.

func (*PVCTestJig) CreateAndAwaitStaticPVCOrFailCSI

func (j *PVCTestJig) CreateAndAwaitStaticPVCOrFailCSI(bs ocicore.BlockstorageClient, namespace string, volumeSize string, vpusPerGB int64, scName string, adLabel string, compartmentId string, tweak func(pvc *v1.PersistentVolumeClaim), volumeMode v1.PersistentVolumeMode, accessMode v1.PersistentVolumeAccessMode, expectedPVCPhase v1.PersistentVolumeClaimPhase) (*v1.PersistentVolumeClaim, string)

CreateAndAwaitStaticPVCOrFailCSI creates a new PV and PVC based on the jig's defaults, waits for it to become ready, and then sanity checks it and its dependant resources. Callers can provide a function to tweak the PVC object before it is created.

func (*PVCTestJig) CreateAndAwaitVolumeSnapshotOrFail added in v1.24.2

func (j *PVCTestJig) CreateAndAwaitVolumeSnapshotOrFail(namespace, vscName string, pvcName string,
	tweak func(vs *snapshot.VolumeSnapshot)) *snapshot.VolumeSnapshot

CreateAndAwaitVolumeSnapshotOrFail creates a new VS based on the jig's defaults, waits for it to become ready, and then sanity checks it and its dependant resources. Callers can provide a function to tweak the VS object before it is created.

func (*PVCTestJig) CreateAndAwaitVolumeSnapshotStaticOrFail added in v1.24.2

func (j *PVCTestJig) CreateAndAwaitVolumeSnapshotStaticOrFail(name string, ns string, vscontentName string) *snapshot.VolumeSnapshot

func (*PVCTestJig) CreateBackupVolume

func (j *PVCTestJig) CreateBackupVolume(storageClient ocicore.BlockstorageClient, pvc *v1.PersistentVolumeClaim) (string, error)

CreateBackupVolume creates a volume backup on OCI from an exsiting volume and returns the backup volume id

func (*PVCTestJig) CreateClonePVCorFailCSI added in v1.25.2

func (j *PVCTestJig) CreateClonePVCorFailCSI(namespace, volumeSize, scName, sourcePvc string,
	tweak func(pvc *v1.PersistentVolumeClaim), volumeMode v1.PersistentVolumeMode, accessMode v1.PersistentVolumeAccessMode) *v1.PersistentVolumeClaim

func (*PVCTestJig) CreatePVCTemplate

func (j *PVCTestJig) CreatePVCTemplate(namespace, volumeSize string) *v1.PersistentVolumeClaim

func (*PVCTestJig) CreatePVCorFail

func (j *PVCTestJig) CreatePVCorFail(namespace string, volumeSize string, scName string,
	adLabel string, tweak func(pvc *v1.PersistentVolumeClaim)) *v1.PersistentVolumeClaim

CreatePVCorFail creates a new claim based on the jig's defaults. Callers can provide a function to tweak the claim object before it is created.

func (*PVCTestJig) CreatePVCorFailCSI

func (j *PVCTestJig) CreatePVCorFailCSI(namespace string, volumeSize string, scName string,
	tweak func(pvc *v1.PersistentVolumeClaim), volumeMode v1.PersistentVolumeMode, accessMode v1.PersistentVolumeAccessMode) *v1.PersistentVolumeClaim

CreatePVCorFailCSI creates a new claim based on the jig's defaults. Callers can provide a function to tweak the claim object before it is created.

func (*PVCTestJig) CreatePVCorFailDynamicFSS added in v1.24.1

func (j *PVCTestJig) CreatePVCorFailDynamicFSS(namespace, volumeSize string, scName string,
	tweak func(pvc *v1.PersistentVolumeClaim)) *v1.PersistentVolumeClaim

CreatePVCorFailDynamicFSS creates a new claim based on the jig's defaults. Callers can provide a function to tweak the claim object before it is created.

func (*PVCTestJig) CreatePVCorFailSnapshotSource added in v1.24.2

func (j *PVCTestJig) CreatePVCorFailSnapshotSource(namespace, volumeSize string, scName string, vsName string,
	tweak func(pvc *v1.PersistentVolumeClaim)) *v1.PersistentVolumeClaim

CreatePVCorFailSnapshotSource creates a new claim based on the jig's defaults. Callers can provide a function to tweak the claim object before it is created.

func (*PVCTestJig) CreatePVCorFailStaticFSS added in v1.24.1

func (j *PVCTestJig) CreatePVCorFailStaticFSS(namespace, volumeName, volumeSize string, tweak func(pvc *v1.PersistentVolumeClaim)) *v1.PersistentVolumeClaim

CreatePVCorFailStaticFSS creates a new claim based on the jig's defaults. Callers can provide a function to tweak the claim object before it is created.

func (*PVCTestJig) CreatePVTemplate

func (j *PVCTestJig) CreatePVTemplate(namespace, annotation, storageClassName string,
	pvReclaimPolicy v1.PersistentVolumeReclaimPolicy) *v1.PersistentVolume

func (*PVCTestJig) CreatePVorFailCSI

func (j *PVCTestJig) CreatePVorFailCSI(namespace string, scName string, ocid string) *v1.PersistentVolume

CreatePVorFail creates a new claim based on the jig's defaults. Callers can provide a function to tweak the claim object before it is created.

func (*PVCTestJig) CreatePVorFailCSIHighPerf added in v1.19.12

func (j *PVCTestJig) CreatePVorFailCSIHighPerf(namespace string, scName string, ocid string) *v1.PersistentVolume

CreatePVorFail creates a new claim based on the jig's defaults. Callers can provide a function to tweak the claim object before it is created.

func (*PVCTestJig) CreatePVorFailFSS

func (j *PVCTestJig) CreatePVorFailFSS(namespace, volumeHandle, encryptInTransit string, mountOptions []string) *v1.PersistentVolume

CreatePVForFSSorFail creates a new claim based on the jig's defaults. Callers can provide a function to tweak the claim object before it is created.

func (*PVCTestJig) CreateVSTemplate added in v1.24.2

func (j *PVCTestJig) CreateVSTemplate(namespace string, vscName string, pvcName string) *snapshot.VolumeSnapshot

func (*PVCTestJig) CreateVolume

func (j *PVCTestJig) CreateVolume(bs ocicore.BlockstorageClient, adLabel string, compartmentId string, volName string, vpusPerGB int64) *string

CreateVolume is a function to create the block volume

func (*PVCTestJig) CreateVolumeBackup added in v1.24.2

func (j *PVCTestJig) CreateVolumeBackup(bs ocicore.BlockstorageClient, adLabel string, compartmentId string, volumeId string, backupName string) *string

CreateVolumeBackup is a function to create a block volume backup

func (*PVCTestJig) CreateVolumeSnapshotContentOrFail added in v1.24.2

func (j *PVCTestJig) CreateVolumeSnapshotContentOrFail(name string, driverType string,
	backupOCID string, deletionPolicy string, vsName string, ns string) string

CreateVolumeSnapshotContentOrFail creates a new volume snapshot content based on the jig's defaults.

func (*PVCTestJig) CreateVolumeSnapshotOrFail added in v1.24.2

func (j *PVCTestJig) CreateVolumeSnapshotOrFail(namespace string, vscName string, pvcName string,
	tweak func(vs *snapshot.VolumeSnapshot)) *snapshot.VolumeSnapshot

CreateVolumeSnapshotOrFail creates a new volume snapshot based on the jig's defaults. Callers can provide a function to tweak the volume snapshot object before it is created.

func (*PVCTestJig) DeleteAndAwaitPVC added in v1.25.2

func (j *PVCTestJig) DeleteAndAwaitPVC(namespace, pvcName string) error

func (*PVCTestJig) DeleteAndAwaitPod added in v1.25.2

func (j *PVCTestJig) DeleteAndAwaitPod(namespace, podName string) error

func (*PVCTestJig) DeleteAndAwaitPodOrFail added in v1.24.1

func (j *PVCTestJig) DeleteAndAwaitPodOrFail(ns string, podName string)

DeleteAndAwaitPodOrFail deletes the pod definition based on the namespace and waits for pod to disappear

func (*PVCTestJig) DeletePersistentVolumeClaim

func (j *PVCTestJig) DeletePersistentVolumeClaim(ns string, pvcName string) error

DeletePersistentVolumeClaim deletes the PersistentVolumeClaim with the given name / namespace.

func (*PVCTestJig) DeleteVolume added in v1.24.2

func (j *PVCTestJig) DeleteVolume(bs ocicore.BlockstorageClient, volId string)

DeleteVolume is a function to delete the block volume

func (*PVCTestJig) DeleteVolumeBackup added in v1.24.2

func (j *PVCTestJig) DeleteVolumeBackup(bs ocicore.BlockstorageClient, backupId string)

DeleteVolumeBackup is a function to delete a block volume backup

func (*PVCTestJig) DeleteVolumeSnapshot added in v1.24.2

func (j *PVCTestJig) DeleteVolumeSnapshot(ns string, vsName string) error

DeleteVolumeSnapshot deletes the VolumeSnapshot with the given name / namespace.

func (*PVCTestJig) DeleteVolumeSnapshotContent added in v1.24.2

func (j *PVCTestJig) DeleteVolumeSnapshotContent(vscontentName string) error

DeleteVolumeSnapshotContent deletes the VolumeSnapshotContent object with the given name

func (*PVCTestJig) GetBackupIDFromSnapshot added in v1.24.2

func (j *PVCTestJig) GetBackupIDFromSnapshot(vsName string, ns string) string

GetBackupIDFromSnapshot gets the backup OCID using the VolumeSnapshot

func (*PVCTestJig) GetPVCByName added in v1.24.1

func (j *PVCTestJig) GetPVCByName(pvcName, namespace string) v1.PersistentVolumeClaim

func (*PVCTestJig) GetVsContentNameFromVS added in v1.24.2

func (j *PVCTestJig) GetVsContentNameFromVS(vsName string, ns string) *string

GetVsContentNameFromVS is a function to get VS Content Name from VS

func (*PVCTestJig) InitialiseSnapClient added in v1.24.2

func (j *PVCTestJig) InitialiseSnapClient(snapClient snapclientset.Interface)

func (*PVCTestJig) NewPodForCSI

func (j *PVCTestJig) NewPodForCSI(name string, namespace string, claimName string, adLabel string) string

newPODTemplate returns the default template for this jig, creates the Pod. Attaches PVC to the Pod which is created by CSI

func (*PVCTestJig) NewPodForCSIClone added in v1.25.2

func (j *PVCTestJig) NewPodForCSIClone(name string, namespace string, claimName string, adLabel string) string

func (*PVCTestJig) NewPodForCSIFSSRead

func (j *PVCTestJig) NewPodForCSIFSSRead(matchString string, namespace string, claimName string, fileName string, encryptionEnabled bool)

NewPodForCSIFSSRead returns the CSI Fss read pod template for this jig, creates the Pod. Attaches PVC to the Pod which is created by CSI Fss. It does not have a node selector unlike the default pod template. It does a grep on the file with string matchString and goes to completion with an exit code either 0 or 1.

func (*PVCTestJig) NewPodForCSIFSSWrite

func (j *PVCTestJig) NewPodForCSIFSSWrite(name string, namespace string, claimName string, fileName string, encryptionEnabled bool) string

NewPodForCSIFSSWrite returns the CSI Fss template for this jig, creates the Pod. Attaches PVC to the Pod which is created by CSI Fss. It does not have a node selector unlike the default pod template.

func (*PVCTestJig) NewPodForCSIWithoutWait added in v1.24.1

func (j *PVCTestJig) NewPodForCSIWithoutWait(name string, namespace string, claimName string, adLabel string) string

func (*PVCTestJig) NewVolumeSnapshotContentTemplate added in v1.24.2

func (j *PVCTestJig) NewVolumeSnapshotContentTemplate(name string, backupOCID string,
	driverType string, deletionPolicy snapshot.DeletionPolicy, vsName string, ns string) *snapshot.VolumeSnapshotContent

NewVolumeSnapshotContentTemplate returns the default template for this jig, but does not actually create the storage content. The default storage content has the same name as the jig

func (*PVCTestJig) SanityCheckPV

func (j *PVCTestJig) SanityCheckPV(pvc *v1.PersistentVolumeClaim)

SanityCheckPV checks basic properties of a given volume match our expectations.

func (*PVCTestJig) UpdateAndAwaitPVCOrFailCSI

func (j *PVCTestJig) UpdateAndAwaitPVCOrFailCSI(pvc *v1.PersistentVolumeClaim, namespace, volumeSize string,
	tweak func(pvc *v1.PersistentVolumeClaim)) *v1.PersistentVolumeClaim

UpdatedAndAwaitPVCOrFailCSI updates a PVC based on the jig's defaults, waits for it to become ready, and then sanity checks it and its dependant resources. Callers can provide a function to tweak the PVC object before it is created.

func (*PVCTestJig) UpdatePVCorFail

func (j *PVCTestJig) UpdatePVCorFail(pvc *v1.PersistentVolumeClaim, tweak func(pvc *v1.PersistentVolumeClaim),
	namespace, volumeSize string) *v1.PersistentVolumeClaim

func (*PVCTestJig) UpdatePVCorFailCSI

func (j *PVCTestJig) UpdatePVCorFailCSI(pvc *v1.PersistentVolumeClaim, volumeSize string,
	tweak func(pvc *v1.PersistentVolumeClaim)) *v1.PersistentVolumeClaim

UpdatePVCorFailCSI updates a new claim based on the jig's defaults. Callers can provide a function to tweak the claim object before it is updated.

func (*PVCTestJig) WaitForPVCPhase

func (j *PVCTestJig) WaitForPVCPhase(phase v1.PersistentVolumeClaimPhase, ns string, pvcName string) error

WaitForPVCPhase waits for a PersistentVolumeClaim to be in a specific phase or until timeout occurs, whichever comes first.

func (*PVCTestJig) WaitForPVPhase

func (j *PVCTestJig) WaitForPVPhase(phase v1.PersistentVolumePhase, pvName string) error

WaitForPVPhase waits for a PersistentVolume to be in a specific phase or until timeout occurs, whichever comes first.

func (*PVCTestJig) WaitForVSReadyToUse added in v1.24.2

func (j *PVCTestJig) WaitForVSReadyToUse(ns string, vsName string) error

WaitForVSReadyToUse waits for a Volume Snapshot to be in a specific state or until timeout occurs, whichever comes first.

func (*PVCTestJig) WaitTimeoutForPVCBound added in v1.24.1

func (j *PVCTestJig) WaitTimeoutForPVCBound(pvcName, namespace string, timeout time.Duration) error

WaitTimeoutForPVCBound waits default amount of time for the specified Persistent Volume Claim to be bound.

func (*PVCTestJig) WaitTimeoutForPVNotFound added in v1.24.1

func (j *PVCTestJig) WaitTimeoutForPVNotFound(pvName string, timeout time.Duration) error

WaitTimeoutForPVNotFound waits default amount of time for the specified Persistent Volume to be terminated. If the PV Get api returns IsNotFound then the wait stops and nil is returned. If the Get api returns an error other than "not found" then that error is returned and the wait stops.

func (*PVCTestJig) WaitTimeoutForVSContentNotFound added in v1.24.2

func (j *PVCTestJig) WaitTimeoutForVSContentNotFound(vscontentName string, timeout time.Duration) error

WaitTimeoutForVSContentNotFound waits default amount of time for the specified Volume Snapshot Content to be terminated. If the VSContent Get api returns IsNotFound then the wait stops and nil is returned. If the Get api returns an error other than "not found" then that error is returned and the wait stops.

type PortsByPodName

type PortsByPodName map[string][]int

type PortsByPodUID

type PortsByPodUID map[types.UID][]int

func GetContainerPortsByPodUID

func GetContainerPortsByPodUID(endpoints *v1.Endpoints) PortsByPodUID

type ServiceTestFixture

type ServiceTestFixture struct {
	ServiceName string
	Namespace   string
	Client      clientset.Interface

	TestId string
	Labels map[string]string

	Name  string
	Image string
	// contains filtered or unexported fields
}

Simple helper class to avoid too much boilerplate in tests

func NewServerTest

func NewServerTest(client clientset.Interface, namespace string, serviceName string) *ServiceTestFixture

func (*ServiceTestFixture) BuildServiceSpec

func (t *ServiceTestFixture) BuildServiceSpec() *v1.Service

Build default config for a service (which can then be changed)

func (*ServiceTestFixture) Cleanup

func (t *ServiceTestFixture) Cleanup() []error

func (*ServiceTestFixture) CreateRC

CreateRC creates a replication controller and records it for cleanup.

func (*ServiceTestFixture) CreateService

func (t *ServiceTestFixture) CreateService(service *v1.Service) (*v1.Service, error)

Create a service, and record it for cleanup

func (*ServiceTestFixture) DeleteService

func (t *ServiceTestFixture) DeleteService(serviceName string) error

Delete a service, and remove it from the cleanup list

type ServiceTestJig

type ServiceTestJig struct {
	ID     string
	Name   string
	Client clientset.Interface
	Labels map[string]string
}

A test jig to help service testing.

func NewServiceTestJig

func NewServiceTestJig(client clientset.Interface, name string) *ServiceTestJig

NewServiceTestJig allocates and inits a new ServiceTestJig.

func (*ServiceTestJig) AddRCAntiAffinity

func (j *ServiceTestJig) AddRCAntiAffinity(rc *v1.ReplicationController)

func (*ServiceTestJig) ChangeServiceNodePortOrFail

func (j *ServiceTestJig) ChangeServiceNodePortOrFail(namespace, name string, initial int) *v1.Service

func (*ServiceTestJig) ChangeServiceType

func (j *ServiceTestJig) ChangeServiceType(namespace, name string, newType v1.ServiceType, timeout time.Duration)

func (*ServiceTestJig) CreateExternalNameServiceOrFail

func (j *ServiceTestJig) CreateExternalNameServiceOrFail(namespace string, tweak func(svc *v1.Service)) *v1.Service

CreateExternalNameServiceOrFail creates a new ExternalName type Service based on the jig's defaults. Callers can provide a function to tweak the Service object before it is created.

func (*ServiceTestJig) CreateJobRunningScript

func (j *ServiceTestJig) CreateJobRunningScript(ns string, script string, backOffLimit int32, name string)

Creates a new job which will run a pod with the centos container running the given script

func (*ServiceTestJig) CreateLoadBalancerService

func (j *ServiceTestJig) CreateLoadBalancerService(namespace, serviceName string, timeout time.Duration, tweak func(svc *v1.Service)) *v1.Service

CreateLoadBalancerService creates a loadbalancer service and waits for it to acquire an ingress IP.

func (*ServiceTestJig) CreateOnlyLocalLoadBalancerService

func (j *ServiceTestJig) CreateOnlyLocalLoadBalancerService(namespace, serviceName string, timeout time.Duration, createPod bool, creationAnnotations map[string]string,
	tweak func(svc *v1.Service)) *v1.Service

CreateOnlyLocalLoadBalancerService creates a loadbalancer service with ExternalTrafficPolicy set to Local and waits for it to acquire an ingress IP. If createPod is true, it also creates an RC with 1 replica of the standard agnhost container used everywhere in this test.

func (*ServiceTestJig) CreateOnlyLocalNodePortService

func (j *ServiceTestJig) CreateOnlyLocalNodePortService(namespace, serviceName string, createPod bool) *v1.Service

CreateOnlyLocalNodePortService creates a NodePort service with ExternalTrafficPolicy set to Local and sanity checks its nodePort. If createPod is true, it also creates an RC with 1 replica of the standard agnhost container used everywhere in this test.

func (*ServiceTestJig) CreatePDBOrFail

func (j *ServiceTestJig) CreatePDBOrFail(namespace string, rc *v1.ReplicationController) *policyv1beta1.PodDisruptionBudget

func (*ServiceTestJig) CreateServiceAccountOrFail added in v1.25.2

func (j *ServiceTestJig) CreateServiceAccountOrFail(namespace, name string, tweak func(svc *v1.ServiceAccount)) *v1.ServiceAccount

CreateServiceAccountOrFail creates a new Service Account based on the default SA template in the namespace and with a name provided by the caller. Callers can provide a function to tweak the Service object before it is created.

func (*ServiceTestJig) CreateTCPServiceOrFail

func (j *ServiceTestJig) CreateTCPServiceOrFail(namespace string, tweak func(svc *v1.Service)) *v1.Service

CreateTCPServiceOrFail creates a new TCP Service based on the jig's defaults. Callers can provide a function to tweak the Service object before it is created.

func (*ServiceTestJig) CreateTCPServiceWithPort

func (j *ServiceTestJig) CreateTCPServiceWithPort(namespace string, tweak func(svc *v1.Service), port int32) *v1.Service

CreateTCPServiceWithPort creates a new TCP Service with given port based on the jig's defaults. Callers can provide a function to tweak the Service object before it is created.

func (*ServiceTestJig) CreateUDPServiceOrFail

func (j *ServiceTestJig) CreateUDPServiceOrFail(namespace string, tweak func(svc *v1.Service)) *v1.Service

CreateUDPServiceOrFail creates a new UDP Service based on the jig's defaults. Callers can provide a function to tweak the Service object before it is created.

func (*ServiceTestJig) GetEndpointNodes

func (j *ServiceTestJig) GetEndpointNodes(svc *v1.Service) map[string][]string

GetEndpointNodes returns a map of nodenames:external-ip on which the endpoints of the given Service are running.

func (*ServiceTestJig) GetHTTPContent

func (j *ServiceTestJig) GetHTTPContent(secure bool, host string, port int, timeout time.Duration, url string) bytes.Buffer

func (*ServiceTestJig) GetNodes

func (j *ServiceTestJig) GetNodes(maxNodesForTest int) (nodes *v1.NodeList)

GetNodes returns the first maxNodesForTest nodes. Useful in large clusters where we don't eg: want to create an endpoint per node.

func (*ServiceTestJig) RunOrFail

func (j *ServiceTestJig) RunOrFail(namespace string, tweak func(rc *v1.ReplicationController)) *v1.ReplicationController

RunOrFail creates a ReplicationController and Pod(s) and waits for the Pod(s) to be running. Callers can provide a function to tweak the RC object before it is created.

func (*ServiceTestJig) SanityCheckService

func (j *ServiceTestJig) SanityCheckService(svc *v1.Service, svcType v1.ServiceType)

func (*ServiceTestJig) TestHTTPHealthCheckNodePort

func (j *ServiceTestJig) TestHTTPHealthCheckNodePort(host string, port int, request string, timeout time.Duration, expectSucceed bool, threshold int) error

func (*ServiceTestJig) TestNotReachableHTTP

func (j *ServiceTestJig) TestNotReachableHTTP(host string, port int, timeout time.Duration)

func (*ServiceTestJig) TestNotReachableUDP

func (j *ServiceTestJig) TestNotReachableUDP(host string, port int, timeout time.Duration)

func (*ServiceTestJig) TestReachableHTTP

func (j *ServiceTestJig) TestReachableHTTP(secure bool, host string, port int, timeout time.Duration)

func (*ServiceTestJig) TestReachableHTTPWithRetriableErrorCodes

func (j *ServiceTestJig) TestReachableHTTPWithRetriableErrorCodes(secure bool, host string, port int, retriableErrCodes []int, timeout time.Duration)

func (*ServiceTestJig) TestReachableUDP

func (j *ServiceTestJig) TestReachableUDP(host string, port int, timeout time.Duration)

func (*ServiceTestJig) UpdateService

func (j *ServiceTestJig) UpdateService(namespace, name string, update func(*v1.Service)) (*v1.Service, error)

UpdateService fetches a service, calls the update function on it, and then attempts to send the updated service. It tries up to 3 times in the face of timeouts and conflicts.

func (*ServiceTestJig) UpdateServiceOrFail

func (j *ServiceTestJig) UpdateServiceOrFail(namespace, name string, update func(*v1.Service)) *v1.Service

UpdateServiceOrFail fetches a service, calls the update function on it, and then attempts to send the updated service. It tries up to 3 times in the face of timeouts and conflicts.

func (*ServiceTestJig) WaitForEndpointOnNode

func (j *ServiceTestJig) WaitForEndpointOnNode(namespace, serviceName, nodeName string)

func (*ServiceTestJig) WaitForLoadBalancerDestroyOrFail

func (j *ServiceTestJig) WaitForLoadBalancerDestroyOrFail(namespace, name string, ip string, port int, timeout time.Duration) *v1.Service

func (*ServiceTestJig) WaitForLoadBalancerOrFail

func (j *ServiceTestJig) WaitForLoadBalancerOrFail(namespace, name string, timeout time.Duration) *v1.Service

func (*ServiceTestJig) WaitForNewIngressIPOrFail

func (j *ServiceTestJig) WaitForNewIngressIPOrFail(namespace, name, existingIP string, timeout time.Duration) *v1.Service

Directories

Path Synopsis
Package ginkgowrapper wraps Ginkgo Fail and Skip functions to panic with structured data instead of a constant string.
Package ginkgowrapper wraps Ginkgo Fail and Skip functions to panic with structured data instead of a constant string.

Jump to

Keyboard shortcuts

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