rpc: use range over int in tests

This commit is contained in:
Lessa 2026-01-16 01:52:39 -05:00
parent 23c3498836
commit 798556cba7
2 changed files with 4 additions and 4 deletions

View file

@ -529,7 +529,7 @@ func TestClientCloseUnsubscribeRace(t *testing.T) {
server := newTestServer() server := newTestServer()
defer server.Stop() defer server.Stop()
for i := 0; i < 20; i++ { for range 20 {
client := DialInProc(server) client := DialInProc(server)
nc := make(chan int) nc := make(chan int)
sub, err := client.Subscribe(context.Background(), "nftest", nc, "someSubscription", 3, 1) sub, err := client.Subscribe(context.Background(), "nftest", nc, "someSubscription", 3, 1)
@ -690,7 +690,7 @@ func TestClientSubscriptionChannelClose(t *testing.T) {
client, _ := Dial(wsURL) client, _ := Dial(wsURL)
defer client.Close() defer client.Close()
for i := 0; i < 100; i++ { for range 100 {
ch := make(chan int, 100) ch := make(chan int, 100)
sub, err := client.Subscribe(context.Background(), "nftest", ch, "someSubscription", 100, 1) sub, err := client.Subscribe(context.Background(), "nftest", ch, "someSubscription", 100, 1)
if err != nil { if err != nil {

View file

@ -144,7 +144,7 @@ func TestServerShortLivedConn(t *testing.T) {
wantResp = `{"jsonrpc":"2.0","id":1,"result":{"nftest":"1.0","rpc":"1.0","test":"1.0"}}` + "\n" wantResp = `{"jsonrpc":"2.0","id":1,"result":{"nftest":"1.0","rpc":"1.0","test":"1.0"}}` + "\n"
deadline = time.Now().Add(10 * time.Second) deadline = time.Now().Add(10 * time.Second)
) )
for i := 0; i < 20; i++ { for range 20 {
conn, err := net.Dial("tcp", listener.Addr().String()) conn, err := net.Dial("tcp", listener.Addr().String())
if err != nil { if err != nil {
t.Fatal("can't dial:", err) t.Fatal("can't dial:", err)
@ -178,7 +178,7 @@ func TestServerBatchResponseSizeLimit(t *testing.T) {
batch []BatchElem batch []BatchElem
client = DialInProc(server) client = DialInProc(server)
) )
for i := 0; i < 5; i++ { for range 5 {
batch = append(batch, BatchElem{ batch = append(batch, BatchElem{
Method: "test_echo", Method: "test_echo",
Args: []any{"x", 1}, Args: []any{"x", 1},