Skip to content

Commit 6ee2c63

Browse files
committed
testserver: allow caller to set up ktesting
In scheduler_perf, the caller configures ktesting without per-test output. When StartTestServer initialized it again, it did so with per-test output. In other cases it might have been simply redundant.
1 parent b1559c6 commit 6ee2c63

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmd/kube-apiserver/app/testing/testserver.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,11 @@ func NewDefaultTestServerOptions() *TestServerInstanceOptions {
150150
// files that because Golang testing's call to os.Exit will not give a stop channel go routine
151151
// enough time to remove temporary files.
152152
func StartTestServer(t ktesting.TB, instanceOptions *TestServerInstanceOptions, customFlags []string, storageConfig *storagebackend.Config) (result TestServer, err error) {
153-
tCtx := ktesting.Init(t)
153+
// Some callers may have initialize ktesting already.
154+
tCtx, ok := t.(ktesting.TContext)
155+
if !ok {
156+
tCtx = ktesting.Init(t)
157+
}
154158

155159
if instanceOptions == nil {
156160
instanceOptions = NewDefaultTestServerOptions()

0 commit comments

Comments
 (0)