test(plugins): conditionally run goleak checks based on CI environment

Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Deluan 2025-12-30 22:40:47 -05:00
parent dc5100e56a
commit 451475a7af

View File

@ -2,6 +2,7 @@ package scanner_test
import (
"context"
"os"
"testing"
"github.com/navidrome/navidrome/db"
@ -13,13 +14,16 @@ import (
)
func TestScanner(t *testing.T) {
// Detect any goroutine leaks in the scanner code under test
defer goleak.VerifyNone(t,
goleak.IgnoreTopFunction("github.com/onsi/ginkgo/v2/internal/interrupt_handler.(*InterruptHandler).registerForInterrupts.func2"),
// The notify library creates internal goroutines for file watching that persist after Stop() is called.
// These are created by the plugins package tests and are expected behavior.
goleak.IgnoreTopFunction("github.com/rjeczalik/notify.(*recursiveTree).dispatch"),
)
// Only run goleak checks when not in CI environment
if os.Getenv("CI") == "" {
// Detect any goroutine leaks in the scanner code under test
defer goleak.VerifyNone(t,
goleak.IgnoreTopFunction("github.com/onsi/ginkgo/v2/internal/interrupt_handler.(*InterruptHandler).registerForInterrupts.func2"),
// The notify library creates internal goroutines for file watching that persist after Stop() is called.
// These are created by the plugins package tests and are expected behavior.
goleak.IgnoreTopFunction("github.com/rjeczalik/notify.(*recursiveTree).dispatch"),
)
}
tests.Init(t, true)
defer db.Close(context.Background())