func init() { … } const ecdsaPrivateKey … type TearDownFunc … type TestServerInstanceOptions … type TestServer … // NewDefaultTestServerOptions default options for TestServer instances func NewDefaultTestServerOptions() *TestServerInstanceOptions { … } // 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 StartTestServer(t ktesting.TB, instanceOptions *TestServerInstanceOptions, customFlags []string, storageConfig *storagebackend.Config) (result TestServer, err error) { … } // StartTestServerOrDie calls StartTestServer t.Fatal if it does not succeed. func StartTestServerOrDie(t ktesting.TB, instanceOptions *TestServerInstanceOptions, flags []string, storageConfig *storagebackend.Config) *TestServer { … } func createLocalhostListenerOnFreePort() (net.Listener, int, error) { … } // pkgPath returns the absolute file path to this package's directory. With go // test, we can just look at the runtime call stack. However, bazel compiles go // binaries with the -trimpath option so the simple approach fails however we // can consult environment variables to derive the path. // // The approach taken here works for both go test and bazel on the assumption // that if and only if trimpath is passed, we are running under bazel. func pkgPath(t ktesting.TB) (string, error) { … }