globalhelper

package
v0.0.0-...-4cba862 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 61 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExecutedBy  = "QE"
	AppPwd      = "qepwd"
	PartnerName = "qeuser"
)
View Source
const (
	CatalogSourceNamespace = "openshift-marketplace"
)

Variables

This section is empty.

Functions

func AfterEachCleanupWithRandomNamespace

func AfterEachCleanupWithRandomNamespace(randomNamespace, randomReportDir, randomConfigDir string, waitingTime time.Duration)

func AllowAuthenticatedUsersRunPrivilegedContainers

func AllowAuthenticatedUsersRunPrivilegedContainers() error

AllowAuthenticatedUsersRunPrivilegedContainers adds all authenticated users to privileged group.

func AppendContainersToDeployment

func AppendContainersToDeployment(deployment *appsv1.Deployment, containersNum int, image string)

AppendContainersToDeployment appends containers to a deployment.

func AppendContainersToPod

func AppendContainersToPod(pod *corev1.Pod, containersNum int, image string)

AppendContainersToPod appends containers to a pod.

func AppendLabelsToPod

func AppendLabelsToPod(pod *corev1.Pod, labels map[string]string)

AppendLabelsToPod appends labels to given pod manifest. from go documentation : "if you pass a map to a function that changes the contents of the map, the changes will be visible in the caller" - thats the reason for copying the map.

func ApproveInstallPlan

func ApproveInstallPlan(namespace string, plan *v1alpha1.InstallPlan) error

func BeforeEachSetupWithRandomNamespace

func BeforeEachSetupWithRandomNamespace(incomingNamespace string) (randomNamespace, randomReportDir, randomConfigDir string)

func CleanNamespace

func CleanNamespace(namespace string) error

func ConvertSpecNameToFileName

func ConvertSpecNameToFileName(specName string) string

ConvertSpecNameToFileName converts given spec name to file name.

func CopyClaimFileToTcFolder

func CopyClaimFileToTcFolder(tcName, formattedTcName, reportDir string)

func CopyFiles

func CopyFiles(src string, dst string) error

CopyFiles copy file from source to destination.

func CreateAndWaitUntilDaemonSetIsReady

func CreateAndWaitUntilDaemonSetIsReady(daemonSet *appsv1.DaemonSet, timeout time.Duration) error

func CreateAndWaitUntilDeploymentIsReady

func CreateAndWaitUntilDeploymentIsReady(deployment *appsv1.Deployment,
	timeout time.Duration) error

CreateAndWaitUntilDeploymentIsReady creates deployment and wait until all deployment replicas are up and running.

func CreateAndWaitUntilPVCIsBound

func CreateAndWaitUntilPVCIsBound(pvc *corev1.PersistentVolumeClaim, timeout time.Duration, pvName string) error

func CreateAndWaitUntilPodIsReady

func CreateAndWaitUntilPodIsReady(pod *corev1.Pod, timeout time.Duration) error

CreateAndWaitUntilPodIsReady creates a pod and waits until all it's containers are ready.

func CreateAndWaitUntilReplicaSetIsReady

func CreateAndWaitUntilReplicaSetIsReady(replicaSet *appsv1.ReplicaSet, timeout time.Duration) error

CreateAndWaitUntilReplicaSetIsReady creates replicaSet and waits until all it's replicas are ready.

func CreateAndWaitUntilStatefulSetIsReady

func CreateAndWaitUntilStatefulSetIsReady(statefulSet *appsv1.StatefulSet, timeout time.Duration) error

CreateAndWaitUntilStatefulSetIsReady creates statefulset and waits until all it's replicas are ready.

func CreateClusterRoleBinding

func CreateClusterRoleBinding(clusterRoleBinding *rbacv1.ClusterRoleBinding) error

CreateClusterRoleBinding creates a cluster role binding.

func CreateCommunityOperatorsCatalogSource

func CreateCommunityOperatorsCatalogSource() error

func CreateInstallPlan

func CreateInstallPlan(plan *v1alpha1.InstallPlan) error

func CreateNamespace

func CreateNamespace(namespace string) error

func CreateNetworkPolicy

func CreateNetworkPolicy(networkPolicy *networkingv1.NetworkPolicy, timeout time.Duration) error

func CreatePersistentVolume

func CreatePersistentVolume(persistentVolume *corev1.PersistentVolume) error

CreatePersistentVolume creates a persistent volume.

func CreatePodDisruptionBudget

func CreatePodDisruptionBudget(pdb *policyv1.PodDisruptionBudget, timeout time.Duration) error

CreatPodDisruptionBudget creates Pod Disruption Budget and wait until pdb is created.

func CreateResourceQuota

func CreateResourceQuota(quota *corev1.ResourceQuota) error

func CreateRole

