testutil

package
v0.0.0-...-83947fe Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCertificate

func LoadCertificate(t *testing.T, certSecret *corev1.Secret, key string) *x509.Certificate

func PrintDebugLogs

func PrintDebugLogs(t *testing.T, options *k8s.KubectlOptions)

PrintDebugLogs adds the verbose logging of the cluster at the runtime.

func RequireCRDBToFunction

func RequireCRDBToFunction(t *testing.T, crdbCluster CockroachCluster, rotate bool)

RequireCRDBToFunction creates a database, a table and insert two rows if it is a fresh install of the cluster. If certificate is rotated and cluster rolling restart has happened, this will check that existing two rows are present.

func RequireCertRotateJobToBeCompleted

func RequireCertRotateJobToBeCompleted(t *testing.T, jobName string, crdbCluster CockroachCluster, timeout time.Duration)

RequireCertRotateJobToBeCompleted waits for the certificate rotation job to complete.

func RequireCertificatesToBeValid

func RequireCertificatesToBeValid(t *testing.T, crdbCluster CockroachCluster)

RequireCertificatesToBeValid will check the CA certificate and client certificate validity from their respective secrets. Also, it verifies that node certificates are signed by the CA certificates used in the cluster.

func RequireClusterToBeReadyEventuallyTimeout

func RequireClusterToBeReadyEventuallyTimeout(t *testing.T, crdbCluster CockroachCluster, timeout time.Duration)

RequireClusterToBeReadyEventuallyTimeout waits for all the CRDB pods to come into running state.

func RequireDatabaseToFunction

func RequireDatabaseToFunction(t *testing.T, crdbCluster CockroachCluster, dbName string)

RequireDatabaseToFunction creates a table and insert two rows.

func RequireToRunRotateJob

func RequireToRunRotateJob(t *testing.T, crdbCluster CockroachCluster, values map[string]string,
	scheduleToTriggerRotation string, caRotate bool)

RequireToRunRotateJob triggers the client/node or CA certificate rotation job based on next cron schedule.

Types

type CockroachCluster

type CockroachCluster struct {
	Cfg                        *rest.Config
	K8sClient                  client.Client
	StatefulSetName, Namespace string
	ClientSecret, NodeSecret   string
	CaSecret                   string
	IsCaUserProvided           bool
}

Jump to

Keyboard shortcuts

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