go-sdk/mcp/cmd_export_test.go
Rob Findley 159933cfa3 mcp: speed up TestCommandTransportDuration
At 7s, this test was 70% of our test execution time on my computer.
Speed it up by mutating the defaultTerminateDuration for the purposes of
the test.

Also update our test workflow to use go1.25, now that it's out.
2025-09-12 12:00:29 -04:00

20 lines
619 B
Go

// Copyright 2025 The Go MCP SDK Authors. All rights reserved.
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
package mcp
import "time"
// This file exports some helpers for mutating internals of the command
// transport for testing.
// SetDefaultTerminateDuration sets the default command terminate duration,
// and returns a function to reset it to the default.
func SetDefaultTerminateDuration(d time.Duration) (reset func()) {
initial := defaultTerminateDuration
defaultTerminateDuration = d
return func() {
defaultTerminateDuration = initial
}
}