func CreateRole(aRole *rbacv1.Role) error

CreateRole creates a role.

func CreateRoleBindingWithServiceAccountSubject

func CreateRoleBindingWithServiceAccountSubject(bindingName, roleName, serviceAccountName,
	serviceAccountNamespace, namespace string) error

CreateRoleBindingWithServiceAccountSubject creates a role binding with a service account subject.

func CreateRunTimeClass

func CreateRunTimeClass(rtc *nodev1.RuntimeClass) error

func CreateServiceAccount

func CreateServiceAccount(serviceAccountName, namespace string) error

CreateServiceAccount creates a service account.

func CreateStorageClass

func CreateStorageClass(storageClassName string, defaultSC bool) error

func CreateSubscription

func CreateSubscription(namespace string, subscription *v1alpha1.Subscription) error

CreateSubscription creates a subscription in the given namespace.

func DefineCertsuiteConfig

func DefineCertsuiteConfig(namespaces []string, targetPodLabels []string, targetOperatorLabels []string,
	certifiedContainerInfo []string, crdFilters []string, configDir string) error

DefineCertsuiteConfig creates certsuite_config.yml file under certsuite config directory.

func DefineRole

func DefineRole(roleName, namespace string) *rbacv1.Role

func DeleteCatalogSource

func DeleteCatalogSource(name, namespace, displayName string) error

func DeleteClusterRole

func DeleteClusterRole(name string) error

func DeleteClusterRoleBinding

func DeleteClusterRoleBinding(clusterRoleBinding *rbacv1.ClusterRoleBinding) error

DeleteClusterRoleBinding deletes a cluster role binding.

func DeleteClusterRoleBindingByName

func DeleteClusterRoleBindingByName(name string) error

func DeleteDeployment

func DeleteDeployment(name, namespace string) error

func DeleteMutatingWebhookConfiguration

func DeleteMutatingWebhookConfiguration(name string) error

func DeleteNamespaceAndWait

func DeleteNamespaceAndWait(namespace string, timeout time.Duration) error

DeleteAndWait deletes a namespace and waits until delete.

func DeletePersistentVolume

func DeletePersistentVolume(persistentVolume string, timeout time.Duration) error

DeletePersistentVolume deletes a persistent volume.

func DeletePersistentVolumeClaim

func DeletePersistentVolumeClaim(pvc *corev1.PersistentVolumeClaim) error

func DeleteRole

func DeleteRole(roleName, namespace string) error

DeleteRole deletes a role.

func DeleteRoleBinding

func DeleteRoleBinding(roleBindingName, namespace string) error

DeleteRoleBinding deletes a role binding.

func DeleteRunTimeClass

func DeleteRunTimeClass(rtc *nodev1.RuntimeClass) error

func DeleteServiceAccount

func DeleteServiceAccount(serviceAccountName, namespace string) error

DeleteServiceAccount deletes a service account.

func DeleteStorageClass

func DeleteStorageClass(storageClassName string) error

func DeleteSubscription

func DeleteSubscription(namespace string, subscriptionName string) error

DeleteSubscription deletes a subscription in the given namespace.

func DeleteValidatingWebhookConfiguration

func DeleteValidatingWebhookConfiguration(name string) error

func DeployOperator

func DeployOperator(subscription *v1alpha1.Subscription) error

func DeployOperatorGroup

func DeployOperatorGroup(namespace string, operatorGroup *olmv1.OperatorGroup) error

func DeployRHCertifiedOperatorSource

func DeployRHCertifiedOperatorSource(ocpVersion string) error

func DeployRHOperatorSource

func DeployRHOperatorSource(ocpVersion string) error

func DisableCatalogSource

func DisableCatalogSource(name string) error

func EnableCatalogSource

func EnableCatalogSource(name string) error

func ExecCommand

func ExecCommand(pod corev1.Pod, command []string) (bytes.Buffer, error)

ExecCommand runs command in the pod and returns buffer output.

func GenerateDirectories

func GenerateDirectories(randomStr string) (reportDir, configDir string)

func GenerateRandomString

func GenerateRandomString(length int) string

func GetAPIClient

func GetAPIClient() *testclient.ClientSet

func GetClusterVersion

func GetClusterVersion() (string, error)

func GetConfiguration

func GetConfiguration() *config.Config

func GetControllerPodFromOperator

func GetControllerPodFromOperator(namespace, operatorName string) (*corev1.Pod, error)

func GetDaemonSetPullPolicy

func GetDaemonSetPullPolicy(ds *appsv1.DaemonSet) (corev1.PullPolicy, error)

func GetInstallPlanByCSV

func GetInstallPlanByCSV(namespace string, csvName string) (*v1alpha1.InstallPlan, error)

func GetListOfPodsInNamespace

