server

package
v0.27.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(executableName, identity string) []string

Command returns the string tokens required to start the given executable in the currently configured mode (direct or via `go run`).

func CreateTempDirForTest

func CreateTempDirForTest(t *testing.T, dirName string) (string, error)

CreateTempDirForTest creates the named directory with a unique base path derived from the name of the current test.

func GetFreePort

func GetFreePort(t *testing.T) (string, error)

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

func RunInProcess

func RunInProcess(o *runOptions)

func ScrapeMetrics

func ScrapeMetrics(ctx context.Context, cfg *rest.Config, promUrl, promCfgDir, jobName, caFile string, labels map[string]string) error

func ScratchDirs

func ScratchDirs(t *testing.T) (string, string, error)

ScratchDirs determines where artifacts and data should live for a test server. The passed subDir is appended to the artifact directory and should be unique to the test.

func StartKcpCommand

func StartKcpCommand(identity string) []string

StartKcpCommand returns the string tokens required to start kcp in the currently configured mode (direct or via `go run`).

func WaitForReady

func WaitForReady(ctx context.Context, t *testing.T, cfg *rest.Config, keepMonitoring bool) error

func WithLogStreaming

func WithLogStreaming(o *runOptions)

Types

type Config

type Config struct {
	Name        string
	Args        []string
	ArtifactDir string
	DataDir     string
	ClientCADir string

	LogToConsole bool
	RunInProcess bool
}

Config qualify a kcp server to start

Deprecated for use outside this package. Prefer PrivateKcpServer().

type Fixture

type Fixture struct {
	Servers map[string]RunningServer
}

Fixture manages the lifecycle of a set of kcp servers.

Deprecated for use outside this package. Prefer PrivateKcpServer().

func NewFixture

func NewFixture(t *testing.T, cfgs ...Config) *Fixture

NewFixture returns a new kcp server fixture.

type Option

type Option func(*Config) *Config

Option a function that wish to modify a given kcp configuration.

func WithCustomArguments

func WithCustomArguments(args ...string) Option

WithCustomArguments applies provided arguments to a given kcp configuration.

func WithScratchDirectories

func WithScratchDirectories(artifactDir, dataDir string) Option

WithScratchDirectories adds custom scratch directories to a kcp configuration.

type RunOption

type RunOption func(o *runOptions)

type RunningServer

type RunningServer interface {
	Name() string
	KubeconfigPath() string
	RawConfig() (clientcmdapi.Config, error)
	BaseConfig(t *testing.T) *rest.Config
	RootShardSystemMasterBaseConfig(t *testing.T) *rest.Config
	ShardSystemMasterBaseConfig(t *testing.T, shard string) *rest.Config
	ShardNames() []string
	Artifact(t *testing.T, producer func() (runtime.Object, error))
	ClientCAUserConfig(t *testing.T, config *rest.Config, name string, groups ...string) *rest.Config
	CADirectory() string
}

func NewExternalKCPServer

func NewExternalKCPServer(name, kubeconfigPath string, shardKubeconfigPaths map[string]string, clientCADir string) (RunningServer, error)

NewExternalKCPServer returns a RunningServer for a kubeconfig pointing to a kcp instance not managed by the test run. Since the kubeconfig is expected to exist prior to running tests against it, the configuration can be loaded synchronously and no locking is required to subsequently access it.

Jump to

Keyboard shortcuts

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