diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6f50b84c..76da960c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,6 +38,7 @@ jobs: uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff with: go-version: '1.26.6' + cache-dependency-path: backend/go.sum - name: Gen output name run: | archive_extension="tar.gz" @@ -92,6 +93,7 @@ jobs: uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff with: go-version: '1.26.6' + cache-dependency-path: backend/go.sum - name: Setup Node.js for test runner uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 with: diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index e57d2fa4..3456e91b 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -25,6 +25,7 @@ jobs: uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff with: go-version: '1.26.6' + cache-dependency-path: backend/go.sum - name: Setup Node.js for test runner uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 with: diff --git a/backend/services/adminreset/reset_test.go b/backend/services/adminreset/reset_test.go index 889cea26..3cf29d61 100644 --- a/backend/services/adminreset/reset_test.go +++ b/backend/services/adminreset/reset_test.go @@ -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