func GetListOfPodsInNamespace(namespace string) (*corev1.PodList, error)

GetListOfPodsInNamespace returns list of pods for given namespace.

func GetNumberOfNodes

func GetNumberOfNodes(client corev1Typed.CoreV1Interface) int

func GetRunningDaemonset

func GetRunningDaemonset(ds *appsv1.DaemonSet) (*appsv1.DaemonSet, error)

func GetRunningDeployment

func GetRunningDeployment(namespace, deploymentName string) (*appsv1.Deployment, error)

GetRunningDeployment returns a running deployment.

func GetRunningPod

func GetRunningPod(namespace, name string) (*corev1.Pod, error)

func GetRunningStatefulSet

func GetRunningStatefulSet(namespace, statefulSetName string) (*appsv1.StatefulSet, error)

func GetServicesFromNamespace

func GetServicesFromNamespace(namespace string) (services []corev1.Service, err error)

func IsCatalogSourceEnabled

func IsCatalogSourceEnabled(name, namespace, displayName string) (bool, error)

func IsClusterOvercommitted

func IsClusterOvercommitted() (bool, error)

func IsDeploymentReady

func IsDeploymentReady(client *egiClients.Settings, namespace, deploymentName string) (bool, error)

IsDeploymentReady checks if a deployment is ready.

func IsExpectedStatusParamValid

func IsExpectedStatusParamValid(status string) error

IsExpectedStatusParamValid validates if requested test status is valid.

func IsKindCluster

func IsKindCluster() bool

Returns true if the cluster is of kind type, otherwise false. Performance gains are achievable by invoking the command once, leveraging a synchronization mechanism like sync.Once.

func IsOperatorGroupInstalled

func IsOperatorGroupInstalled(operatorGroupName, namespace string) error

func IsPodDisruptionBudgetCreated

func IsPodDisruptionBudgetCreated(pdbName string, namespace string) (bool, error)

IsPodDisruptionBudgetCreated checks if a pod disruption budget is created.

func IsTestCaseFailedInClaimReport

func IsTestCaseFailedInClaimReport(testCaseName string, claimReport claim.Root) (bool, error)

IsTestCaseFailedInClaimReport test if test case is failed as expected in claim.json file.

func IsTestCasePassedInClaimReport

func IsTestCasePassedInClaimReport(testCaseName string, claimReport claim.Root) (bool, error)

IsTestCasePassedInClaimReport tests if test case is passed as expected in claim.json file.

func IsTestCaseSkippedInClaimReport

func IsTestCaseSkippedInClaimReport(testCaseName string, claimReport claim.Root) (bool, error)

IsTestCaseSkippedInClaimReport test if test case is failed as expected in claim.json file.

func LaunchTests

func LaunchTests(testCaseName string, tcNameForReport string, reportDir string, configDir string) error

LaunchTests stats tests based on given parameters.

func NamespaceExists

func NamespaceExists(namespace string) (bool, error)

func NodeHasHugePagesEnabled

func NodeHasHugePagesEnabled(node *corev1.Node, resourceName string) bool

func NodesHaveHugePagesEnabled

func NodesHaveHugePagesEnabled(resourceName string) bool

func OpenClaimReport

func OpenClaimReport(reportDir string) (*claim.Root, error)

OpenClaimReport opens claim.json file and returns struct.

func QueryPackageManifestForVersion

func QueryPackageManifestForVersion(operatorName, operatorNamespace string) (string, error)

QueryPackageManifest queries the package manifest for the operator.

func RedefineRoleWithAPIGroups

func RedefineRoleWithAPIGroups(role *rbacv1.Role, newAPIGroups []string)

func RedefineRoleWithResources

func RedefineRoleWithResources(role *rbacv1.Role, newResources []string)

func RemoveContentsFromConfigDir

func RemoveContentsFromConfigDir(configDir string) error

func RemoveContentsFromReportDir

func RemoveContentsFromReportDir(reportDir string) error

RemoveContentsFromReportDir removes all files from report dir.

func SetTestK8sAPIClient

func SetTestK8sAPIClient(client kubernetes.Interface)

func UnsetTestK8sAPIClient

func UnsetTestK8sAPIClient()

func ValidateCatalogSources

func ValidateCatalogSources() error

func ValidateIfReportsAreValid

func ValidateIfReportsAreValid(tcName string, tcExpectedStatus string, reportDir string) error

ValidateIfReportsAreValid test if report is valid for given test case.

func WaitForNamespaceDeletion

func WaitForNamespaceDeletion(cs corev1Typed.CoreV1Interface, nsName string, timeout time.Duration) error

WaitForDeletion waits until the namespace will be removed from the cluster.

Types

This section is empty.

Jump to

Keyboard shortcuts

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