Check for goroutine leaks in SQL tasks

This commit is contained in:
Fedor Korotkiy 2023-04-08 13:08:35 +04:00
parent 9ceb148663
commit bd2c206455
3 changed files with 8 additions and 0 deletions

View file

@ -7,11 +7,13 @@ import (
"testing" "testing"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uber.org/goleak"
"gitlab.com/slon/shad-go/pgfixture" "gitlab.com/slon/shad-go/pgfixture"
) )
func TestDao(t *testing.T) { func TestDao(t *testing.T) {
goleak.VerifyNone(t)
dsn := pgfixture.Start(t) dsn := pgfixture.Start(t)
ctx := context.Background() ctx := context.Background()

View file

@ -9,12 +9,15 @@ import (
"time" "time"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uber.org/goleak"
"gitlab.com/slon/shad-go/ledger" "gitlab.com/slon/shad-go/ledger"
"gitlab.com/slon/shad-go/pgfixture" "gitlab.com/slon/shad-go/pgfixture"
) )
func TestLedger(t *testing.T) { func TestLedger(t *testing.T) {
goleak.VerifyNone(t)
dsn := pgfixture.Start(t) dsn := pgfixture.Start(t)
ctx := context.Background() ctx := context.Background()

View file

@ -6,11 +6,14 @@ import (
"github.com/go-redis/redis/v8" "github.com/go-redis/redis/v8"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uber.org/goleak"
"gitlab.com/slon/shad-go/shopfront" "gitlab.com/slon/shad-go/shopfront"
) )
func TestShopfront(t *testing.T) { func TestShopfront(t *testing.T) {
goleak.VerifyNone(t)
rdb := redis.NewClient(&redis.Options{ rdb := redis.NewClient(&redis.Options{
Addr: StartRedis(t), Addr: StartRedis(t),
}) })