Skip to content

Commit

Permalink
add leak
Browse files Browse the repository at this point in the history
Signed-off-by: husharp <[email protected]>
  • Loading branch information
HuSharp committed Jan 31, 2024
1 parent 5d37687 commit 3a82030
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/tidb/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"net/http/httptest"
"net/url"
"strconv"
"sync"
"testing"
"time"

Expand All @@ -37,7 +38,9 @@ func TestProxy(t *testing.T) {
}
p := newProxy(l, map[string]string{"test": fmt.Sprintf("%s:%s", u.Hostname(), u.Port())}, 0, 0)
ctx, cancel := context.WithCancel(context.Background())
go p.run(ctx)
wg := &sync.WaitGroup{}
wg.Add(1)
go p.run(ctx, wg)
defer cancel()

u.Host = l.Addr().String()
Expand Down Expand Up @@ -86,7 +89,9 @@ func TestProxyPick(t *testing.T) {
}
p := newProxy(l, endpoints, 0, 0)
ctx, cancel := context.WithCancel(context.Background())
go p.run(ctx)
wg := &sync.WaitGroup{}
wg.Add(1)
go p.run(ctx, wg)
defer cancel()

for i := 0; i < n; i++ {
Expand Down

0 comments on commit 3a82030

Please sign in to comment.