envtest

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GardenerAPIServer

type GardenerAPIServer struct {
	// EtcdURL is the etcd URL that the APIServer should connect to (defaults to the URL of the envtest etcd).
	EtcdURL *url.URL
	// CertDir is a path to a directory containing whatever certificates the APIServer needs.
	// If left unspecified, then Start will create a temporary directory and generate the needed
	// certs and Stop will clean it up.
	CertDir string
	// Path is the path to the gardener-apiserver binary, can be set via TEST_ASSET_GARDENER_APISERVER.
	// If Path is unset, gardener-apiserver will be started in-process.
	Path string
	// SecurePort is the secure port that the APIServer should listen on.
	// If this is not specified, we default to a random free port on localhost.
	SecurePort int
	// Args is a list of arguments which will passed to the APIServer binary.
	// If not specified, the minimal set of arguments to run the APIServer will
	// be used.
	Args []string
	// StartTimeout, StopTimeout specify the time the APIServer is allowed to
	// take when starting and stoppping before an error is emitted.
	// If not specified, these default to 20 seconds.
	StartTimeout time.Duration
	StopTimeout  time.Duration
	// Out, Err specify where APIServer should write its StdOut, StdErr to.
	// If not specified, the output will be discarded.
	Out io.Writer
	Err io.Writer
	// HealthCheckEndpoint is the path of the healthcheck endpoint (defaults to "/healthz").
	// It will be polled until receiving http.StatusOK (or StartTimeout occurs), before
	// returning from Start.
	HealthCheckEndpoint string
	// contains filtered or unexported fields
}

GardenerAPIServer knows how to start, register and stop a temporary gardener-apiserver instance.

func (*GardenerAPIServer) Start

func (g *GardenerAPIServer) Start() error

Start brings up the GardenerAPIServer, waits for it to be healthy and registers Gardener's APIs.

func (*GardenerAPIServer) Stop

func (g *GardenerAPIServer) Stop() error

Stop stops this GardenerAPIServer and cleans its temporary resources.

type GardenerTestEnvironment

type GardenerTestEnvironment struct {
	*envtest.Environment

	// GardenerAPIServer knows how to start, register and stop a temporary gardener-apiserver instance.
	GardenerAPIServer *GardenerAPIServer
}

GardenerTestEnvironment wraps envtest.Environment and additionally starts, registers and stops an instance of gardener-apiserver in order to work with gardener resources in the test.

func (*GardenerTestEnvironment) Start

func (e *GardenerTestEnvironment) Start() (*rest.Config, error)

Start starts the underlying envtest.Environment and the GardenerAPIServer.

func (*GardenerTestEnvironment) Stop

func (e *GardenerTestEnvironment) Stop() error

Stop stops the underlying envtest.Environment and the GardenerAPIServer.

Jump to

Keyboard shortcuts

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