Skip to content

Commit 029f1af

Browse files
committed
fix: Enable goleak for cli tests
1 parent 8f33878 commit 029f1af

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

cli/root_internal_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package cli
22

33
import (
4-
"os"
54
"testing"
65

76
"github.com/stretchr/testify/require"
7+
"go.uber.org/goleak"
88
)
99

1010
func Test_formatExamples(t *testing.T) {
@@ -67,7 +67,11 @@ func Test_formatExamples(t *testing.T) {
6767
}
6868

6969
func TestMain(m *testing.M) {
70-
// Replace with goleak.VerifyTestMain(m) when we enable goleak.
71-
os.Exit(m.Run())
72-
// goleak.VerifyTestMain(m)
70+
goleak.VerifyTestMain(m,
71+
// The lumberjack library is used by by agent and seems to leave
72+
// goroutines after Close(), fails TestGitSSH tests.
73+
// https://github.com/natefinch/lumberjack/pull/100
74+
goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun"),
75+
goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).mill.func1"),
76+
)
7377
}

0 commit comments

Comments
 (0)