e2e

package
v0.7.0-alpha.3 Latest Latest
Warning

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

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

README

Introduction

This directory contain the framework to run complete end-to-end (e2e) tests for single Provider. It was built upon the kubernetes-sigs e2e framework.

Running end-to-end tests

Note: When running the e2e framework, both the kubectl and git commands needs to be available on PATH.

As long as the cloud provider support is implemented on this framework, you can run the tests as shown below for libvirt:

$ CLOUD_PROVIDER=libvirt make test-e2e

The above command run tests on an existing cluster. It will look for the kubeconf file exported on the KUBECONFIG variable, and then in $HOME/.kube/config if not found.

You can instruct the tool to provision a test environment though, as shown below:

$ TEST_PROVISION=yes CLOUD_PROVIDER=libvirt make test-e2e

Each provider must have a provisioner implementation so that the framework is able to perform operations on the cluster. The provisioner will likely to need additional information (e.g. login credentials), and those are passed via a properties file with the following format:

key1 = "value1"
key2 = "value2"
...

You should use the TEST_PROVISION_FILE variable to specify the properties file path, as shown below:

$ TEST_PROVISION=yes TEST_PROVISION_FILE=/path/to/libvirt.properties CLOUD_PROVIDER=libvirt make test-e2e

The TEST_PODVM_IMAGE is an optional variable which specifies the path to the podvm qcow2 image. If it is set then the image should be uploaded to the VPC storage. The following command, as an example, instructs the tool to upload path/to/podvm-base.qcow2 after the provisioning of the test environment:

$ TEST_PROVISION=yes TEST_PODVM_IMAGE="path/to/podvm-base.qcow2" CLOUD_PROVIDER=libvirt make test-e2e

By default it is given 20 minutes for the entire e2e execution to complete, otherwise the process is preempted. If you need to extend that timeout then export the TEST_E2E_TIMEOUT variable. For example, TEST_E2E_TIMEOUT=30m set the timeout to 30 minutes. See -timeout in go test flags for the values accepted.

To leave the cluster untouched by the execution finish you should export TEST_TEARDOWN=no, otherwise the framework will attempt to wipe out any resources created. For example, if TEST_PROVISION=yes is used to create a VPC and cluster for testing and TEST_TEARDOWN=no not specified, then at the end of the test the provisioned cluster and VPC, will both be deleted.

To use existing cluster which have already installed Cloud API Adaptor, you should export TEST_INSTALL_CAA=no.

Provision file specifics

As mentioned on the previous section, a properties file can be passed to the cloud provisioner that will be used to controll the provisioning operations. The properties are specific of each cloud provider though, see on the sections below.

AWS provision properties

Use the properties on the table below for AWS:

Property Description Default
aws_region AWS region Account default
aws_vpc_cidrblock AWS VPC CIDR block 10.0.0.0/24
aws_vpc_id AWS VPC ID
aws_vpc_igw_id AWS VPC Internet Gateway ID
aws_vpc_rt_id AWS VPC Route Table ID
aws_vpc_sg_id AWS VPC Security Groups ID
aws_vpc_subnet_id AWS VPC Subnet ID
cluster_type Kubernetes cluster type. Either onprem or eks (see Notes below) onprem
pause_image Kubernetes pause image
podvm_aws_ami_id AWS AMI ID of the podvm
ssh_kp_name AWS SSH key-pair name
vxlan_port VXLAN port number

Notes:

  • The AWS credentials are obtained from the CLI configuration files. Important: the access key and secret are recorded in plain-text in install/overlays/aws/kustomization.yaml
  • The subnet is created with CIDR IPv4 block 10.0.0.0/25. In case of deploying an EKS cluster, a secondary (private) subnet is created with CIDR IPv4 block 10.0.0.128/25
  • The cluster type onprem assumes Kubernetes is already provisioned and its kubeconfig file path can be found at the KUBECONFIG environment variable or in the ~/.kube/config file. Whereas eks type instructs to create an AWS EKS cluster on the VPC
  • You must have qemu-img installed in your workstation or CI runner because it is used to convert an qcow2 disk to raw.
Libvirt provision properties

Use the properties on the table below for Libvirt:

Property Description Default
libvirt_network Libvirt Network "default"
libvirt_storage Libvirt storage pool "default"
libvirt_vol_name Volume name "podvm-base.qcow2"
libvirt_uri Libvirt pod URI "qemu+ssh://root@192.168.122.1/system?no_verify=1"
libvirt_conn_uri Libvirt host URI "qemu:///system"
libvirt_ssh_key_file Path to SSH private key
pause_image k8s pause image
vxlan_port VXLAN port number
cluster_name Cluster Name "peer-pods"

Adding support for a new cloud provider

In order to add a test pipeline for a new cloud provider, you will need to implement some Go interfaces and create a test suite. You will find the reference implementation on the files for the libvirt provider.

Create the provision implementation

Create a folder named <CLOUD_PROVIDER> and create a new Go file (.go) named provision.go under it (e.g., libvirt/provision.go) that should be tagged with //go:build <CLOUD_PROVIDER>. That file should have the implementation of the CloudProvisioner interface (see its definition in provision.go).

Apart from that, it should be added an entry to the GetCloudProvisioner() factory function in provision.go.

Create the test suite

Create another Go file named <CLOUD_PROVIDER>_test.go to host the test suite and provider-specific assertions. It is interpreted as any Go standard testing framework test file, where functions with func TestXxx(*testing.T) pattern are tests to be executed.

Likewise the provision file, you should tag the test file with //go:build <CLOUD_PROVIDER>.

You can have tests specific for the cloud provider or re-use the existing suite found in common_suite.go (or mix both). In the later cases, you must first implement the CloudAssert interface (see its definition in common.go) because some tests will need to do assertions on the cloud side, so there should provider-specific asserts implementations.

Once you got the assertions done, create the test function which wrap the common suite function. For example, suppose there is a re-usable DoTestCreateSimplePod test then you can wrap it in test function like shown below:

func TestCloudProviderCreateSimplePod(t *testing.T) {
    assert := MyAssert{}
    DoTestCreateSimplePod(t, assert)
}

Running tests for PodVM with Authenticated Registry

For running e2e test cases specifically for checking PodVM with Image from Authenticated Registry, we need to export following two variables

  • AUTHENTICATED_REGISTRY_IMAGE - Name of the image along with the tag from authenticated registry (example: quay.io/kata-containers/confidential-containers-auth:test)
  • REGISTRY_CREDENTIAL_ENCODED - Credentials of registry encrypted as BASE64ENCODED(USERNAME:PASSWORD). If you're using quay registry, we can get the encrypted credentials from Account Settings >> Generate Encrypted Password >> Docker Configuration

Running the e2e Test Suite on an Existing CAA Deployment

To test local changes the test suite can run without provisioning any infrastructure, CoCo or CAA. Make sure your cluster is configured and available via kubectl. You also might need to set up Cloud Provider-specific API access, since some of tests assert conditions for cloud resources.

Azure

Fill in RESOURCE_GROUP and AZURE_SUBSCRIPTION_ID with the values you want to use in your test:

cd ../.. # go to project root
cat <<EOF> skip-provisioning.properties
RESOURCE_GROUP_NAME="..."
AZURE_SUBSCRIPTION_ID="..."
AZURE_CLIENT_ID="unused"
AZURE_TENANT_ID="unused"
LOCATION="unused"
AZURE_IMAGE_ID="unused"
EOF

Run the test suite with the respective flags:

make test-e2e \
CLOUD_PROVIDER=azure \
TEST_TEARDOWN=no \
TEST_PROVISION=no \
TEST_INSTALL_CAA=no \
TEST_PROVISION_FILE="${PWD}/skip-provisioning.properties" \

IBM Cloud

Take region jp-tok for example.

cd ../.. # go to project root
cat <<EOF> skip-provisioning.properties
REGION="jp-tok"
ZONE="jp-tok-1"
VPC_ID="<vpc-of-worker>"
VPC_SUBNET_ID="<subnet-of-worker>"
VPC_SECURITY_GROUP_ID="<security-group-of-vpc>"
RESOURCE_GROUP_ID="<resource-group-id>"
IBMCLOUD_PROVIDER="ibmcloud"
APIKEY="<your-ibmcloud-apikey>"

IAM_SERVICE_URL="https://iam.cloud.ibm.com/identity/token"
VPC_SERVICE_URL="https://jp-tok.iaas.cloud.ibm.com/v1"
IKS_SERVICE_URL="https://containers.cloud.ibm.com/global"
PODVM_IMAGE_ID="<podvm-image-uploaded-previously>"
INSTANCE_PROFILE_NAME="bz2-2x8"
PODVM_IMAGE_ARCH="s390x"
IMAGE_PULL_API_KEY="<can-be-same-as-apikey>"
CAA_IMAGE_TAG="<caa-image-tag>"
EOF
  • For INSTANCE_PROFILE_NAME, if it's not secure execution, the value is started with "bz2". If it's secure execution, the value is started with 'bz2e'. More values can be found through ibmcloud command ibmcloud is instance-profiles.
  • For PODVM_IMAGE_ID, the vpc image id uploaded to ibmcloud.
  • For CAA_IMAGE_TAG, the commit id of project. The commit id can be found here: https://github.com/confidential-containers/cloud-api-adaptor/commits/main/

