1
1
package test
2
2
3
3
import (
4
- "context"
5
4
"net"
6
5
"strconv"
7
6
"testing"
@@ -469,8 +468,6 @@ var testData = [...]struct {
469
468
func TestRoundRobin (t * testing.T ) {
470
469
for _ , test := range testData {
471
470
t .Run (test .name , func (t * testing.T ) {
472
- ctx , cancel := context .WithCancel (context .Background ())
473
- defer cancel ()
474
471
var (
475
472
mconn = map [conn.Conn ]string {} // Conn to addr mapping for easy matching.
476
473
maddr = map [string ]conn.Conn {} // addr to Conn mapping.
@@ -486,10 +483,10 @@ func TestRoundRobin(t *testing.T) {
486
483
config .WithEndpoint ("test" ),
487
484
),
488
485
)
489
- c .SetState (ctx , conn .Online )
486
+ c .SetState (conn .Online )
490
487
if test .banned != nil {
491
488
if _ , ok := test .banned [e .Address ()]; ok {
492
- c .SetState (ctx , conn .Banned )
489
+ c .SetState (conn .Banned )
493
490
}
494
491
}
495
492
mconn [c ] = e .Address ()
@@ -529,8 +526,6 @@ func TestRandomChoice(t *testing.T) {
529
526
multiplier := 100
530
527
for _ , test := range testData {
531
528
t .Run (test .name , func (t * testing.T ) {
532
- ctx , cancel := context .WithCancel (context .Background ())
533
- defer cancel ()
534
529
var (
535
530
mconn = map [conn.Conn ]string {} // Conn to addr mapping for easy matching.
536
531
maddr = map [string ]conn.Conn {} // addr to Conn mapping.
@@ -543,9 +538,9 @@ func TestRandomChoice(t *testing.T) {
543
538
e ,
544
539
config .New (),
545
540
)
546
- c .SetState (ctx , conn .Online )
541
+ c .SetState (conn .Online )
547
542
if _ , ok := test .banned [e .Address ()]; ok {
548
- c .SetState (ctx , conn .Banned )
543
+ c .SetState (conn .Banned )
549
544
}
550
545
mconn [c ] = e .Address ()
551
546
maddr [e .Address ()] = c
0 commit comments