helpers

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package helpers implements several helpers for testing.

Index

Constants

View Source
const (
	// ModeStandalone marks a single-process integration suite where the liaison
	// and data node share an in-process schema cache.
	ModeStandalone = "standalone"
	// ModeDistributed marks a multi-process integration suite where the liaison
	// and data nodes have separate schema caches.
	ModeDistributed = "distributed"
)

Test deployment modes carried in SharedContext.Mode.

Variables

This section is empty.

Functions

func CPUInfo added in v0.6.0

func CPUInfo() string

CPUInfo returns the CPU information of the current machine.

func ExtractQL added in v0.11.0

func ExtractQL(content string) (string, []*modelv1.TagValue, error)

ExtractQL assembles a BydbQL query string from a .ql file's content, skipping blank and comment lines, and decodes the optional `#!params:` directive into TagValues bound to the query's `?` placeholders. The directive value is a JSON array of protojson-encoded model.v1.TagValue objects, e.g. `#!params: [{"str":{"value":"-15m"}},{"int":{"value":"10"}}]`.

func HTTPHealthCheck added in v0.2.0

func HTTPHealthCheck(addr, cert string) func() error

HTTPHealthCheck returns a function for ginkgo "Eventually" poll it repeatedly to check whether a HTTP server is ready.

func HTTPHealthCheckWithAuth added in v0.9.0

func HTTPHealthCheckWithAuth(addr, cert, username, password string) func() error

HTTPHealthCheckWithAuth returns a function for ginkgo "Eventually" poll it repeatedly to check whether a HTTP server is ready with Auth.

func HealthCheck

func HealthCheck(addr string, connTimeout time.Duration, rpcTimeout time.Duration, opts ...grpc.DialOption) func() error

HealthCheck returns a function for ginkgo "Eventually" poll it repeatedly to check whether a gRPC server is ready.

func HealthCheckWithAuth added in v0.9.0

func HealthCheckWithAuth(addr string, connTimeout time.Duration, rpcTimeout time.Duration, username, password string, opts ...grpc.DialOption) func() error

HealthCheckWithAuth returns a function for ginkgo "Eventually" poll it repeatedly to check whether a gRPC server is ready with Auth.

func MemoryInfo added in v0.6.0

func MemoryInfo() string

MemoryInfo returns the memory information of the current machine.

func OSInfo added in v0.6.0

func OSInfo() string

OSInfo returns the OS information of the current machine.

func PrintDiskUsage added in v0.6.0

func PrintDiskUsage(dir string, maxDepth, curDepth int)

PrintDiskUsage prints the disk usage of the specified directory and its subdirectories.

func TimeRange added in v0.2.0

func TimeRange(args Args, shardContext SharedContext) *modelv1.TimeRange

TimeRange returns a modelv1.TimeRange based on Args and SharedContext.

func UnmarshalYAML added in v0.2.0

func UnmarshalYAML(ii []byte, m proto.Message)

UnmarshalYAML decodes YAML raw bytes to proto.Message.

Types

type Args added in v0.2.0

type Args struct {
	Begin           *timestamppb.Timestamp
	End             *timestamppb.Timestamp
	Input           string
	Want            string
	Stages          []string
	Offset          time.Duration
	Duration        time.Duration
	WantEmpty       bool
	WantErr         bool
	DisOrder        bool
	IgnoreElementID bool
}

Args is a wrapper seals all necessary info for table specs.

type BackupSharedContext added in v0.8.0

type BackupSharedContext struct {
	DataAddr   string
	Connection *grpclib.ClientConn
	FS         remote.FS
	RootDir    string
	DestDir    string
	DestURL    string
	S3Args     []string
}

BackupSharedContext is the context shared between test cases in the snapshot testing.

type LifecycleSharedContext added in v0.8.0

type LifecycleSharedContext struct {
	BaseTime    time.Time
	Connection  *grpclib.ClientConn
	LiaisonAddr string
	DataAddr    string
	// DataHTTPURL is the hot data node's Prometheus /metrics endpoint. Used
	// by sender-label verifications that need to scrape banyandb_queue_sub_*
	// directly from the data node.
	DataHTTPURL string
	// WarmHTTPURL is the warm data node's Prometheus /metrics endpoint. Both
	// data nodes (hot and warm) see migration writes from the lifecycle
	// publisher, so either endpoint can carry the sender labels.
	WarmHTTPURL   string
	SrcDir        string
	DestDir       string
	MetadataFlags []string
}

LifecycleSharedContext is the context shared between test cases in the lifecycle testing.

type SharedContext added in v0.2.0

type SharedContext struct {
	BaseTime   time.Time
	Connection *grpclib.ClientConn
	// DataNodeAddrs lists the gRPC addresses of the cluster's data nodes.
	// Populated by the distributed BeforeSuite; nil for standalone runs.
	// Cluster-only specs ( partial-cluster barrier scenarios) pass
	// entries from this slice to setup.PauseDataNodeWatch /
	// ResumeDataNodeWatch to drive a single node out of sync while the
	// rest of the cluster stays caught up.
	DataNodeAddrs []string
	// LiaisonAddr is the receiving liaison's gRPC address. Populated by
	// the distributed BeforeSuite; empty for standalone runs. Specs use
	// it with setup.PauseDataNodeWatch when they need to pause the
	// receiving liaison's own SchemaRegistry — the cluster barrier's
	// selfName probe reads through this SR, so pausing it surfaces a
	// laggard via the public AwaitX RPCs without needing
	// NodeSchemaStatusService exposed on data-node ports.
	LiaisonAddr string
	Mode        string
}

SharedContext is the context shared between test cases in the integration testing.

Jump to

Keyboard shortcuts

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