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.
This commit is contained in:
Patrick Ohly 2024-08-23 14:20:17 +02:00
parent b1559c66ca
commit 6ee2c63135

View File

@ -150,7 +150,11 @@ func NewDefaultTestServerOptions() *TestServerInstanceOptions {
// 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 StartTestServer(t ktesting.TB, instanceOptions *TestServerInstanceOptions, customFlags []string, storageConfig *storagebackend.Config) (result TestServer, err error) {
tCtx := ktesting.Init(t)
// Some callers may have initialize ktesting already.
tCtx, ok := t.(ktesting.TContext)
if !ok {
tCtx = ktesting.Init(t)
}
if instanceOptions == nil {
instanceOptions = NewDefaultTestServerOptions()