11package test
22
33import (
4- "context"
54 "net"
65 "strconv"
76 "testing"
@@ -469,8 +468,6 @@ var testData = [...]struct {
469468func TestRoundRobin (t * testing.T ) {
470469 for _ , test := range testData {
471470 t .Run (test .name , func (t * testing.T ) {
472- ctx , cancel := context .WithCancel (context .Background ())
473- defer cancel ()
474471 var (
475472 mconn = map [conn.Conn ]string {} // Conn to addr mapping for easy matching.
476473 maddr = map [string ]conn.Conn {} // addr to Conn mapping.
@@ -486,10 +483,10 @@ func TestRoundRobin(t *testing.T) {
486483 config .WithEndpoint ("test" ),
487484 ),
488485 )
489- c .SetState (ctx , conn .Online )
486+ c .SetState (conn .Online )
490487 if test .banned != nil {
491488 if _ , ok := test .banned [e .Address ()]; ok {
492- c .SetState (ctx , conn .Banned )
489+ c .SetState (conn .Banned )
493490 }
494491 }
495492 mconn [c ] = e .Address ()
@@ -529,8 +526,6 @@ func TestRandomChoice(t *testing.T) {
529526 multiplier := 100
530527 for _ , test := range testData {
531528 t .Run (test .name , func (t * testing.T ) {
532- ctx , cancel := context .WithCancel (context .Background ())
533- defer cancel ()
534529 var (
535530 mconn = map [conn.Conn ]string {} // Conn to addr mapping for easy matching.
536531 maddr = map [string ]conn.Conn {} // addr to Conn mapping.
@@ -543,9 +538,9 @@ func TestRandomChoice(t *testing.T) {
543538 e ,
544539 config .New (),
545540 )
546- c .SetState (ctx , conn .Online )
541+ c .SetState (conn .Online )
547542 if _ , ok := test .banned [e .Address ()]; ok {
548- c .SetState (ctx , conn .Banned )
543+ c .SetState (conn .Banned )
549544 }
550545 mconn [c ] = e .Address ()
551546 maddr [e .Address ()] = c
0 commit comments