fix(ci): 修复adminreset单测长临时路径导致bind失败并配置Go缓存依赖路径
Security Checks / security (push) Waiting to run

This commit is contained in:
xuans committed 2026-10-18 11:14:55 +08:00
1 parent ab6828941b
commit 45e8521aef
3 files changed
+19 -1

No files matched your search

+16 -1
View File
@@ -2,6 +2,7 @@ package adminreset
import (
"context"
"os"
"path/filepath"
"testing"
"time"
@@ -152,10 +153,24 @@ func TestResetSuperAdminRejectsMissingTarget(t *testing.T) {
}
}
func testResetControlSocketDir(t *testing.T) string {
t.Helper()
dir := t.TempDir()
if len(dir)+len("/control.sock") >= 90 {
shortDir, err := os.MkdirTemp("/tmp", "smail-*")
if err == nil {
t.Cleanup(func() { _ = os.RemoveAll(shortDir) })
return shortDir
}
}
return dir
}
func TestControlServerInterfaceCompiles(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
cancel()
if _, err := ListenControl(filepath.Join(t.TempDir(), "control.sock"), []uint32{0}); err == nil {
socketPath := filepath.Join(testResetControlSocketDir(t), "control.sock")
if _, err := ListenControl(socketPath, []uint32{0}); err == nil {
// 具体平台实现由各自适配器测试覆盖。
}
_ = ctx