Documentation ¶
Index ¶
- Variables
- func CheckPodsRunningReady(ctx context.Context, c ctrlruntimeclient.Client, log *zap.SugaredLogger, ...) bool
- func GetClients() (ctrlruntimeclient.Client, rest.Interface, *rest.Config, error)
- func GetClientsOrDie() (ctrlruntimeclient.Client, rest.Interface, *rest.Config)
- func KubernetesVersion() string
- func PodRunningReady(p *corev1.Pod) error
- func WaitFor(interval time.Duration, timeout time.Duration, callback func() bool) bool
- func WaitForDeploymentReady(ctx context.Context, c ctrlruntimeclient.Client, log *zap.SugaredLogger, ...) error
- func WaitForPodCondition(ctx context.Context, c ctrlruntimeclient.Client, log *zap.SugaredLogger, ...) error
- func WaitForPodsCreated(ctx context.Context, c ctrlruntimeclient.Client, log *zap.SugaredLogger, ...) ([]string, error)
- type TestPodConfig
Constants ¶
This section is empty.
Variables ¶
var DefaultLogOptions = log.Options{ Debug: false, Format: log.FormatConsole, }
Functions ¶
func CheckPodsRunningReady ¶
func CheckPodsRunningReady(ctx context.Context, c ctrlruntimeclient.Client, log *zap.SugaredLogger, 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 GetClients ¶
GetClients returns the clients used for testing or an error if something goes wrong during the clients creation.
func GetClientsOrDie ¶
GetClientsOrDie returns the clients used for testing or panics if something goes wrong during the clients creation.
func KubernetesVersion ¶
func KubernetesVersion() string
func PodRunningReady ¶
PodRunningReady checks whether pod p's phase is running and it has a ready condition of status true.
func WaitFor ¶
WaitFor is a convenience wrapper that makes simple, "brute force" waiting loops easier to write.
func WaitForDeploymentReady ¶
func WaitForDeploymentReady(ctx context.Context, c ctrlruntimeclient.Client, log *zap.SugaredLogger, ns, name string, timeout time.Duration) error
WaitForDeploymentReady waits until the Deployment is fully ready.
func WaitForPodCondition ¶
func WaitForPodCondition(ctx context.Context, c ctrlruntimeclient.Client, log *zap.SugaredLogger, ns, podName, desc string, timeout time.Duration, condition podCondition) error
WaitForPodCondition waits a pods to be matched to the given condition.
func WaitForPodsCreated ¶
func WaitForPodsCreated(ctx context.Context, c ctrlruntimeclient.Client, log *zap.SugaredLogger, replicas int, namespace string, matchLabels map[string]string) ([]string, error)
WaitForPodsCreated waits for the given replicas number of pods matching the given set of labels to be created, and returns the names of the matched pods.
Types ¶
type TestPodConfig ¶
type TestPodConfig struct { Log *zap.SugaredLogger Namespace string Client ctrlruntimeclient.Client PodRestClient rest.Interface Config *rest.Config // CreatePodFunc returns the manifest of the pod to be used for running the // test. As we need to exec the pod should not terminate (e.g. run an // infinite sleep). CreatePodFunc func(ns string) *corev1.Pod PodReadinessTimeout time.Duration // contains filtered or unexported fields }
func (*TestPodConfig) CleanUp ¶
func (t *TestPodConfig) CleanUp(ctx context.Context) error
CleanUp deletes the resources.
func (*TestPodConfig) DeployTestPod ¶
func (t *TestPodConfig) DeployTestPod(ctx context.Context, log *zap.SugaredLogger) error
DeployTestPod deploys the pod to be used to run the test command.