From 45e8521aefe670fedc58464a63af703a30422b6d Mon Sep 17 00:00:00 2001 From: smail Date: Sun, 18 Oct 2026 11:14:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20=E4=BF=AE=E5=A4=8Dadminreset?= =?UTF-8?q?=E5=8D=95=E6=B5=8B=E9=95=BF=E4=B8=B4=E6=97=B6=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E5=AF=BC=E8=87=B4bind=E5=A4=B1=E8=B4=A5=E5=B9=B6=E9=85=8D?= =?UTF-8?q?=E7=BD=AEGo=E7=BC=93=E5=AD=98=E4=BE=9D=E8=B5=96=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 2 ++ .github/workflows/security.yml | 1 + backend/services/adminreset/reset_test.go | 17 ++++++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) 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