- Add goroutine leak detector to help avoid Goroutine leaks by Uber: https://github.com/uber-go/goleak - By using this package, I found an issue in frecency: - Close global DB connection to fix goroutine leak in tests (https://github.com/versenilvis/IRIS/commit/831f86ffdf01124da537c149559fa41f37500e1e)
22 lines
356 B
Go
22 lines
356 B
Go
package root
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"go.uber.org/goleak"
|
|
"github.com/versenilvis/iris/internal/scoring"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
code := m.Run()
|
|
scoring.CloseGlobalFrecencyStore()
|
|
if code == 0 {
|
|
if err := goleak.Find(); err != nil {
|
|
_, _ = os.Stderr.WriteString("goleak: " + err.Error() + "\n")
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
os.Exit(code)
|
|
}
|