From 6ac3ce35119b5dafef680ef2acc93a600f6647fb Mon Sep 17 00:00:00 2001 From: Deluan Date: Mon, 22 Dec 2025 14:12:53 -0500 Subject: [PATCH] test(plugins): ignore goroutine leaks from notify library in tests Signed-off-by: Deluan --- plugins/watcher_integration_test.go | 9 +++++---- scanner/scanner_suite_test.go | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/watcher_integration_test.go b/plugins/watcher_integration_test.go index a5952cd42..15bb102a0 100644 --- a/plugins/watcher_integration_test.go +++ b/plugins/watcher_integration_test.go @@ -88,14 +88,15 @@ var _ = Describe("Watcher Integration", Ordered, func() { _ = manager.Stop() conf.Server.Plugins.AutoReload = true - manager = &Manager{ + autoReloadManager := &Manager{ plugins: make(map[string]*pluginInstance), } - err := manager.Start(ctx) + err := autoReloadManager.Start(ctx) Expect(err).ToNot(HaveOccurred()) + DeferCleanup(autoReloadManager.Stop) - Expect(manager.watcherEvents).ToNot(BeNil()) - Expect(manager.watcherDone).ToNot(BeNil()) + Expect(autoReloadManager.watcherEvents).ToNot(BeNil()) + Expect(autoReloadManager.watcherDone).ToNot(BeNil()) }) }) }) diff --git a/scanner/scanner_suite_test.go b/scanner/scanner_suite_test.go index 8a2c6b260..9b00a428a 100644 --- a/scanner/scanner_suite_test.go +++ b/scanner/scanner_suite_test.go @@ -16,6 +16,9 @@ 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"), ) tests.Init(t, true)