mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-18 18:16:26 +00:00
Add goleak in unit tests
This commit is contained in:
@ -8,9 +8,13 @@ import (
|
||||
"npm/internal/logger"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/goleak"
|
||||
)
|
||||
|
||||
func TestInit(t *testing.T) {
|
||||
// goleak is used to detect goroutine leaks
|
||||
defer goleak.VerifyNone(t, goleak.IgnoreAnyFunction("database/sql.(*DB).connectionOpener"))
|
||||
|
||||
t.Setenv("NPM_DATA_FOLDER", "/path/to/some/data/folder")
|
||||
t.Setenv("NPM_LOG_LEVEL", "warn")
|
||||
t.Setenv("NPM_DB_DRIVER", "postgres")
|
||||
@ -45,6 +49,9 @@ func TestInit(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConnectURLs(t *testing.T) {
|
||||
// goleak is used to detect goroutine leaks
|
||||
defer goleak.VerifyNone(t, goleak.IgnoreAnyFunction("database/sql.(*DB).connectionOpener"))
|
||||
|
||||
type want struct {
|
||||
gorm string
|
||||
dbmate string
|
||||
@ -118,6 +125,9 @@ func TestConnectURLs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateDataFolders(t *testing.T) {
|
||||
// goleak is used to detect goroutine leaks
|
||||
defer goleak.VerifyNone(t, goleak.IgnoreAnyFunction("database/sql.(*DB).connectionOpener"))
|
||||
|
||||
t.Setenv("NPM_DATA_FOLDER", "/tmp/npmtest")
|
||||
|
||||
version := "777.777.777"
|
||||
|
@ -2,8 +2,9 @@ package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"npm/internal/logger"
|
||||
"os"
|
||||
|
||||
"npm/internal/logger"
|
||||
)
|
||||
|
||||
// CreateDataFolders will recursively create these folders within the
|
||||
|
@ -4,9 +4,13 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/goleak"
|
||||
)
|
||||
|
||||
func TestAcmeshGetWellknown(t *testing.T) {
|
||||
// goleak is used to detect goroutine leaks
|
||||
defer goleak.VerifyNone(t, goleak.IgnoreAnyFunction("database/sql.(*DB).connectionOpener"))
|
||||
|
||||
a := acmesh{
|
||||
Home: "/data/.acme.sh",
|
||||
}
|
||||
|
Reference in New Issue
Block a user