package testing
import "k8s.io/kubernetes/pkg/controlplane/apiserver/samples/generic/server/testing"
Index ¶
- type TearDownFunc
- type TestServer
- func StartTestServer(t ktesting.TB, instanceOptions *TestServerInstanceOptions, customFlags []string, storageConfig *storagebackend.Config) (result TestServer, err error)
- func StartTestServerOrDie(t ktesting.TB, instanceOptions *TestServerInstanceOptions, flags []string, storageConfig *storagebackend.Config) *TestServer
- type TestServerInstanceOptions
Types ¶
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 ServerOpts *controlplaneapiserver.Options // ServerOpts TearDownFn TearDownFunc // TearDown function TmpDir string // Temp Dir used, by the apiserver EtcdClient *clientv3.Client // used by tests that need to check data migrated from APIs that are no longer served EtcdStoragePrefix string // storage prefix in etcd }
TestServer represents a running test server with everything to access it and its backing store etcd.
func StartTestServer ¶
func StartTestServer(t ktesting.TB, instanceOptions *TestServerInstanceOptions, customFlags []string, storageConfig *storagebackend.Config) (result TestServer, err error)
StartTestServer starts an etcd server and sample-generic-controlplane and returns a TestServer struct with a tear-down func and clients to access it and its backing store.
func StartTestServerOrDie ¶
func StartTestServerOrDie(t ktesting.TB, instanceOptions *TestServerInstanceOptions, flags []string, storageConfig *storagebackend.Config) *TestServer
StartTestServerOrDie calls StartTestServer t.Fatal if it does not succeed.
type TestServerInstanceOptions ¶
type TestServerInstanceOptions struct { // SkipHealthzCheck returns without waiting for the server to become healthy. // Useful for testing server configurations expected to prevent /healthz from completing. SkipHealthzCheck bool }
TestServerInstanceOptions Instance options the TestServer
func NewDefaultTestServerOptions ¶
func NewDefaultTestServerOptions() *TestServerInstanceOptions
NewDefaultTestServerOptions default options for TestServer instances
Source Files ¶
testserver.go
- Version
- v1.33.0 (latest)
- Published
- Apr 23, 2025
- Platform
- linux/amd64
- Imports
- 28 packages
- Last checked
- 3 hours ago –
Tools for package owners.