chore: 初始化仓库,导入项目基线代码
Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、 Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。 今日开发的培训推送管理改动随后单独提交。
This commit is contained in:
commit
7ec21f35b0
5767 files changed
+1436788
No files matched your search
@@ -0,0 +1,32 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// TestOutboundDialTimeoutDefault verifies the package default is 5s.
|
||||
// Keep these tests serial: they read and mutate the same process-wide timeout.
|
||||
func TestOutboundDialTimeoutDefault(t *testing.T) {
|
||||
if got := OutboundDialTimeout(); got != 5*time.Second {
|
||||
t.Fatalf("default dial timeout = %v, want %v", got, 5*time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
// TestSetOutboundDialTimeout verifies the setter is reflected by the getter and
|
||||
// that non-positive values are ignored.
|
||||
func TestSetOutboundDialTimeout(t *testing.T) {
|
||||
original := OutboundDialTimeout()
|
||||
t.Cleanup(func() { SetOutboundDialTimeout(original) })
|
||||
|
||||
SetOutboundDialTimeout(2 * time.Second)
|
||||
if got := OutboundDialTimeout(); got != 2*time.Second {
|
||||
t.Fatalf("after set 2s: got %v, want %v", got, 2*time.Second)
|
||||
}
|
||||
|
||||
// Non-positive must be ignored, leaving the previous value intact.
|
||||
SetOutboundDialTimeout(0)
|
||||
if got := OutboundDialTimeout(); got != 2*time.Second {
|
||||
t.Fatalf("after set 0: got %v, want %v (value should be unchanged)", got, 2*time.Second)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user