Documentation ¶
Index ¶
- Constants
- Variables
- func AddImagePullSecretToDefaultServiceAccount(ctx context.Context, client klient.Client, secretName string) error
- func AssessPodTestCommands(ctx context.Context, client klient.Client, pod *v1.Pod, ...) (string, error)
- func ComparePodLogString(ctx context.Context, client klient.Client, customPod v1.Pod, ...) (string, error)
- func CreateAndWaitForNamespace(ctx context.Context, client klient.Client, namespaceName string) error
- func DeleteAndWaitForNamespace(ctx context.Context, client klient.Client, namespaceName string) error
- func DeletePod(ctx context.Context, client klient.Client, pod *v1.Pod, ...) error
- func DoTestCaaDaemonsetRollingUpdate(t *testing.T, testEnv env.Environment, assert RollingUpdateAssert)
- func DoTestCreateConfidentialPod(t *testing.T, e env.Environment, assert CloudAssert, ...)
- func DoTestCreatePeerPodAndCheckEnvVariableLogsWithDeploymentOnly(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestCreatePeerPodAndCheckEnvVariableLogsWithImageAndDeployment(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestCreatePeerPodAndCheckEnvVariableLogsWithImageOnly(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestCreatePeerPodAndCheckUserLogs(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestCreatePeerPodAndCheckWorkDirLogs(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestCreatePeerPodContainerWithExternalIPAccess(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestCreatePeerPodWithAuthenticatedImageWithInvalidCredentials(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestCreatePeerPodWithAuthenticatedImageWithoutCredentials(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestCreatePeerPodWithAuthenticatedImagewithValidCredentials(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestCreatePeerPodWithJob(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestCreatePeerPodWithLargeImage(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestCreatePeerPodWithPVCAndCSIWrapper(t *testing.T, e env.Environment, assert CloudAssert, ...)
- func DoTestCreatePodWithConfigMap(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestCreatePodWithSecret(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestCreateSimplePod(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestCreateSimplePodWithNydusAnnotation(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestDeleteSimplePod(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestNginxDeployment(t *testing.T, testEnv env.Environment, assert CloudAssert)
- func DoTestPodToServiceCommunication(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestPodVMwithAnnotationsCPUMemory(t *testing.T, e env.Environment, assert CloudAssert, expectedType string)
- func DoTestPodVMwithAnnotationsInstanceType(t *testing.T, e env.Environment, assert CloudAssert, expectedType string)
- func DoTestPodVMwithAnnotationsInvalidInstanceType(t *testing.T, e env.Environment, assert CloudAssert, expectedType string)
- func DoTestPodVMwithAnnotationsLargerCPU(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestPodVMwithAnnotationsLargerMemory(t *testing.T, e env.Environment, assert CloudAssert)
- func DoTestPodVMwithNoAnnotations(t *testing.T, e env.Environment, assert CloudAssert, expectedType string)
- func DoTestPodsMTLSCommunication(t *testing.T, e env.Environment, assert CloudAssert)
- func GetAuthenticatedImageStatus(ctx context.Context, client klient.Client, expectedStatus string, ...) error
- func GetIBMInstanceProfileType(prefix string, config string) string
- func GetNodeNameFromPod(ctx context.Context, client klient.Client, customPod v1.Pod) (string, error)
- func GetPodLog(ctx context.Context, client klient.Client, pod v1.Pod) (string, error)
- func GetSuccessfulAndErroredPods(ctx context.Context, t *testing.T, client klient.Client, job batchv1.Job) (int, int, string, error)
- func IsBufferEmpty(buffer bytes.Buffer) bool
- func IsErrorEmpty(err error) bool
- func IsPulledWithNydusSnapshotter(ctx context.Context, t *testing.T, client klient.Client, nodeName string, ...) (bool, error)
- func IsStringEmpty(data string) bool
- func NewBusyboxPod(namespace string) *corev1.Pod
- func NewBusyboxPodWithName(namespace, podName string) *corev1.Pod
- func NewConfigMap(namespace, name string, configMapData map[string]string) *corev1.ConfigMap
- func NewDeployment(namespace, deploymentName, containerName, imageName string, ...) *appsv1.Deployment
- func NewJob(namespace, name string) *batchv1.Job
- func NewPVC(namespace, name, storageClassName, diskSize string, ...) *corev1.PersistentVolumeClaim
- func NewPod(namespace string, podName string, containerName string, imageName string, ...) *corev1.Pod
- func NewPodWithPVCFromIBMVPCBlockDriver(...) *corev1.Pod
- func NewSecret(namespace, name string, data map[string][]byte, secretType corev1.SecretType) *corev1.Secret
- func NewService(namespace, serviceName string, servicePorts []corev1.ServicePort, ...) *corev1.Service
- func ProvisionPod(ctx context.Context, client klient.Client, t *testing.T, pod *v1.Pod, ...) error
- func SkipTestOnCI(t *testing.T)
- func WaitForClusterIP(t *testing.T, client klient.Client, svc *v1.Service) string
- func WatchImagePullTime(ctx context.Context, client klient.Client, caaPod v1.Pod, pod v1.Pod) (string, error)
- func WithReplicaCount(replicas int32) deploymentOption
- type AWSAssert
- type AzureCloudAssert
- type CloudAssert
- type ExtraPod
- type IBMCloudAssert
- type IBMRollingUpdateAssert
- type InstanceValidatorFunctions
- type PodEvents
- type PodOption
- func WithAnnotations(data map[string]string) PodOption
- func WithCommand(command []string) PodOption
- func WithConfigMapBinding(mountPath string, configMapName string) PodOption
- func WithContainerPort(port int32) PodOption
- func WithEnvironmentalVariables(envVar []corev1.EnvVar) PodOption
- func WithImagePullSecrets(secretName string) PodOption
- func WithLabel(data map[string]string) PodOption
- func WithPVCBinding(mountPath string, pvcName string) PodOption
- func WithRestartPolicy(restartPolicy corev1.RestartPolicy) PodOption
- func WithSecretBinding(mountPath string, secretName string) PodOption
- func WithSecureContainerPort(port int32) PodOption
- type RollingUpdateAssert
- type TestCase
- func (tc *TestCase) Run()
- func (tc *TestCase) WithAuthImageStatus(status string) *TestCase
- func (tc *TestCase) WithAuthenticatedImage() *TestCase
- func (tc *TestCase) WithConfigMap(configMap *v1.ConfigMap) *TestCase
- func (tc *TestCase) WithCustomPodState(customPodState v1.PodPhase) *TestCase
- func (tc *TestCase) WithDeleteAssertion(duration *time.Duration) *TestCase
- func (tc *TestCase) WithExpectedPodLogString(expectedPodLogString string) *TestCase
- func (tc *TestCase) WithExtraPods(pods []*ExtraPod) *TestCase
- func (tc *TestCase) WithExtraSecrets(secrets []*v1.Secret) *TestCase
- func (tc *TestCase) WithInstanceTypes(testInstanceTypes InstanceValidatorFunctions) *TestCase
- func (tc *TestCase) WithJob(job *batchv1.Job) *TestCase
- func (tc *TestCase) WithNydusSnapshotter() *TestCase
- func (tc *TestCase) WithPVC(pvc *v1.PersistentVolumeClaim) *TestCase
- func (tc *TestCase) WithPod(pod *v1.Pod) *TestCase
- func (tc *TestCase) WithPodWatcher() *TestCase
- func (tc *TestCase) WithSecret(secret *v1.Secret) *TestCase
- func (tc *TestCase) WithService(service *v1.Service) *TestCase
- func (tc *TestCase) WithTestCommands(TestCommands []TestCommand) *TestCase
- type TestCommand
Constants ¶
const BUSYBOX_IMAGE = "quay.io/prometheus/busybox:latest"
const DEFAULT_AUTH_SECRET = "auth-json-secret-default"
const OLD_VM_DELETION_TIMEOUT = time.Second * 30
const WAIT_DEPLOYMENT_AVAILABLE_TIMEOUT = time.Second * 180
const WAIT_JOB_RUNNING_TIMEOUT = time.Second * 600
const WAIT_NAMESPACE_AVAILABLE_TIMEOUT = time.Second * 120
const WAIT_NGINX_DEPLOYMENT_TIMEOUT = time.Second * 900
const WAIT_POD_RUNNING_TIMEOUT = time.Second * 600
Variables ¶
var E2eNamespace = envconf.RandomName("coco-pp-e2e-test", 25)
Functions ¶
func AssessPodTestCommands ¶
func ComparePodLogString ¶
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 GetNodeNameFromPod ¶
func IsBufferEmpty ¶
func IsErrorEmpty ¶
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 NewBusyboxPod ¶
func NewBusyboxPodWithName ¶
func NewConfigMap ¶
NewConfigMap returns a new config map object.
func NewDeployment ¶
func NewDeployment(namespace, deploymentName, containerName, imageName string, options ...deploymentOption) *appsv1.Deployment
func NewPVC ¶
func NewPVC(namespace, name, storageClassName, diskSize string, accessModel corev1.PersistentVolumeAccessMode) *corev1.PersistentVolumeClaim
NewPVC returns a new pvc object.
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 ProvisionPod ¶
func WaitForClusterIP ¶
func WatchImagePullTime ¶
func WithReplicaCount ¶
func WithReplicaCount(replicas int32) deploymentOption
Types ¶
type AWSAssert ¶
AWSAssert implements the CloudAssert interface.
func NewAWSAssert ¶
func NewAWSAssert() AWSAssert
func (AWSAssert) DefaultTimeout ¶
func (AWSAssert) GetInstanceType ¶
type AzureCloudAssert ¶
type AzureCloudAssert struct{}
AzureCloudAssert implements the CloudAssert interface for azure.
func (AzureCloudAssert) DefaultTimeout ¶
func (c AzureCloudAssert) DefaultTimeout() time.Duration
func (AzureCloudAssert) GetInstanceType ¶
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 (*ExtraPod) WithTestCommands ¶
func (pod *ExtraPod) WithTestCommands(TestCommands []TestCommand) *ExtraPod
type IBMCloudAssert ¶
IBMCloudAssert implements the CloudAssert interface for ibmcloud.
func (IBMCloudAssert) DefaultTimeout ¶
func (c IBMCloudAssert) DefaultTimeout() time.Duration
func (IBMCloudAssert) GetInstanceType ¶
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 PodOption ¶
func WithAnnotations ¶
func WithCommand ¶
func WithConfigMapBinding ¶
func WithContainerPort ¶
Optional method to add ContainerPort and ReadinessProbe to listen Port
func WithImagePullSecrets ¶
func WithPVCBinding ¶
func WithRestartPolicy ¶
func WithRestartPolicy(restartPolicy corev1.RestartPolicy) PodOption
func WithSecretBinding ¶
func WithSecureContainerPort ¶
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) WithAuthImageStatus ¶
func (*TestCase) WithAuthenticatedImage ¶
func (*TestCase) WithConfigMap ¶
func (*TestCase) WithCustomPodState ¶
func (*TestCase) WithDeleteAssertion ¶
func (*TestCase) WithExpectedPodLogString ¶
func (*TestCase) WithExtraPods ¶
func (*TestCase) WithExtraSecrets ¶
func (*TestCase) WithInstanceTypes ¶
func (tc *TestCase) WithInstanceTypes(testInstanceTypes InstanceValidatorFunctions) *TestCase
func (*TestCase) WithNydusSnapshotter ¶
func (*TestCase) WithPodWatcher ¶
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