fix(test): 修复Linux测试中套接字路径超长与SSL测试夹具缺省目录问题
Some checks are pending
Security Checks / security (push) Waiting to run
Some checks are pending
Security Checks / security (push) Waiting to run
This commit is contained in:
parent
ca08094bce
commit
9ffa74a1ee
@ -26,7 +26,7 @@ func TestPublishExternalTLSValidatesBeforeReplacingBundle(t *testing.T) {
|
|||||||
candidate := validRuntimeConfig()
|
candidate := validRuntimeConfig()
|
||||||
candidate.Root.Domains = DomainConfig{Primary: "example.com", Web: "web.example.com", Accepted: []string{"example.com"}}
|
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.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)
|
writeRuntimeFixture(t, root, candidate)
|
||||||
key, certificate := testManagedCertificate(t, "example.com", time.Now().Add(-time.Hour), time.Now().Add(time.Hour), 2048, "*.example.com")
|
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) {
|
write := func(name string, data []byte) {
|
||||||
|
|||||||
@ -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) {
|
func TestPluginEgressSocketLifecycle(t *testing.T) {
|
||||||
spec := &pluginLaunchSpec{
|
spec := &pluginLaunchSpec{
|
||||||
runtimeDir: t.TempDir(),
|
runtimeDir: testPluginEgressSocketDir(t),
|
||||||
procAttr: &os.ProcAttr{Env: []string{
|
procAttr: &os.ProcAttr{Env: []string{
|
||||||
"SMAIL_PLUGIN_ID=wechat_push",
|
"SMAIL_PLUGIN_ID=wechat_push",
|
||||||
"SMAIL_PLUGIN_RPC_TOKEN=" + strings.Repeat("b", 64),
|
"SMAIL_PLUGIN_RPC_TOKEN=" + strings.Repeat("b", 64),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user