helper

package
v0.1.3-alpha.7 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxRetryTimesForAvailablePort is the maximum retry times to get an available random port for port forwarding.
	MaxRetryTimesForAvailablePort = 100

	// MinPort is the minimum available port for port forwarding.
	MinPort = 10000

	// MaxPort is the maximum available port for port forwarding.
	MaxPort = 30000

	// DefaultTimeout is the default timeout for the e2e tests.
	DefaultTimeout = 1 * time.Minute

	// DefaultEtcdNamespace is the default namespace for the etcd cluster.
	DefaultEtcdNamespace = "etcd-cluster"

	// DefaultEtcdPodName is the default pod name for the etcd cluster.
	DefaultEtcdPodName = "etcd-0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Helper

type Helper struct {
	client.Client
}

Helper is a helper utility for e2e tests.

func New

func New(client client.Client) *Helper

New creates a new Helper instance.

func (*Helper) CleanEtcdData

func (h *Helper) CleanEtcdData(ctx context.Context) error

CleanEtcdData cleans up all data in etcd by executing the etcdctl command in the given pod.

func (*Helper) GetIngressIP

func (h *Helper) GetIngressIP(ctx context.Context, namespace, name string) (string, error)

GetIngressIP returns the ingress IP of the given service. It is assumed that the service is of type LoadBalancer.

func (*Helper) GetPVCs

GetPVCs returns the PVC list of the given component.

func (*Helper) GetPhase

func (h *Helper) GetPhase(ctx context.Context, namespace, name string, object client.Object) (greptimev1alpha1.Phase, error)

GetPhase returns the phase of GreptimeDBCluster or GreptimeDBStandalone object.

func (*Helper) KillPortForwardProcess

func (h *Helper) KillPortForwardProcess()

KillPortForwardProcess kills the port forwarding process.

func (*Helper) LoadCR

func (h *Helper) LoadCR(inputFile string, dstObject client.Object) error

LoadCR loads the CR from the input yaml file and unmarshals it into the given object.

func (*Helper) PortForward

func (h *Helper) PortForward(ctx context.Context, namespace, svc string, srcPort int) (string, error)

PortForward uses kubectl to port forward the service to a local random available port.

func (*Helper) RunSQLTest

func (h *Helper) RunSQLTest(ctx context.Context, addr string, sqlFile string) error

RunSQLTest runs the SQL test of the given SQL file on the given address by using the pgx driver. TODO(zyy17): We need to use sqlness in the future.

func (*Helper) TimestampInMillisecond

func (h *Helper) TimestampInMillisecond() int64

TimestampInMillisecond returns the current timestamp in milliseconds.

Jump to

Keyboard shortcuts

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