rpc: close Clients in tests (#29512)

This commit is contained in:
Darioush Jalali 2024-04-16 01:38:25 -07:00 committed by GitHub
parent e4ecaf89cf
commit 71c78bf56d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

@ -253,6 +253,7 @@ func TestClientBatchRequestLimit(t *testing.T) {
defer server.Stop()
server.SetBatchLimits(2, 100000)
client := DialInProc(server)
defer client.Close()
batch := []BatchElem{
{Method: "foo"},
@ -342,6 +343,7 @@ func testClientCancel(transport string, t *testing.T) {
default:
panic("unknown transport: " + transport)
}
defer client.Close()
// The actual test starts here.
var (
@ -592,6 +594,7 @@ func TestClientSubscriptionChannelClose(t *testing.T) {
srv.RegisterName("nftest", new(notificationTestService))
client, _ := Dial(wsURL)
defer client.Close()
for i := 0; i < 100; i++ {
ch := make(chan int, 100)
@ -708,7 +711,6 @@ func TestClientHTTP(t *testing.T) {
errc = make(chan error, len(results))
wantResult = echoResult{"a", 1, new(echoArgs)}
)
defer client.Close()
for i := range results {
i := i
go func() {

@ -187,6 +187,7 @@ func TestWebsocketPeerInfo(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer c.Close()
// Request peer information.
var connInfo PeerInfo
@ -273,6 +274,7 @@ func TestClientWebsocketLargeMessage(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer c.Close()
var r string
if err := c.Call(&r, "test_largeResp"); err != nil {