@@ -417,7 +417,7 @@ func TestPGCoordinatorSingle_SendsHeartbeats(t *testing.T) {
417
417
// TestPGCoordinatorDual_Mainline tests with 2 coordinators, one agent connected to each, and 2 clients per agent.
418
418
//
419
419
// +---------+
420
- // agent ---> | coord1 | <--- client11 (coord 1, agent 1)
420
+ // agent1 ---> | coord1 | <--- client11 (coord 1, agent 1)
421
421
// | |
422
422
// | | <--- client12 (coord 1, agent 2)
423
423
// +---------+
@@ -442,20 +442,20 @@ func TestPGCoordinatorDual_Mainline(t *testing.T) {
442
442
require .NoError (t , err )
443
443
defer coord2 .Close ()
444
444
445
- agent := agpltest .NewAgent (ctx , t , coord1 , "agent" )
446
- defer agent .Close (ctx )
447
- t .Logf ("agent=%s" , agent .ID )
445
+ agent1 := agpltest .NewAgent (ctx , t , coord1 , "agent" )
446
+ defer agent1 .Close (ctx )
447
+ t .Logf ("agent=%s" , agent1 .ID )
448
448
agent2 := agpltest .NewAgent (ctx , t , coord2 , "agent2" )
449
449
defer agent2 .Close (ctx )
450
450
t .Logf ("agent2=%s" , agent2 .ID )
451
451
452
- client11 := agpltest .NewClient (ctx , t , coord1 , "client11" , agent .ID )
452
+ client11 := agpltest .NewClient (ctx , t , coord1 , "client11" , agent1 .ID )
453
453
defer client11 .Close (ctx )
454
454
t .Logf ("client11=%s" , client11 .ID )
455
455
client12 := agpltest .NewClient (ctx , t , coord1 , "client12" , agent2 .ID )
456
456
defer client12 .Close (ctx )
457
457
t .Logf ("client12=%s" , client12 .ID )
458
- client21 := agpltest .NewClient (ctx , t , coord2 , "client21" , agent .ID )
458
+ client21 := agpltest .NewClient (ctx , t , coord2 , "client21" , agent1 .ID )
459
459
defer client21 .Close (ctx )
460
460
t .Logf ("client21=%s" , client21 .ID )
461
461
client22 := agpltest .NewClient (ctx , t , coord2 , "client22" , agent2 .ID )
@@ -464,11 +464,11 @@ func TestPGCoordinatorDual_Mainline(t *testing.T) {
464
464
465
465
t .Logf ("client11 -> Node 11" )
466
466
client11 .UpdateDERP (11 )
467
- agent .AssertEventuallyHasDERP (client11 .ID , 11 )
467
+ agent1 .AssertEventuallyHasDERP (client11 .ID , 11 )
468
468
469
469
t .Logf ("client21 -> Node 21" )
470
470
client21 .UpdateDERP (21 )
471
- agent .AssertEventuallyHasDERP (client21 .ID , 21 )
471
+ agent1 .AssertEventuallyHasDERP (client21 .ID , 21 )
472
472
473
473
t .Logf ("client22 -> Node 22" )
474
474
client22 .UpdateDERP (22 )
@@ -484,9 +484,9 @@ func TestPGCoordinatorDual_Mainline(t *testing.T) {
484
484
agent2 .AssertEventuallyHasDERP (client12 .ID , 12 )
485
485
486
486
t .Logf ("agent -> Node 1" )
487
- agent .UpdateDERP (1 )
488
- client21 .AssertEventuallyHasDERP (agent .ID , 1 )
489
- client11 .AssertEventuallyHasDERP (agent .ID , 1 )
487
+ agent1 .UpdateDERP (1 )
488
+ client21 .AssertEventuallyHasDERP (agent1 .ID , 1 )
489
+ client11 .AssertEventuallyHasDERP (agent1 .ID , 1 )
490
490
491
491
t .Logf ("close coord2" )
492
492
err = coord2 .Close ()
@@ -503,10 +503,10 @@ func TestPGCoordinatorDual_Mainline(t *testing.T) {
503
503
err = coord1 .Close ()
504
504
require .NoError (t , err )
505
505
// this closes agent, client12, client11
506
- agent .AssertEventuallyResponsesClosed ()
506
+ agent1 .AssertEventuallyResponsesClosed ()
507
507
client12 .AssertEventuallyResponsesClosed ()
508
508
client11 .AssertEventuallyResponsesClosed ()
509
- assertEventuallyLost (ctx , t , store , agent .ID )
509
+ assertEventuallyLost (ctx , t , store , agent1 .ID )
510
510
assertEventuallyLost (ctx , t , store , client11 .ID )
511
511
assertEventuallyLost (ctx , t , store , client12 .ID )
512
512
}
@@ -516,7 +516,7 @@ func TestPGCoordinatorDual_Mainline(t *testing.T) {
516
516
// or an infrastructure problem where an old workspace is not fully cleaned up before a new one started.
517
517
//
518
518
// +---------+
519
- // agent ---> | coord1 |
519
+ // agent1 ---> | coord1 |
520
520
// +---------+
521
521
// +---------+
522
522
// agent2 ---> | coord2 |
@@ -543,42 +543,42 @@ func TestPGCoordinator_MultiCoordinatorAgent(t *testing.T) {
543
543
require .NoError (t , err )
544
544
defer coord3 .Close ()
545
545
546
- agent := agpltest .NewAgent (ctx , t , coord1 , "agent" )
547
- defer agent .Close (ctx )
546
+ agent1 := agpltest .NewAgent (ctx , t , coord1 , "agent" )
547
+ defer agent1 .Close (ctx )
548
548
agent2 := agpltest .NewPeer (ctx , t , coord2 , "agent2" ,
549
- agpltest .WithID (agent .ID ), agpltest .WithAuth (agpl.AgentCoordinateeAuth {ID : agent .ID }),
549
+ agpltest .WithID (agent1 .ID ), agpltest .WithAuth (agpl.AgentCoordinateeAuth {ID : agent1 .ID }),
550
550
)
551
551
defer agent2 .Close (ctx )
552
552
553
- client := agpltest .NewClient (ctx , t , coord3 , "client" , agent .ID )
553
+ client := agpltest .NewClient (ctx , t , coord3 , "client" , agent1 .ID )
554
554
defer client .Close (ctx )
555
555
556
556
client .UpdateDERP (3 )
557
- agent .AssertEventuallyHasDERP (client .ID , 3 )
557
+ agent1 .AssertEventuallyHasDERP (client .ID , 3 )
558
558
agent2 .AssertEventuallyHasDERP (client .ID , 3 )
559
559
560
- agent .UpdateDERP (1 )
561
- client .AssertEventuallyHasDERP (agent .ID , 1 )
560
+ agent1 .UpdateDERP (1 )
561
+ client .AssertEventuallyHasDERP (agent1 .ID , 1 )
562
562
563
563
// agent2's update overrides agent because it is newer
564
564
agent2 .UpdateDERP (2 )
565
- client .AssertEventuallyHasDERP (agent .ID , 2 )
565
+ client .AssertEventuallyHasDERP (agent1 .ID , 2 )
566
566
567
567
// agent2 disconnects, and we should revert back to agent
568
568
agent2 .Close (ctx )
569
- client .AssertEventuallyHasDERP (agent .ID , 1 )
569
+ client .AssertEventuallyHasDERP (agent1 .ID , 1 )
570
570
571
- agent .UpdateDERP (11 )
572
- client .AssertEventuallyHasDERP (agent .ID , 11 )
571
+ agent1 .UpdateDERP (11 )
572
+ client .AssertEventuallyHasDERP (agent1 .ID , 11 )
573
573
574
574
client .UpdateDERP (31 )
575
- agent .AssertEventuallyHasDERP (client .ID , 31 )
575
+ agent1 .AssertEventuallyHasDERP (client .ID , 31 )
576
576
577
- agent .UngracefulDisconnect (ctx )
577
+ agent1 .UngracefulDisconnect (ctx )
578
578
client .UngracefulDisconnect (ctx )
579
579
580
580
assertEventuallyLost (ctx , t , store , client .ID )
581
- assertEventuallyLost (ctx , t , store , agent .ID )
581
+ assertEventuallyLost (ctx , t , store , agent1 .ID )
582
582
}
583
583
584
584
func TestPGCoordinator_Unhealthy (t * testing.T ) {
0 commit comments