testutil

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFreePort

func GetFreePort(t *testing.T) int

GetFreePort asks the kernel for a free open port that is ready to use for tests.

func StderrOutputForFunc

func StderrOutputForFunc(f func()) string

func StdoutOutputForFunc

func StdoutOutputForFunc(f func()) string

Types

type CustomError

type CustomError struct {
	ErrorMessage string
}

func (CustomError) Error

func (c CustomError) Error() string

type ServiceConfigs

type ServiceConfigs struct {
	HTTPPort    int
	HTTPHost    string
	MetricsPort int
	MetricsHost string
	GRPCPort    int
	GRPCHost    string
}

ServiceConfigs holds the configuration details for different server components.

func NewServerConfigs

func NewServerConfigs(t *testing.T) *ServiceConfigs

NewServerConfigs sets up server configurations for testing and returns a ServiceConfigs struct. It dynamically assigns free ports for HTTP, Metrics, and gRPC services, sets up environment variables for them, and returns a struct with the configured values.

func (*ServiceConfigs) Get

Get implements config.Config.

func (*ServiceConfigs) GetOrDefault

func (*ServiceConfigs) GetOrDefault(string, string) string

GetOrDefault implements config.Config.

Jump to

Keyboard shortcuts

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