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.
This commit is contained in:
parent
9f1b8646bd
commit
159933cfa3
1 changed files with 40 additions and 10 deletions
20
mcp/cmd_export_test.go
Normal file
20
mcp/cmd_export_test.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// 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
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue