channelz: wait for clean up before next test (#2797)

This commit is contained in:
lyuxuan 2019-05-02 14:47:50 -07:00 committed by GitHub
parent a9408321c7
commit 42baa8b199
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 143 additions and 45 deletions

View File

@ -125,7 +125,8 @@ func protoToSocketOption(skopts []*channelzpb.SocketOption) *channelz.SocketOpti
}
func TestGetSocketOptions(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer cleanupWrapper(czCleanup, t)
ss := []*dummySocket{
{
socketOptions: &channelz.SocketOptionData{
@ -139,8 +140,10 @@ func TestGetSocketOptions(t *testing.T) {
svr := newCZServer()
ids := make([]int64, len(ss))
svrID := channelz.RegisterServer(&dummyServer{}, "")
defer channelz.RemoveEntry(svrID)
for i, s := range ss {
ids[i] = channelz.RegisterNormalSocket(s, svrID, strconv.Itoa(i))
defer channelz.RemoveEntry(ids[i])
}
for i, s := range ss {
resp, _ := svr.GetSocket(context.Background(), &channelzpb.GetSocketRequest{SocketId: ids[i]})

View File

@ -39,6 +39,12 @@ func init() {
channelz.TurnOn()
}
func cleanupWrapper(cleanup func() error, t *testing.T) {
if err := cleanup(); err != nil {
t.Error(err)
}
}
type protoToSocketOptFunc func([]*channelzpb.SocketOption) *channelz.SocketOptionData
// protoToSocketOpt is used in function socketProtoToStruct to extract socket option
@ -305,9 +311,11 @@ func TestGetTopChannels(t *testing.T) {
},
{},
}
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer cleanupWrapper(czCleanup, t)
for _, c := range tcs {
channelz.RegisterChannel(c, 0, "")
id := channelz.RegisterChannel(c, 0, "")
defer channelz.RemoveEntry(id)
}
s := newCZServer()
resp, _ := s.GetTopChannels(context.Background(), &channelzpb.GetTopChannelsRequest{StartChannelId: 0})
@ -320,7 +328,8 @@ func TestGetTopChannels(t *testing.T) {
}
}
for i := 0; i < 50; i++ {
channelz.RegisterChannel(tcs[0], 0, "")
id := channelz.RegisterChannel(tcs[0], 0, "")
defer channelz.RemoveEntry(id)
}
resp, _ = s.GetTopChannels(context.Background(), &channelzpb.GetTopChannelsRequest{StartChannelId: 0})
if resp.GetEnd() {
@ -349,9 +358,11 @@ func TestGetServers(t *testing.T) {
lastCallStartedTimestamp: time.Now().UTC(),
},
}
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer cleanupWrapper(czCleanup, t)
for _, s := range ss {
channelz.RegisterServer(s, "")
id := channelz.RegisterServer(s, "")
defer channelz.RemoveEntry(id)
}
svr := newCZServer()
resp, _ := svr.GetServers(context.Background(), &channelzpb.GetServersRequest{StartServerId: 0})
@ -364,7 +375,8 @@ func TestGetServers(t *testing.T) {
}
}
for i := 0; i < 50; i++ {
channelz.RegisterServer(ss[0], "")
id := channelz.RegisterServer(ss[0], "")
defer channelz.RemoveEntry(id)
}
resp, _ = svr.GetServers(context.Background(), &channelzpb.GetServersRequest{StartServerId: 0})
if resp.GetEnd() {
@ -373,13 +385,18 @@ func TestGetServers(t *testing.T) {
}
func TestGetServerSockets(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer cleanupWrapper(czCleanup, t)
svrID := channelz.RegisterServer(&dummyServer{}, "")
defer channelz.RemoveEntry(svrID)
refNames := []string{"listen socket 1", "normal socket 1", "normal socket 2"}
ids := make([]int64, 3)
ids[0] = channelz.RegisterListenSocket(&dummySocket{}, svrID, refNames[0])
ids[1] = channelz.RegisterNormalSocket(&dummySocket{}, svrID, refNames[1])
ids[2] = channelz.RegisterNormalSocket(&dummySocket{}, svrID, refNames[2])
for _, id := range ids {
defer channelz.RemoveEntry(id)
}
svr := newCZServer()
resp, _ := svr.GetServerSockets(context.Background(), &channelzpb.GetServerSocketsRequest{ServerId: svrID, StartSocketId: 0})
if !resp.GetEnd() {
@ -395,7 +412,8 @@ func TestGetServerSockets(t *testing.T) {
}
for i := 0; i < 50; i++ {
channelz.RegisterNormalSocket(&dummySocket{}, svrID, "")
id := channelz.RegisterNormalSocket(&dummySocket{}, svrID, "")
defer channelz.RemoveEntry(id)
}
resp, _ = svr.GetServerSockets(context.Background(), &channelzpb.GetServerSocketsRequest{ServerId: svrID, StartSocketId: 0})
if resp.GetEnd() {
@ -406,13 +424,18 @@ func TestGetServerSockets(t *testing.T) {
// This test makes a GetServerSockets with a non-zero start ID, and expect only
// sockets with ID >= the given start ID.
func TestGetServerSocketsNonZeroStartID(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer cleanupWrapper(czCleanup, t)
svrID := channelz.RegisterServer(&dummyServer{}, "")
defer channelz.RemoveEntry(svrID)
refNames := []string{"listen socket 1", "normal socket 1", "normal socket 2"}
ids := make([]int64, 3)
ids[0] = channelz.RegisterListenSocket(&dummySocket{}, svrID, refNames[0])
ids[1] = channelz.RegisterNormalSocket(&dummySocket{}, svrID, refNames[1])
ids[2] = channelz.RegisterNormalSocket(&dummySocket{}, svrID, refNames[2])
for _, id := range ids {
defer channelz.RemoveEntry(id)
}
svr := newCZServer()
// Make GetServerSockets with startID = ids[1]+1, so socket-1 won't be
// included in the response.
@ -431,7 +454,8 @@ func TestGetServerSocketsNonZeroStartID(t *testing.T) {
}
func TestGetChannel(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer cleanupWrapper(czCleanup, t)
refNames := []string{"top channel 1", "nested channel 1", "sub channel 2", "nested channel 3"}
ids := make([]int64, 4)
ids[0] = channelz.RegisterChannel(&dummyChannel{}, 0, refNames[0])
@ -475,6 +499,9 @@ func TestGetChannel(t *testing.T) {
Desc: "Resolver returns an empty address list",
Severity: channelz.CtWarning,
})
for _, id := range ids {
defer channelz.RemoveEntry(id)
}
svr := newCZServer()
resp, _ := svr.GetChannel(context.Background(), &channelzpb.GetChannelRequest{ChannelId: ids[0]})
metrics := resp.GetChannel()
@ -530,7 +557,8 @@ func TestGetSubChannel(t *testing.T) {
subchanConnectivityChange = fmt.Sprintf("Subchannel Connectivity change to %v", connectivity.Ready)
subChanPickNewAddress = fmt.Sprintf("Subchannel picks a new address %q to connect", "0.0.0.0")
)
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer cleanupWrapper(czCleanup, t)
refNames := []string{"top channel 1", "sub channel 1", "socket 1", "socket 2"}
ids := make([]int64, 4)
ids[0] = channelz.RegisterChannel(&dummyChannel{}, 0, refNames[0])
@ -557,6 +585,9 @@ func TestGetSubChannel(t *testing.T) {
Desc: subChanPickNewAddress,
Severity: channelz.CtINFO,
})
for _, id := range ids {
defer channelz.RemoveEntry(id)
}
svr := newCZServer()
resp, _ := svr.GetSubchannel(context.Background(), &channelzpb.GetSubchannelRequest{SubchannelId: ids[1]})
metrics := resp.GetSubchannel()
@ -598,7 +629,8 @@ func TestGetSubChannel(t *testing.T) {
}
func TestGetSocket(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer cleanupWrapper(czCleanup, t)
ss := []*dummySocket{
{
streamsStarted: 10,
@ -673,8 +705,10 @@ func TestGetSocket(t *testing.T) {
svr := newCZServer()
ids := make([]int64, len(ss))
svrID := channelz.RegisterServer(&dummyServer{}, "")
defer channelz.RemoveEntry(svrID)
for i, s := range ss {
ids[i] = channelz.RegisterNormalSocket(s, svrID, strconv.Itoa(i))
defer channelz.RemoveEntry(ids[i])
}
for i, s := range ss {
resp, _ := svr.GetSocket(context.Background(), &channelzpb.GetSocketRequest{SocketId: ids[i]})

View File

@ -24,6 +24,7 @@
package channelz
import (
"fmt"
"sort"
"sync"
"sync/atomic"
@ -95,9 +96,14 @@ func (d *dbWrapper) get() *channelMap {
// NewChannelzStorage initializes channelz data storage and id generator.
//
// This function returns a cleanup function to wait for all channelz state to be reset by the
// grpc goroutines when those entities get closed. By using this cleanup function, we make sure tests
// don't mess up each other, i.e. lingering goroutine from previous test doing entity removal happen
// to remove some entity just register by the new test, since the id space is the same.
//
// Note: This function is exported for testing purpose only. User should not call
// it in most cases.
func NewChannelzStorage() {
func NewChannelzStorage() (cleanup func() error) {
db.set(&channelMap{
topLevelChannels: make(map[int64]struct{}),
channels: make(map[int64]*channel),
@ -107,6 +113,28 @@ func NewChannelzStorage() {
subChannels: make(map[int64]*subChannel),
})
idGen.reset()
return func() error {
var err error
cm := db.get()
if cm == nil {
return nil
}
for i := 0; i < 1000; i++ {
cm.mu.Lock()
if len(cm.topLevelChannels) == 0 && len(cm.servers) == 0 && len(cm.channels) == 0 && len(cm.subChannels) == 0 && len(cm.listenSockets) == 0 && len(cm.normalSockets) == 0 {
cm.mu.Unlock()
// all things stored in the channelz map have been cleared.
return nil
}
cm.mu.Unlock()
time.Sleep(10 * time.Millisecond)
}
cm.mu.Lock()
err = fmt.Errorf("after 10s the channelz map has not been cleaned up yet, topchannels: %d, servers: %d, channels: %d, subchannels: %d, listen sockets: %d, normal sockets: %d", len(cm.topLevelChannels), len(cm.servers), len(cm.channels), len(cm.subChannels), len(cm.listenSockets), len(cm.normalSockets))
cm.mu.Unlock()
return err
}
}
// GetTopChannels returns a slice of top channel's ChannelMetric, along with a

View File

@ -40,7 +40,8 @@ func (s) TestCZSocketMetricsSocketOption(t *testing.T) {
}
func testCZSocketMetricsSocketOption(t *testing.T, e env) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
te := newTest(t, e)
te.startServer(&testServer{security: e.security})
defer te.tearDown()

View File

@ -46,6 +46,12 @@ import (
"google.golang.org/grpc/testdata"
)
func czCleanupWrapper(cleanup func() error, t *testing.T) {
if err := cleanup(); err != nil {
t.Error(err)
}
}
func (te *test) startServers(ts testpb.TestServiceServer, num int) {
for i := 0; i < num; i++ {
te.startServer(ts)
@ -85,7 +91,8 @@ func (s) TestCZServerRegistrationAndDeletion(t *testing.T) {
}
for _, c := range testcases {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
te := newTest(t, e)
te.startServers(&testServer{security: e.security}, c.total)
@ -103,7 +110,8 @@ func (s) TestCZServerRegistrationAndDeletion(t *testing.T) {
}
func (s) TestCZGetServer(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
te := newTest(t, e)
te.startServer(&testServer{security: e.security})
@ -154,7 +162,8 @@ func (s) TestCZTopChannelRegistrationAndDeletion(t *testing.T) {
}
for _, c := range testcases {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
te := newTest(t, e)
var ccs []*grpc.ClientConn
@ -191,7 +200,8 @@ func (s) TestCZTopChannelRegistrationAndDeletion(t *testing.T) {
}
func (s) TestCZTopChannelRegistrationAndDeletionWhenDialFail(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
// Make dial fails (due to no transport security specified)
_, err := grpc.Dial("fake.addr")
if err == nil {
@ -203,7 +213,8 @@ func (s) TestCZTopChannelRegistrationAndDeletionWhenDialFail(t *testing.T) {
}
func (s) TestCZNestedChannelRegistrationAndDeletion(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
// avoid calling API to set balancer type, which will void service config's change of balancer.
e.balancer = ""
@ -247,7 +258,8 @@ func (s) TestCZNestedChannelRegistrationAndDeletion(t *testing.T) {
}
func (s) TestCZClientSubChannelSocketRegistrationAndDeletion(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
num := 3 // number of backends
te := newTest(t, e)
@ -335,11 +347,11 @@ func (s) TestCZServerSocketRegistrationAndDeletion(t *testing.T) {
}
for _, c := range testcases {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
te := newTest(t, e)
te.startServer(&testServer{security: e.security})
defer te.tearDown()
var ccs []*grpc.ClientConn
for i := 0; i < c.total; i++ {
cc := te.clientConn()
@ -390,11 +402,13 @@ func (s) TestCZServerSocketRegistrationAndDeletion(t *testing.T) {
}); err != nil {
t.Fatal(err)
}
te.tearDown()
}
}
func (s) TestCZServerListenSocketDeletion(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
s := grpc.NewServer()
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
@ -450,7 +464,8 @@ func (s) TestCZRecusivelyDeletionOfEntry(t *testing.T) {
// | |
// v v
// Socket1 Socket2
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
topChanID := channelz.RegisterChannel(&dummyChannel{}, 0, "")
subChanID1 := channelz.RegisterSubChannel(&dummyChannel{}, topChanID, "")
subChanID2 := channelz.RegisterSubChannel(&dummyChannel{}, topChanID, "")
@ -494,7 +509,8 @@ func (s) TestCZRecusivelyDeletionOfEntry(t *testing.T) {
}
func (s) TestCZChannelMetrics(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
num := 3 // number of backends
te := newTest(t, e)
@ -582,7 +598,8 @@ func (s) TestCZChannelMetrics(t *testing.T) {
}
func (s) TestCZServerMetrics(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
te := newTest(t, e)
te.maxServerReceiveMsgSize = newInt(8)
@ -866,7 +883,8 @@ func doIdleCallToInvokeKeepAlive(tc testpb.TestServiceClient, t *testing.T) {
}
func (s) TestCZClientSocketMetricsStreamsAndMessagesCount(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
te := newTest(t, e)
te.maxServerReceiveMsgSize = newInt(20)
@ -965,7 +983,8 @@ func (s) TestCZClientSocketMetricsStreamsAndMessagesCount(t *testing.T) {
// It is separated from other cases due to setup incompatibly, i.e. max receive
// size violation will mask flow control violation.
func (s) TestCZClientAndServerSocketMetricsStreamsCountFlowControlRSTStream(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
te := newTest(t, e)
te.serverInitialWindowSize = 65536
@ -1025,7 +1044,8 @@ func (s) TestCZClientAndServerSocketMetricsStreamsCountFlowControlRSTStream(t *t
}
func (s) TestCZClientAndServerSocketMetricsFlowControl(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
te := newTest(t, e)
// disable BDP
@ -1137,7 +1157,8 @@ func (s) TestCZClientAndServerSocketMetricsFlowControl(t *testing.T) {
}
func (s) TestCZClientSocketMetricsKeepAlive(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
defer func(t time.Duration) { internal.KeepaliveMinPingTime = t }(internal.KeepaliveMinPingTime)
internal.KeepaliveMinPingTime = time.Second
e := tcpClearRREnv
@ -1189,7 +1210,8 @@ func (s) TestCZClientSocketMetricsKeepAlive(t *testing.T) {
}
func (s) TestCZServerSocketMetricsStreamsAndMessagesCount(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
te := newTest(t, e)
te.maxServerReceiveMsgSize = newInt(20)
@ -1249,7 +1271,8 @@ func (s) TestCZServerSocketMetricsStreamsAndMessagesCount(t *testing.T) {
}
func (s) TestCZServerSocketMetricsKeepAlive(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
te := newTest(t, e)
te.customServerOptions = append(te.customServerOptions, grpc.KeepaliveParams(keepalive.ServerParameters{Time: time.Second, Timeout: 500 * time.Millisecond}))
@ -1307,7 +1330,8 @@ var cipherSuites = []string{
}
func (s) TestCZSocketGetSecurityValueTLS(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpTLSRREnv
te := newTest(t, e)
te.startServer(&testServer{security: e.security})
@ -1356,7 +1380,8 @@ func (s) TestCZSocketGetSecurityValueTLS(t *testing.T) {
}
func (s) TestCZChannelTraceCreationDeletion(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
// avoid calling API to set balancer type, which will void service config's change of balancer.
e.balancer = ""
@ -1431,7 +1456,8 @@ func (s) TestCZChannelTraceCreationDeletion(t *testing.T) {
}
func (s) TestCZSubChannelTraceCreationDeletion(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
te := newTest(t, e)
te.startServer(&testServer{security: e.security})
@ -1509,7 +1535,8 @@ func (s) TestCZSubChannelTraceCreationDeletion(t *testing.T) {
}
func (s) TestCZChannelAddressResolutionChange(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
e.balancer = ""
te := newTest(t, e)
@ -1611,7 +1638,8 @@ func (s) TestCZChannelAddressResolutionChange(t *testing.T) {
}
func (s) TestCZSubChannelPickedNewAddress(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
e.balancer = ""
te := newTest(t, e)
@ -1671,7 +1699,8 @@ func (s) TestCZSubChannelPickedNewAddress(t *testing.T) {
}
func (s) TestCZSubChannelConnectivityState(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
te := newTest(t, e)
te.startServer(&testServer{security: e.security})
@ -1765,7 +1794,8 @@ func (s) TestCZSubChannelConnectivityState(t *testing.T) {
}
func (s) TestCZChannelConnectivityState(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
te := newTest(t, e)
te.startServer(&testServer{security: e.security})
@ -1821,7 +1851,8 @@ func (s) TestCZChannelConnectivityState(t *testing.T) {
}
func (s) TestCZTraceOverwriteChannelDeletion(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
// avoid calling API to set balancer type, which will void service config's change of balancer.
e.balancer = ""
@ -1881,7 +1912,8 @@ func (s) TestCZTraceOverwriteChannelDeletion(t *testing.T) {
}
func (s) TestCZTraceOverwriteSubChannelDeletion(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
te := newTest(t, e)
channelz.SetMaxTraceEntry(1)
@ -1940,7 +1972,8 @@ func (s) TestCZTraceOverwriteSubChannelDeletion(t *testing.T) {
}
func (s) TestCZTraceTopChannelDeletionTraceClear(t *testing.T) {
channelz.NewChannelzStorage()
czCleanup := channelz.NewChannelzStorage()
defer czCleanupWrapper(czCleanup, t)
e := tcpClearRREnv
te := newTest(t, e)
te.startServer(&testServer{security: e.security})

View File

@ -6512,7 +6512,6 @@ func testCompressorRegister(t *testing.T, e env) {
}
func (s) TestServeExitsWhenListenerClosed(t *testing.T) {
ss := &stubServer{
emptyCall: func(context.Context, *testpb.Empty) (*testpb.Empty, error) {
return &testpb.Empty{}, nil
@ -6520,6 +6519,7 @@ func (s) TestServeExitsWhenListenerClosed(t *testing.T) {
}
s := grpc.NewServer()
defer s.Stop()
testpb.RegisterTestServiceServer(s, ss)
lis, err := net.Listen("tcp", "localhost:0")
@ -7087,7 +7087,6 @@ func testLargeTimeout(t *testing.T, e env) {
// test ensures that the connection is re-created after GO_AWAY and not affected by the
// subsequent (old) connection closure.
func (s) TestGoAwayThenClose(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
defer cancel()