testing

package
v0.0.0-...-fa1f097 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartDefaultIntegrationTestServer

func StartDefaultIntegrationTestServer(t Logger, flags ...string) (func(), *rest.Config, error)

StartDefaultIntegrationTestServer starts a default test server against an pre-launched etcd cluster.

func StartDefaultTestServer

func StartDefaultTestServer(t Logger, storageConfig *storagebackend.Config, flags ...string) (func(), *rest.Config, error)

StartDefaultTestServer starts a test server with default test flags.

Types

type Logger

type Logger interface {
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Logf(format string, args ...interface{})
}

Logger allows t.Testing and b.Testing to be passed to StartTestServer and StartTestServerOrDie

type TearDownFunc

type TearDownFunc func()

TearDownFunc is to be called to tear down a test server.

type TestServer

type TestServer struct {
	ClientConfig *restclient.Config // Rest client config
	TearDownFn   TearDownFunc       // TearDown function
	TmpDir       string             // Temp Dir used, by the apiserver
}

TestServer is the result of test server startup.

func StartTestServer

func StartTestServer(t Logger, customFlags []string, storageConfig *storagebackend.Config) (result TestServer, err error)

StartTestServer starts a oauth-apiserver. A rest client config and a tear-down func, and location of the tmpdir are returned.

Note: we return a tear-down func instead of a stop channel because the later will leak temporary

files that because Golang testing's call to os.Exit will not give a stop channel go routine
enough time to remove temporary files.

func StartTestServerOrDie

func StartTestServerOrDie(t Logger, flags []string, storageConfig *storagebackend.Config) *TestServer

StartTestServerOrDie calls StartTestServer t.Fatal if it does not succeed.

Jump to

Keyboard shortcuts

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