test: io.Discard logger in fix-3 tests

This commit is contained in:
2026-07-12 10:08:39 +02:00
parent d8f6069b46
commit 6ab8f943af
2 changed files with 7 additions and 5 deletions
+4 -3
View File
@@ -1,6 +1,7 @@
package notify
import (
"io"
"log"
"testing"
)
@@ -8,7 +9,7 @@ import (
// fix-3: app_start_failed fires ONCE per running→down transition. down→down cycles are silent (the
// anti-spam guarantee); down→running clears the tracker so a later re-failure re-notifies.
func TestNotifyAppStartFailures_OneEventPerTransition(t *testing.T) {
n := New("http://hub", "key", "cust", nil, log.New(nil, "", 0), false)
n := New("http://hub", "key", "cust", nil, log.New(io.Discard, "", 0), false)
var events []string
n.pushFn = func(eventType, _, msg string, _ interface{}) {
if eventType == "app_start_failed" {
@@ -42,7 +43,7 @@ func TestNotifyAppStartFailures_OneEventPerTransition(t *testing.T) {
// An app that is down on the FIRST evaluation (the F11 dead-at-boot case, after the boot grace) still
// fires — it is a running→down transition from the tracker's empty initial state.
func TestNotifyAppStartFailures_FirstSeenDownFires(t *testing.T) {
n := New("http://hub", "key", "cust", nil, log.New(nil, "", 0), false)
n := New("http://hub", "key", "cust", nil, log.New(io.Discard, "", 0), false)
var count int
n.pushFn = func(eventType, _, _ string, _ interface{}) {
if eventType == "app_start_failed" {
@@ -57,7 +58,7 @@ func TestNotifyAppStartFailures_FirstSeenDownFires(t *testing.T) {
// A deployed app that is up never fires.
func TestNotifyAppStartFailures_HealthyNeverFires(t *testing.T) {
n := New("http://hub", "key", "cust", nil, log.New(nil, "", 0), false)
n := New("http://hub", "key", "cust", nil, log.New(io.Discard, "", 0), false)
var count int
n.pushFn = func(string, string, string, interface{}) { count++ }
n.NotifyAppStartFailures([]AppRunState{{Name: "radarr", Down: false}})