mirror of
https://github.com/shankar0123/certctl.git
synced 2026-06-14 22:18:59 +00:00
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:
@@ -7,6 +7,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestPagerDuty_Channel(t *testing.T) {
|
||||
@@ -130,6 +131,17 @@ func TestPagerDuty_SendConnectionError(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPagerDuty_ClientHasTimeout(t *testing.T) {
|
||||
n := New(Config{RoutingKey: "test-key"})
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
// urlRewriteTransport redirects all requests to a test server URL.
|
||||
type urlRewriteTransport struct {
|
||||
target string
|
||||
|
||||
Reference in New Issue
Block a user