framework

package
v0.0.0-...-1c6c245 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OperatorDeploymentNamespace = "openshift-image-registry"
	OperatorDeploymentName      = "cluster-image-registry-operator"
)
View Source
const (
	ClusterVersionName = "version"
)

Variables

View Source
var (
	AsyncOperationTimeout = 5 * time.Minute
)

Functions

func CheckEnvVars

func CheckEnvVars(want []corev1.EnvVar, have []corev1.EnvVar, includes bool) []error

func ConditionExistsWithStatusAndReason

func ConditionExistsWithStatusAndReason(client *Clientset, conditionType string, conditionStatus operatorapi.ConditionStatus, conditionReason string) []error

func CreateOrUpdateSecret

func CreateOrUpdateSecret(name string, namespace string, data map[string]string) (*corev1.Secret, error)

func DeleteCompletely

func DeleteCompletely(getObject func() (metav1.Object, error), deleteObject func(*metav1.DeleteOptions) error) error

DeleteCompletely sends a delete request and waits until the resource and its dependents are deleted.

func DeployImageRegistry

func DeployImageRegistry(logger Logger, client *Clientset, cr *imageregistryapiv1.Config) error

func DisableCVOForOperator

func DisableCVOForOperator(logger Logger, client *Clientset) error

func DumpClusterProxyResource

func DumpClusterProxyResource(logger Logger, client *Clientset)

DumpClusterProxyResource prints out the cluster proxy configuration

func DumpImageRegistryDeployment

func DumpImageRegistryDeployment(logger Logger, client *Clientset)

func DumpImageRegistryResource

func DumpImageRegistryResource(logger Logger, client *Clientset)

func DumpObject

func DumpObject(logger Logger, prefix string, obj interface{})

DumpObject prints the object to the test log.

func DumpOperatorDeployment

func DumpOperatorDeployment(logger Logger, client *Clientset)

func DumpOperatorLogs

func DumpOperatorLogs(logger Logger, client *Clientset)

func DumpPodLogs

func DumpPodLogs(logger Logger, podLogs PodSetLogs)

func DumpYAML

func DumpYAML(logger Logger, prefix string, obj interface{})

DumpYAML prints the object to the test log as YAML.

func EnsureExternalRegistryHostnamesAreSet

func EnsureExternalRegistryHostnamesAreSet(t *testing.T, client *Clientset, wantedHostnames []string)

func EnsureExternalRoutesExist

func EnsureExternalRoutesExist(t *testing.T, client *Clientset, wantedRoutes []string)

func MustDeployImageRegistry

func MustDeployImageRegistry(t *testing.T, client *Clientset, cr *imageregistryapiv1.Config)

func MustEnsureClusterOperatorStatusIsNormal

func MustEnsureClusterOperatorStatusIsNormal(t *testing.T, client *Clientset)

func MustEnsureClusterOperatorStatusIsSet

func MustEnsureClusterOperatorStatusIsSet(t *testing.T, client *Clientset) *configapiv1.ClusterOperator

func MustEnsureDefaultExternalRegistryHostnameIsSet

func MustEnsureDefaultExternalRegistryHostnameIsSet(t *testing.T, client *Clientset)

func MustEnsureDefaultExternalRouteExists

func MustEnsureDefaultExternalRouteExists(t *testing.T, client *Clientset)

func MustEnsureImageRegistryIsAvailable

func MustEnsureImageRegistryIsAvailable(t *testing.T, client *Clientset)

func MustEnsureImageRegistryIsProcessed

func MustEnsureImageRegistryIsProcessed(t *testing.T, client *Clientset) *imageregistryapiv1.Config

func MustEnsureInternalRegistryHostnameIsSet

func MustEnsureInternalRegistryHostnameIsSet(t *testing.T, client *Clientset)

func MustEnsureNodeCADaemonSetIsAvailable

func MustEnsureNodeCADaemonSetIsAvailable(t *testing.T, client *Clientset)

func MustEnsureOperatorIsNotHotLooping

func MustEnsureOperatorIsNotHotLooping(t *testing.T, client *Clientset)

func MustEnsureServiceCAConfigMap

func MustEnsureServiceCAConfigMap(t *testing.T, client *Clientset)

func MustFollowPodLog

func MustFollowPodLog(t *testing.T, pod corev1.Pod) (<-chan string, <-chan error)

