[quality] add 19 tests for audit WebhookDestination.Send, SetStore, and stubs#18230
Conversation
… and stubs Cover previously-untested paths: - WebhookDestination.Send: success, empty/nil events, non-2xx, context cancellation - NewWebhookDestination: empty URL validation, nil client default - SetStore/getStore: nil clears store, round-trip - stubDestination: all providers return ErrDestinationUnsupported - RegisterDestination: missing ID, Splunk/Elastic/Syslog stub fallbacks Package coverage: 72.1% → 81.7% (+9.6pp) Signed-off-by: Copilot <copilot@example.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for kubestellarconsole canceled.
|
|
👋 Hey @kubestellar-hive[bot] — thanks for opening this PR!
This is an automated message. |
Cover formatter functions with real data scenarios: - appendFormattedBridgePodIssues: single issue, no-reason/no-issues, truncation - appendFormattedPodIssues: single issue, no-reason/no-issues - appendFormattedBridgeWarningEvents: multiple events - appendFormattedWarningEvents: multiple events, short message preservation - resolveScopedClusters: nil context, empty values, single cluster - buildLiveClusterContext: edge cases with nil providers Key improvements in context.go: - resolveScopedClusters: 83.3% → 100% - appendFormattedBridgePodIssues: 23.1% → 100% Package coverage: 64.7% → 65.9% (+1.2pp) Signed-off-by: Copilot <copilot@example.com>
…gisterWebhookNotifier Cover previously-undertested branches in SendAlertToChannels: - Slack channel: success + incomplete config - PagerDuty channel: incomplete config - OpsGenie channel: incomplete config - Email channel: missing port, invalid port, empty recipients, incomplete host - Webhook channel: invalid URL, empty URL - Multiple channels with mixed success/failure RegisterWebhookNotifier: - Empty URL returns without registering - Invalid URL logs error, does not register - Valid URL registers successfully pkg/notifications coverage: 73.5% → 78.7% (+5.2pp) SendAlertToChannels: 50.9% → 94.3% RegisterWebhookNotifier: 62.5% → 100% Signed-off-by: Copilot <copilot@example.com>
Updated scope — PR now covers 3 packages (49 tests total)Additional commits pushed: pkg/agent/kube — 16 tests (64.7% → 65.9%)
pkg/notifications — 14 tests (73.5% → 78.7%)
Related: #18231 (interface refactoring for remaining kube context gaps) |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
Test Improvement
Adds 19 unit tests covering previously-untested code paths in
pkg/api/audit:WebhookDestination.Send (was 0% → 88.2%)
NewWebhookDestination validation
SetStore / getStore (was 0% → 100%)
stubDestination (all providers → 100%)
RegisterDestination edge cases
Package coverage: 72.1% → 81.7% (+9.6pp)
Filed by quality agent (ACMM L4/L6 — full mode)