Documentation

Index

Constants

View Source
const BUSYBOX_IMAGE = "quay.io/prometheus/busybox:latest"
View Source
const DEFAULT_AUTH_SECRET = "auth-json-secret-default"
View Source
const OLD_VM_DELETION_TIMEOUT = time.Second * 30
View Source
const WAIT_DEPLOYMENT_AVAILABLE_TIMEOUT = time.Second * 180
View Source
const WAIT_JOB_RUNNING_TIMEOUT = time.Second * 600
View Source
const WAIT_NAMESPACE_AVAILABLE_TIMEOUT = time.Second * 120
View Source
const WAIT_NGINX_DEPLOYMENT_TIMEOUT = time.Second * 900
View Source
const WAIT_POD_RUNNING_TIMEOUT = time.Second * 600

Variables

View Source
var E2eNamespace = envconf.RandomName("coco-pp-e2e-test", 25)

Functions

func AddImagePullSecretToDefaultServiceAccount

func AddImagePullSecretToDefaultServiceAccount(ctx context.Context, client klient.Client, secretName string) error

func AssessPodTestCommands

func AssessPodTestCommands(ctx context.Context, client klient.Client, pod *v1.Pod, testCommands []TestCommand) (string, error)

func ComparePodLogString

func ComparePodLogString(ctx context.Context, client klient.Client, customPod v1.Pod, expectedPodlogString string) (string, error)

func CreateAndWaitForNamespace

func CreateAndWaitForNamespace(ctx context.Context, client klient.Client, namespaceName string) error

func DeleteAndWaitForNamespace

func DeleteAndWaitForNamespace(ctx context.Context, client klient.Client, namespaceName string) error

func DeletePod

func DeletePod(ctx context.Context, client klient.Client, pod *v1.Pod, tcDelDuration *time.Duration) error

func DoTestCaaDaemonsetRollingUpdate

func DoTestCaaDaemonsetRollingUpdate(t *testing.T, testEnv env.Environment, assert RollingUpdateAssert)

func DoTestCreateConfidentialPod

func DoTestCreateConfidentialPod(t *testing.T, e env.Environment, assert CloudAssert, testCommands []TestCommand)

DoTestCreateConfidentialPod verify a confidential peer-pod can be created.

func DoTestCreatePeerPodAndCheckEnvVariableLogsWithDeploymentOnly