MustFollowPodLog attaches to the pod log stream, reads it until the pod is dead or an error happens while reading.

If an error happens when fetching pod's Stream() this function calls t.Fatal while if a failure happens during pods log read the error is sent back to the caller through an error channel.

func MustRemoveImageRegistry

func MustRemoveImageRegistry(t *testing.T, client *Clientset)

func RemoveImageRegistry

func RemoveImageRegistry(logger Logger, client *Clientset) error

func ResetClusterProxyConfig

func ResetClusterProxyConfig(client *Clientset) error

ResetClusterProxyConfig patches the cluster proxy resource to contain an empty proxy configuration

func ResetResourceProxyConfig

func ResetResourceProxyConfig(client *Clientset) error

ResetResourceProxyConfig patches the image registry resource to contain an empty proxy configuration

func SetClusterProxyConfig

func SetClusterProxyConfig(proxyConfig openshiftapiv1.ProxySpec, client *Clientset) error

SetClusterProxyConfig patches the cluster proxy resource to contain the provided proxy configuration

func SetResourceProxyConfig

func SetResourceProxyConfig(proxyConfig imageregistryapiv1.ImageRegistryConfigProxy, client *Clientset) error

SetResourceProxyConfig patches the image registry resource to contain the provided proxy configuration

func StopDeployment

func StopDeployment(logger Logger, client *Clientset, operatorDeploymentName, operatorDeploymentNamespace string) error

func WaitForNewRegistryDeployment

func WaitForNewRegistryDeployment(client *Clientset, currentGeneration int64) (*kappsapiv1.Deployment, error)

func WaitForNewRegistryOperatorDeployment

func WaitForNewRegistryOperatorDeployment(client *Clientset, currentGeneration int64) (*kappsapiv1.Deployment, error)

func WaitForNodeCADaemonSet

func WaitForNodeCADaemonSet(client *Clientset) (*appsv1.DaemonSet, error)

func WaitForRegistryDeployment

func WaitForRegistryDeployment(client *Clientset) (*kappsapiv1.Deployment, error)

func WaitForRegistryOperatorDeployment

func WaitForRegistryOperatorDeployment(client *Clientset) (*kappsapiv1.Deployment, error)

Types

type Clientset

Clientset is a set of Kubernetes clients.

func MustNewClientset

func MustNewClientset(t *testing.T, kubeconfig *restclient.Config) *Clientset

MustNewClientset is like NewClienset but aborts the test if clienset cannot be constructed.

func NewClientset

func NewClientset(kubeconfig *restclient.Config) (clientset *Clientset, err error)

NewClientset creates a set of Kubernetes clients. The default kubeconfig is used if not provided.

type ConditionStatus

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

func (ConditionStatus) IsFalse

func (cs ConditionStatus) IsFalse() bool

func (ConditionStatus) IsTrue

func (cs ConditionStatus) IsTrue() bool

func (ConditionStatus) Reason

func (cs ConditionStatus) Reason() string

func (ConditionStatus) String

func (cs ConditionStatus) String() string

type ContainerLog

type ContainerLog []string

func (ContainerLog) Contains

func (log ContainerLog) Contains(re *regexp.Regexp) bool

type ImageRegistryConditions

type ImageRegistryConditions struct {
	Available   ConditionStatus
	Progressing ConditionStatus
	Degraded    ConditionStatus
	Removed     ConditionStatus
}

func (ImageRegistryConditions) String

func (c ImageRegistryConditions) String() string

type Logger

type Logger interface {
	Logf(string, ...interface{})
}

Logger is an interface to report events from tests. It is implemented by testing.T.

type PodLog

type PodLog map[string]ContainerLog

func (PodLog) Contains

func (log PodLog) Contains(re *regexp.Regexp) bool

type PodSetLogs

type PodSetLogs map[string]PodLog

func GetLogsByLabelSelector

func GetLogsByLabelSelector(client *Clientset, namespace string, labelSelector *metav1.LabelSelector) (PodSetLogs, error)

func GetOperatorLogs

func GetOperatorLogs(client *Clientset) (PodSetLogs, error)

func (PodSetLogs) Contains

func (psl PodSetLogs) Contains(re *regexp.Regexp) bool

Directories

Path Synopsis
mock

Jump to

Keyboard shortcuts

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