...

Package testing

import "k8s.io/kubernetes/cmd/kube-controller-manager/app/testing"
Overview
Index

Overview ▾

type TearDownFunc

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

type TearDownFunc func()

type TestServer

TestServer return values supplied by kube-test-ApiServer

type TestServer struct {
    LoopbackClientConfig *restclient.Config // Rest client config using the magic token
    Options              *options.KubeControllerManagerOptions
    Config               *kubecontrollerconfig.Config
    TearDownFn           TearDownFunc // TearDown function
    TmpDir               string       // Temp Dir used, by the apiserver
}

func StartTestServer

func StartTestServer(ctx context.Context, customFlags []string) (result TestServer, err error)

StartTestServer starts a kube-controller-manager. 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(ctx context.Context, flags []string) *TestServer

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