func DoTestCreatePeerPodAndCheckEnvVariableLogsWithDeploymentOnly(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestCreatePeerPodAndCheckEnvVariableLogsWithImageAndDeployment

func DoTestCreatePeerPodAndCheckEnvVariableLogsWithImageAndDeployment(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestCreatePeerPodAndCheckEnvVariableLogsWithImageOnly

func DoTestCreatePeerPodAndCheckEnvVariableLogsWithImageOnly(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestCreatePeerPodAndCheckUserLogs

func DoTestCreatePeerPodAndCheckUserLogs(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestCreatePeerPodAndCheckWorkDirLogs

func DoTestCreatePeerPodAndCheckWorkDirLogs(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestCreatePeerPodContainerWithExternalIPAccess

func DoTestCreatePeerPodContainerWithExternalIPAccess(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestCreatePeerPodWithAuthenticatedImageWithInvalidCredentials

func DoTestCreatePeerPodWithAuthenticatedImageWithInvalidCredentials(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestCreatePeerPodWithAuthenticatedImageWithoutCredentials

func DoTestCreatePeerPodWithAuthenticatedImageWithoutCredentials(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestCreatePeerPodWithAuthenticatedImagewithValidCredentials

func DoTestCreatePeerPodWithAuthenticatedImagewithValidCredentials(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestCreatePeerPodWithJob

func DoTestCreatePeerPodWithJob(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestCreatePeerPodWithLargeImage

func DoTestCreatePeerPodWithLargeImage(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestCreatePeerPodWithPVCAndCSIWrapper

func DoTestCreatePeerPodWithPVCAndCSIWrapper(t *testing.T, e env.Environment, assert CloudAssert, myPVC *v1.PersistentVolumeClaim, pod *v1.Pod, mountPath string)

func DoTestCreatePodWithConfigMap

func DoTestCreatePodWithConfigMap(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestCreatePodWithSecret

func DoTestCreatePodWithSecret(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestCreateSimplePod

func DoTestCreateSimplePod(t *testing.T, e env.Environment, assert CloudAssert)

DoTestCreateSimplePod tests a simple peer-pod can be created.

func DoTestCreateSimplePodWithNydusAnnotation

func DoTestCreateSimplePodWithNydusAnnotation(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestDeleteSimplePod

func DoTestDeleteSimplePod(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestNginxDeployment

func DoTestNginxDeployment(t *testing.T, testEnv env.Environment, assert CloudAssert)

func DoTestPodToServiceCommunication

func DoTestPodToServiceCommunication(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestPodVMwithAnnotationsCPUMemory

func DoTestPodVMwithAnnotationsCPUMemory(t *testing.T, e env.Environment, assert CloudAssert, expectedType string)

func DoTestPodVMwithAnnotationsInstanceType

func DoTestPodVMwithAnnotationsInstanceType(t *testing.T, e env.Environment, assert CloudAssert, expectedType string)

func DoTestPodVMwithAnnotationsInvalidInstanceType

func DoTestPodVMwithAnnotationsInvalidInstanceType(t *testing.T, e env.Environment, assert CloudAssert, expectedType string)

func DoTestPodVMwithAnnotationsLargerCPU

func DoTestPodVMwithAnnotationsLargerCPU(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestPodVMwithAnnotationsLargerMemory

func DoTestPodVMwithAnnotationsLargerMemory(t *testing.T, e env.Environment, assert CloudAssert)

func DoTestPodVMwithNoAnnotations

func DoTestPodVMwithNoAnnotations(t *testing.T, e env.Environment, assert CloudAssert, expectedType string)

func DoTestPodsMTLSCommunication

func DoTestPodsMTLSCommunication(t *testing.T, e env.Environment, assert CloudAssert)

func GetAuthenticatedImageStatus

func GetAuthenticatedImageStatus(ctx context.Context, client klient.Client, expectedStatus string, authpod v1.Pod) error

func GetIBMInstanceProfileType

func GetIBMInstanceProfileType(prefix string, config string) string

func GetNodeNameFromPod

func GetNodeNameFromPod(ctx context.Context, client klient.Client, customPod v1.Pod) (string, error)

func GetPodLog

func GetPodLog(ctx context.Context, client klient.Client, pod v1.Pod) (string, error)

func GetSuccessfulAndErroredPods

func GetSuccessfulAndErroredPods(ctx context.Context, t *testing.T, client klient.Client, job batchv1.Job) (int, int, string, error)

func IsBufferEmpty

func IsBufferEmpty(buffer bytes.Buffer) bool

func IsErrorEmpty

func IsErrorEmpty(err error) bool

func IsPulledWithNydusSnapshotter

func IsPulledWithNydusSnapshotter(ctx context.Context, t *testing.T, client klient.Client, nodeName string, containerId string) (bool, error)

Check cloud-api-adaptor daemonset pod logs to ensure that something like: <date time> adaptor/proxy mount_point:/run/kata-containers/<id>/rootfs source:<image> fstype:overlay driver:image_guest_pull <date time> 11:47:42 adaptor/proxy CreateContainer: Ignoring PullImage before CreateContainer (cid: "<cid>") not <date time> 15:18:43 adaptor/proxy CreateContainer: calling PullImage for <image> before CreateContainer (cid: "<cid>") was output

func IsStringEmpty

func IsStringEmpty(data string) bool

func NewBusyboxPod

func NewBusyboxPod(namespace string) *corev1.Pod

func NewBusyboxPodWithName

func NewBusyboxPodWithName(namespace, podName string) *corev1.Pod

func NewConfigMap

func NewConfigMap(namespace, name string, configMapData map[string]string) *corev1.ConfigMap

NewConfigMap returns a new config map object.

func NewDeployment

func NewDeployment(namespace, deploymentName, containerName, imageName string, options ...deploymentOption) *appsv1.Deployment

func NewJob

func NewJob(namespace, name string) *batchv1.Job

NewJob returns a new job

func NewPVC

func NewPVC(namespace, name, storageClassName, diskSize string, accessModel corev1.PersistentVolumeAccessMode) *corev1.PersistentVolumeClaim

NewPVC returns a new pvc object.

func NewPod

func NewPod(namespace string, podName string, containerName string, imageName string, options ...PodOption) *corev1.Pod

func NewPodWithPVCFromIBMVPCBlockDriver

func NewPodWithPVCFromIBMVPCBlockDriver(namespace, podName, containerName, imageName, csiContainerName, csiImageName string, options ...PodOption) *corev1.Pod

func NewSecret

func NewSecret(namespace, name string, data map[string][]byte, secretType corev1.SecretType) *corev1.Secret

NewSecret returns a new secret object.

func NewService

func NewService(namespace, serviceName string, servicePorts []corev1.ServicePort, labels map[string]string) *corev1.Service

func ProvisionPod

func ProvisionPod(ctx context.Context, client klient.Client, t *testing.T, pod *v1.Pod, podState v1.PodPhase, testCommands []TestCommand) error

func SkipTestOnCI

func SkipTestOnCI(t *testing.T)

SkipTestOnCI skips the test if running on CI

func WaitForClusterIP

func WaitForClusterIP(t *testing.T, client klient.Client, svc *v1.Service) string

func WatchImagePullTime

func WatchImagePullTime(ctx context.Context, client klient.Client, caaPod v1.Pod, pod v1.Pod) (string, error)

func WithReplicaCount

func WithReplicaCount(replicas int32) deploymentOption

Types

type AWSAssert

type AWSAssert struct {
	Vpc *pv.Vpc
}

AWSAssert implements the CloudAssert interface.

func NewAWSAssert

func NewAWSAssert() AWSAssert

func (AWSAssert) DefaultTimeout

func (aa AWSAssert) DefaultTimeout() time.Duration

func (AWSAssert) GetInstanceType

func (aa AWSAssert) GetInstanceType(t *testing.T, podName string) (string, error)

func (AWSAssert) HasPodVM

func (aa AWSAssert) HasPodVM(t *testing.T, id string)

type AzureCloudAssert

type AzureCloudAssert struct{}

AzureCloudAssert implements the CloudAssert interface for azure.

func (AzureCloudAssert) DefaultTimeout

func (c AzureCloudAssert) DefaultTimeout() time.Duration

func (AzureCloudAssert) GetInstanceType

func (c AzureCloudAssert) GetInstanceType(t *testing.T, podName string) (string, error)

func (AzureCloudAssert) HasPodVM

func (c AzureCloudAssert) HasPodVM(t *testing.T, id string)

type CloudAssert

type CloudAssert interface {
	HasPodVM(t *testing.T, id string)                             // Assert there is a PodVM with `id`.
	GetInstanceType(t *testing.T, podName string) (string, error) // Get Instance Type of PodVM
	DefaultTimeout() time.Duration                                // Default timeout for cloud operations
}

CloudAssert defines assertions to perform on the cloud provider.

type ExtraPod

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

func NewExtraPod

func NewExtraPod(namespace string, podName string, containerName string, imageName string, options ...PodOption) *ExtraPod

func (*ExtraPod) WithTestCommands

func (pod *ExtraPod) WithTestCommands(TestCommands []TestCommand) *ExtraPod

type IBMCloudAssert

type IBMCloudAssert struct {
	VPC *vpcv1.VpcV1
}

IBMCloudAssert implements the CloudAssert interface for ibmcloud.

func (IBMCloudAssert) DefaultTimeout

func (c IBMCloudAssert) DefaultTimeout() time.Duration

func (IBMCloudAssert) GetInstanceType

func (c IBMCloudAssert) GetInstanceType(t *testing.T, podName string) (string, error)

func (IBMCloudAssert) HasPodVM

func (c IBMCloudAssert) HasPodVM(t *testing.T, id string)

type IBMRollingUpdateAssert

type IBMRollingUpdateAssert struct {
	VPC *vpcv1.VpcV1
	// cache Pod VM instance IDs for rolling update test
	InstanceIDs [2]string
}

func (*IBMRollingUpdateAssert) CachePodVmIDs

func (c *IBMRollingUpdateAssert) CachePodVmIDs(t *testing.T, deploymentName string)

func (*IBMRollingUpdateAssert) VerifyOldVmDeleted

func (c *IBMRollingUpdateAssert) VerifyOldVmDeleted(t *testing.T)

type InstanceValidatorFunctions

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

type PodEvents

type PodEvents struct {
	EventType        string
	EventDescription string
	EventReason      string
}

func PodEventExtractor

func PodEventExtractor(ctx context.Context, client klient.Client, pod v1.Pod) (*PodEvents, error)

type PodOption

type PodOption func(*corev1.Pod)

func WithAnnotations

func WithAnnotations(data map[string]string) PodOption

func WithCommand

func WithCommand(command []string) PodOption

func WithConfigMapBinding

func WithConfigMapBinding(mountPath string, configMapName string) PodOption

func WithContainerPort

func WithContainerPort(port int32) PodOption

Optional method to add ContainerPort and ReadinessProbe to listen Port

func WithEnvironmentalVariables

func WithEnvironmentalVariables(envVar []corev1.EnvVar) PodOption

func WithImagePullSecrets

func WithImagePullSecrets(secretName string) PodOption

func WithLabel

func WithLabel(data map[string]string) PodOption

func WithPVCBinding

func WithPVCBinding(mountPath string, pvcName string) PodOption

func WithRestartPolicy

func WithRestartPolicy(restartPolicy corev1.RestartPolicy) PodOption

func WithSecretBinding

func WithSecretBinding(mountPath string, secretName string) PodOption

func WithSecureContainerPort

func WithSecureContainerPort(port int32) PodOption

type RollingUpdateAssert

type RollingUpdateAssert interface {
	CachePodVmIDs(t *testing.T, deploymentName string) // Cache Pod VM IDs before rolling update
	VerifyOldVmDeleted(t *testing.T)                   // Verify old Pod VMs have been deleted
}

RollingUpdateAssert defines assertions for rolling update test

type TestCase

type TestCase struct {
	AuthImageStatus string
	// contains filtered or unexported fields
}

func NewTestCase

func NewTestCase(t *testing.T, e env.Environment, testName string, assert CloudAssert, assessMessage string) *TestCase

func (*TestCase) Run

func (tc *TestCase) Run()

func (*TestCase) WithAuthImageStatus

func (tc *TestCase) WithAuthImageStatus(status string) *TestCase

func (*TestCase) WithAuthenticatedImage

func (tc *TestCase) WithAuthenticatedImage() *TestCase

func (*TestCase) WithConfigMap

func (tc *TestCase) WithConfigMap(configMap *v1.ConfigMap) *TestCase

func (*TestCase) WithCustomPodState

func (tc *TestCase) WithCustomPodState(customPodState v1.PodPhase) *TestCase

func (*TestCase) WithDeleteAssertion

func (tc *TestCase) WithDeleteAssertion(duration *time.Duration) *TestCase

func (*TestCase) WithExpectedPodLogString

func (tc *TestCase) WithExpectedPodLogString(expectedPodLogString string) *TestCase

func (*TestCase) WithExtraPods

func (tc *TestCase) WithExtraPods(pods []*ExtraPod) *TestCase

func (*TestCase) WithExtraSecrets

func (tc *TestCase) WithExtraSecrets(secrets []*v1.Secret) *TestCase

func (*TestCase) WithInstanceTypes

func (tc *TestCase) WithInstanceTypes(testInstanceTypes InstanceValidatorFunctions) *TestCase

func (*TestCase) WithJob

func (tc *TestCase) WithJob(job *batchv1.Job) *TestCase

func (*TestCase) WithNydusSnapshotter

func (tc *TestCase) WithNydusSnapshotter() *TestCase

func (*TestCase) WithPVC

func (tc *TestCase) WithPVC(pvc *v1.PersistentVolumeClaim) *TestCase

func (*TestCase) WithPod

func (tc *TestCase) WithPod(pod *v1.Pod) *TestCase

func (*TestCase) WithPodWatcher

func (tc *TestCase) WithPodWatcher() *TestCase

func (*TestCase) WithSecret

func (tc *TestCase) WithSecret(secret *v1.Secret) *TestCase

func (*TestCase) WithService

func (tc *TestCase) WithService(service *v1.Service) *TestCase

func (*TestCase) WithTestCommands

func (tc *TestCase) WithTestCommands(TestCommands []TestCommand) *TestCase

type TestCommand

type TestCommand struct {
	Command             []string
	TestCommandStdoutFn func(stdout bytes.Buffer) bool
	TestCommandStderrFn func(stderr bytes.Buffer) bool
	TestErrorFn         func(errorMsg error) bool
	ContainerName       string
}

TestCommand is a list of commands to execute inside the pod container, each with a function to test if the command outputs the value the test expects it to on the stdout stream

func CreateConfidentialPodCheckIBMSECommands

func CreateConfidentialPodCheckIBMSECommands() []TestCommand

Jump to

Keyboard shortcuts

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