From 9ffa74a1ee5e97f77b30282e8a48ef30ab50d70c Mon Sep 17 00:00:00 2001 From: smail Date: Sun, 18 Oct 2026 11:56:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(test):=20=E4=BF=AE=E5=A4=8DLinux=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=B8=AD=E5=A5=97=E6=8E=A5=E5=AD=97=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E8=B6=85=E9=95=BF=E4=B8=8ESSL=E6=B5=8B=E8=AF=95=E5=A4=B9?= =?UTF-8?q?=E5=85=B7=E7=BC=BA=E7=9C=81=E7=9B=AE=E5=BD=95=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/config/ssl_export_test.go | 2 +- backend/hooks/plugin_isolation_linux_test.go | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/backend/config/ssl_export_test.go b/backend/config/ssl_export_test.go index f9cddc0d..f7023014 100644 --- a/backend/config/ssl_export_test.go +++ b/backend/config/ssl_export_test.go @@ -26,7 +26,7 @@ func TestPublishExternalTLSValidatesBeforeReplacingBundle(t *testing.T) { candidate := validRuntimeConfig() candidate.Root.Domains = DomainConfig{Primary: "example.com", Web: "web.example.com", Accepted: []string{"example.com"}} candidate.Root.HTTP = HTTPConfig{Port: 15184, TLSMode: HTTPSTLSModeProxy, TrustedProxyCIDRs: []string{"127.0.0.1/32"}} - candidate.SSL.TLS = SSLConfig{Management: SSLManagementWebServer, Mode: ManagedSSLModeUpload, CustomDirectory: "ssl"} + candidate.SSL.TLS = SSLConfig{Management: SSLManagementWebServer, Mode: ManagedSSLModeUpload, DefaultDirectory: "config/ssl", CustomDirectory: "ssl"} writeRuntimeFixture(t, root, candidate) key, certificate := testManagedCertificate(t, "example.com", time.Now().Add(-time.Hour), time.Now().Add(time.Hour), 2048, "*.example.com") write := func(name string, data []byte) { diff --git a/backend/hooks/plugin_isolation_linux_test.go b/backend/hooks/plugin_isolation_linux_test.go index b47ca871..3d0a1654 100644 --- a/backend/hooks/plugin_isolation_linux_test.go +++ b/backend/hooks/plugin_isolation_linux_test.go @@ -101,9 +101,22 @@ func TestInheritedAbstractSocketRemainsReachableAcrossListenerCopy(t *testing.T) } } +func testPluginEgressSocketDir(t *testing.T) string { + t.Helper() + dir := t.TempDir() + if len(dir)+len("/egress.socket") >= 90 { + shortDir, err := os.MkdirTemp("/tmp", "smail-egress-*") + if err == nil { + t.Cleanup(func() { _ = os.RemoveAll(shortDir) }) + return shortDir + } + } + return dir +} + func TestPluginEgressSocketLifecycle(t *testing.T) { spec := &pluginLaunchSpec{ - runtimeDir: t.TempDir(), + runtimeDir: testPluginEgressSocketDir(t), procAttr: &os.ProcAttr{Env: []string{ "SMAIL_PLUGIN_ID=wechat_push", "SMAIL_PLUGIN_RPC_TOKEN=" + strings.Repeat("b", 64),