Notify package has only 11.1% test coverage #71
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The
internal/notifypackage has 11.1% test coverage. Only the URL validation functions (ValidateWebhookURL,IsAllowedScheme) are tested. The actual notification delivery logic is untested.What is Untested
sendNtfy()— ntfy notification delivery, header formatting, priority mappingsendSlack()— Slack/Mattermost webhook payload construction, JSON marshaling, color mappingSendNotification()— goroutine dispatch to all configured endpointsnewRequest()— HTTP request construction from pre-validated URLntfyPriority,slackColor)Why This Matters
Notifications are the primary output of dnswatcher. If notifications are malformed, lost, or sent to wrong endpoints, the daemon provides no value. The notification code is also where goroutines are spawned without tracking (fire-and-forget), making it especially important to verify correctness.
Recommendation
Add tests using
httptest.Serveror a mockhttp.RoundTripperto verify:The existing
transportfield on Service already supports dependency injection for testing.Category
Should-fix before 1.0.
Closing: completed by PR #79 (merged).