package testing
import "k8s.io/apiextensions-apiserver/pkg/cmd/server/testing"
Index ¶
- type Logger
- type TearDownFunc
- type TestServer
- func StartTestServer(t Logger, _ *TestServerInstanceOptions, customFlags []string, storageConfig *storagebackend.Config) (result TestServer, err error)
- func StartTestServerOrDie(t Logger, instanceOptions *TestServerInstanceOptions, flags []string, storageConfig *storagebackend.Config) *TestServer
- type TestServerInstanceOptions
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 ServerOpts *options.CustomResourceDefinitionsServerOptions // ServerOpts TearDownFn TearDownFunc // TearDown function TmpDir string // Temp Dir used, by the apiserver CompletedConfig extensionsapiserver.CompletedConfig }
TestServer return values supplied by kube-test-ApiServer
func StartTestServer ¶
func StartTestServer(t Logger, _ *TestServerInstanceOptions, customFlags []string, storageConfig *storagebackend.Config) (result TestServer, err error)
StartTestServer starts a apiextensions-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, instanceOptions *TestServerInstanceOptions, flags []string, storageConfig *storagebackend.Config) *TestServer
StartTestServerOrDie calls StartTestServer t.Fatal if it does not succeed.
type TestServerInstanceOptions ¶
type TestServerInstanceOptions struct { }
TestServerInstanceOptions Instance options the TestServer
func NewDefaultTestServerOptions ¶
func NewDefaultTestServerOptions() *TestServerInstanceOptions
NewDefaultTestServerOptions Default options for TestServer instances
Source Files ¶
testserver.go
- Version
- v0.33.0 (latest)
- Published
- Apr 23, 2025
- Platform
- linux/amd64
- Imports
- 25 packages
- Last checked
- 6 hours ago –
Tools for package owners.