Skip to content

Commit fc6dedc

Browse files
committed
fixed tests
1 parent 4b36593 commit fc6dedc

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tests/proxy_test.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ func TestProxyHandle_RequestDeadlineExceeded_GRPC(t *testing.T) {
245245

246246
func() {
247247
// Ensure that tunnels aren't leaked with long-running servers.
248-
defer goleak.VerifyNone(t, goleak.IgnoreCurrent())
248+
defer goleak.VerifyNone(t, goleak.IgnoreCurrent(), goleak.IgnoreTopFunction("google.golang.org/grpc.(*addrConn).resetTransport"))
249249

250250
// run test client
251251
tunnel, err := client.CreateSingleUseGrpcTunnel(context.Background(), ps.FrontAddr(), grpc.WithInsecure())
@@ -303,7 +303,7 @@ func TestProxyDial_RequestCancelled_GRPC(t *testing.T) {
303303

304304
func() {
305305
// Ensure that tunnels aren't leaked with long-running servers.
306-
defer goleak.VerifyNone(t, goleak.IgnoreCurrent())
306+
defer goleak.VerifyNone(t, goleak.IgnoreCurrent(), goleak.IgnoreTopFunction("google.golang.org/grpc.(*addrConn).resetTransport"))
307307

308308
// run test client
309309
tunnel, err := client.CreateSingleUseGrpcTunnel(context.Background(), ps.FrontAddr(), grpc.WithInsecure())
@@ -393,7 +393,10 @@ func TestProxyDial_RequestCancelled_Concurrent_GRPC(t *testing.T) {
393393
}
394394

395395
// Ensure that tunnels aren't leaked with long-running servers.
396-
ignoredGoRoutines := goleak.IgnoreCurrent()
396+
ignoredGoRoutines := []goleak.Option{
397+
goleak.IgnoreCurrent(),
398+
goleak.IgnoreTopFunction("google.golang.org/grpc.(*addrConn).resetTransport"),
399+
}
397400

398401
const concurrentConns = 50
399402
wg.Add(concurrentConns)
@@ -407,7 +410,7 @@ func TestProxyDial_RequestCancelled_Concurrent_GRPC(t *testing.T) {
407410
var endpointConnsErr, goLeaksErr error
408411
wait.PollImmediate(time.Second, wait.ForeverTestTimeout, func() (done bool, err error) {
409412
endpointConnsErr = metricstest.ExpectAgentEndpointConnections(0)
410-
goLeaksErr = goleak.Find(ignoredGoRoutines)
413+
goLeaksErr = goleak.Find(ignoredGoRoutines...)
411414
return endpointConnsErr == nil && goLeaksErr == nil, nil
412415
})
413416

@@ -433,7 +436,7 @@ func TestProxyDial_AgentTimeout_GRPC(t *testing.T) {
433436

434437
func() {
435438
// Ensure that tunnels aren't leaked with long-running servers.
436-
defer goleak.VerifyNone(t, goleak.IgnoreCurrent())
439+
defer goleak.VerifyNone(t, goleak.IgnoreCurrent(), goleak.IgnoreTopFunction("google.golang.org/grpc.(*addrConn).resetTransport"))
437440

438441
// run test client
439442
tunnel, err := client.CreateSingleUseGrpcTunnel(context.Background(), ps.FrontAddr(), grpc.WithInsecure())
@@ -929,7 +932,7 @@ func expectCleanShutdown(t testing.TB) {
929932
resetAllMetrics()
930933
currentGoRoutines := goleak.IgnoreCurrent()
931934
t.Cleanup(func() {
932-
goleak.VerifyNone(t, currentGoRoutines)
935+
goleak.VerifyNone(t, currentGoRoutines, goleak.IgnoreTopFunction("google.golang.org/grpc.(*addrConn).resetTransport"))
933936
assertNoClientDialFailures(t)
934937
assertNoServerDialFailures(t)
935938
assertNoAgentDialFailures(t)

0 commit comments

Comments
 (0)