@@ -184,6 +184,24 @@ func TestInjectFeishuSecretsFromEnvLoadsSDKSecret(t *testing.T) {
184184 }
185185}
186186
187+ func TestInjectFeishuSecretsFromEnvHandlesNilAndWebhookSkipVerify (t * testing.T ) {
188+ if err := injectFeishuSecretsFromEnv (nil ); err == nil || err .Error () != "feishu options are required" {
189+ t .Fatalf ("unexpected nil options error: %v" , err )
190+ }
191+
192+ t .Setenv (config .FeishuAppSecretEnvVar , "app-secret" )
193+ options := mergedFeishuOptions {
194+ Ingress : config .FeishuIngressWebhook ,
195+ InsecureSkipSignVerify : true ,
196+ }
197+ if err := injectFeishuSecretsFromEnv (& options ); err != nil {
198+ t .Fatalf ("inject webhook secret with skip verify: %v" , err )
199+ }
200+ if options .SigningSecret != "" {
201+ t .Fatalf ("expected signing secret to stay empty when skip verify is enabled, got %q" , options .SigningSecret )
202+ }
203+ }
204+
187205type stubFeishuGatewayClient struct {
188206 closed bool
189207}
@@ -375,3 +393,14 @@ func TestDefaultFeishuAdapterCommandRunnerPropagatesLoadAndValidateError(t *test
375393 t .Fatal ("expected validation error from config" )
376394 }
377395}
396+
397+ func TestDefaultFeishuAdapterCommandRunnerPropagatesMissingSecretEnv (t * testing.T ) {
398+ writeFeishuAdapterConfig (t )
399+ t .Setenv (config .FeishuAppSecretEnvVar , "" )
400+ t .Setenv (config .FeishuSigningSecretEnvVar , "" )
401+
402+ err := defaultFeishuAdapterCommandRunner (context .Background (), feishuAdapterCommandOptions {})
403+ if err == nil || err .Error () != "config: feishu: " + config .FeishuAppSecretEnvVar + " is required when feishu.enabled=true" {
404+ t .Fatalf ("runner error = %v, want config validation error" , err )
405+ }
406+ }
0 commit comments