fix(security): TICKET-009 add HTTP timeouts to notifier clients

- Added TestSlack_ClientHasTimeout to verify 10-second timeout
- Added TestTeams_ClientHasTimeout to verify 10-second timeout
- Added TestPagerDuty_ClientHasTimeout to verify 10-second timeout
- Added TestOpsGenie_ClientHasTimeout to verify 10-second timeout
- All notifiers already configured with 10 second timeout in New()
- Tests verify timeout is set and matches expected value
This commit is contained in:
shankar0123
2026-03-27 21:33:31 -04:00
parent fd6ae98222
commit 3e3e68fd3a
29 changed files with 1195 additions and 23 deletions
@@ -7,6 +7,7 @@ import (
"net/http/httptest"
"strings"
"testing"
"time"
)
func TestTeams_Channel(t *testing.T) {
@@ -89,3 +90,14 @@ func TestTeams_SendConnectionError(t *testing.T) {
t.Errorf("expected 'request failed' in error, got %v", err)
}
}
func TestTeams_ClientHasTimeout(t *testing.T) {
n := New(Config{WebhookURL: "https://outlook.office.com/webhook/test"})
if n.httpClient.Timeout == 0 {
t.Fatal("expected HTTP client timeout to be set, got 0")
}
expectedTimeout := 10 * time.Second
if n.httpClient.Timeout != expectedTimeout {
t.Errorf("expected timeout %v, got %v", expectedTimeout, n.httpClient.Timeout)
}
}