testutil

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CapturePodLogs

func CapturePodLogs(ctx context.Context, config *rest.Config, namespace, pod string) error

CapturePodLogs streams the logs of the given pod to the GinkgoWriter until the context is cancelled.

func GetFreePort

func GetFreePort() (int, error)

GetFreePort returns a free port from the OS.

func GetNonEmptyLines

func GetNonEmptyLines(output string) []string

GetNonEmptyLines converts given command output string into individual objects according to line breakers, and ignores the empty elements in it.

func GetProjectDir

func GetProjectDir() (string, error)

GetProjectDir will return the directory where the project is.

func InstallCertManager

func InstallCertManager(ctx context.Context) error

InstallCertManager installs the cert manager bundle.

func InstallPrometheusOperator

func InstallPrometheusOperator(ctx context.Context) error

InstallPrometheusOperator installs the prometheus Operator to be used to export the enabled metrics.

func LoadImageToKindClusterWithName

func LoadImageToKindClusterWithName(ctx context.Context, name string) error

LoadImageToKindClusterWithName loads a local docker image to the kind cluster.

func Run

func Run(cmd *exec.Cmd) ([]byte, error)

Run executes the provided command within this context.

func SetupCA

func SetupCA(ctx context.Context, k8sClient client.Client, namespace string, suffix uint32)

SetupCA sets up a self-signed CA issuer and a CA certificate in the given namespace.

func UninstallPrometheusOperator

func UninstallPrometheusOperator(ctx context.Context)

UninstallPrometheusOperator uninstalls the prometheus.

func WaitReplicaCount

func WaitReplicaCount(ctx context.Context, k8sClient client.Client, namespace, app string, replicas int) error

WaitReplicaCount waits until the number of pods with the given app label.

Types

type ClickHouseClient

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

ClickHouseClient is a ClickHouse client for testing ClickHouse clusters. Forwards ports to ClickHouse pods.

func NewClickHouseClient

func NewClickHouseClient(
	ctx context.Context,
	config *rest.Config,
	cr *v1.ClickHouseCluster,
	auth ...clickhouse.Auth,
) (*ClickHouseClient, error)

NewClickHouseClient creates a new ClickHouseClient connected to the specified ClickHouseCluster.

func (*ClickHouseClient) CheckDefaultDatabasesReplicated

func (c *ClickHouseClient) CheckDefaultDatabasesReplicated(ctx context.Context) error

CheckDefaultDatabasesReplicated checks that the default database has Replicated engine on all cluster nodes.

func (*ClickHouseClient) CheckRead

func (c *ClickHouseClient) CheckRead(ctx context.Context, order int) error

CheckRead reads and verifies test data from the ClickHouse cluster.

func (*ClickHouseClient) CheckWrite

func (c *ClickHouseClient) CheckWrite(ctx context.Context, order int) error

CheckWrite writes test data to the ClickHouse cluster.

func (*ClickHouseClient) Close

func (c *ClickHouseClient) Close()

Close closes the ClickHouseClient and releases all resources.

func (*ClickHouseClient) CreateDatabase

func (c *ClickHouseClient) CreateDatabase(ctx context.Context) error

CreateDatabase creates the test database on the ClickHouse cluster.

func (*ClickHouseClient) QueryRow

func (c *ClickHouseClient) QueryRow(ctx context.Context, query string, result any) error

QueryRow executes a query on one of the ClickHouse cluster nodes. Scans the result into the provided result variable.

type ForwardedCluster

type ForwardedCluster struct {
	PodToAddr map[*corev1.Pod]string
	// contains filtered or unexported fields
}

ForwardedCluster represents a set of port-forwarded pods.

func NewForwardedCluster

func NewForwardedCluster(ctx context.Context, config *rest.Config,
	namespace, app string, port uint16,
) (*ForwardedCluster, error)

NewForwardedCluster creates a new ForwardedCluster by port-forwarding all pods with the given app label.

func (*ForwardedCluster) Close

func (c *ForwardedCluster) Close()

Close stops all port-forwarding.

type KeeperClient

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

KeeperClient is a ZooKeeper client for testing Keeper clusters. Forwards ports to Keeper pods.

func NewKeeperClient

func NewKeeperClient(ctx context.Context, config *rest.Config, cr *v1.KeeperCluster) (*KeeperClient, error)

NewKeeperClient creates a new KeeperClient connected to the specified KeeperCluster.

func (*KeeperClient) CheckRead

func (c *KeeperClient) CheckRead(order int) error

CheckRead reads and verifies test data from the Keeper cluster.

func (*KeeperClient) CheckWrite

func (c *KeeperClient) CheckWrite(order int) error

CheckWrite writes test data to the Keeper cluster.

func (*KeeperClient) Close

func (c *KeeperClient) Close()

Close closes the KeeperClient and releases all resources.

Jump to

Keyboard shortcuts

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