@@ -600,6 +600,39 @@ func TestPGCoordinator_Unhealthy(t *testing.T) {
600
600
}
601
601
}
602
602
603
+ func TestPGCoordinator_Node_Empty (t * testing.T ) {
604
+ t .Parallel ()
605
+
606
+ ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitSuperLong )
607
+ defer cancel ()
608
+ ctrl := gomock .NewController (t )
609
+ mStore := dbmock .NewMockStore (ctrl )
610
+ ps := pubsub .NewInMemory ()
611
+ logger := slogtest .Make (t , nil ).Leveled (slog .LevelDebug )
612
+
613
+ id := uuid .New ()
614
+ mStore .EXPECT ().GetTailnetPeers (gomock .Any (), id ).Times (1 ).Return (nil , nil )
615
+
616
+ // extra calls we don't particularly care about for this test
617
+ mStore .EXPECT ().UpsertTailnetCoordinator (gomock .Any (), gomock .Any ()).
618
+ AnyTimes ().
619
+ Return (database.TailnetCoordinator {}, nil )
620
+ mStore .EXPECT ().CleanTailnetCoordinators (gomock .Any ()).AnyTimes ().Return (nil )
621
+ mStore .EXPECT ().CleanTailnetLostPeers (gomock .Any ()).AnyTimes ().Return (nil )
622
+ mStore .EXPECT ().CleanTailnetTunnels (gomock .Any ()).AnyTimes ().Return (nil )
623
+ mStore .EXPECT ().DeleteCoordinator (gomock .Any (), gomock .Any ()).AnyTimes ().Return (nil )
624
+
625
+ uut , err := tailnet .NewPGCoord (ctx , logger , ps , mStore )
626
+ require .NoError (t , err )
627
+ defer func () {
628
+ err := uut .Close ()
629
+ require .NoError (t , err )
630
+ }()
631
+
632
+ node := uut .Node (id )
633
+ require .Nil (t , node )
634
+ }
635
+
603
636
// TestPGCoordinator_BidirectionalTunnels tests when peers create tunnels to each other. We don't
604
637
// do this now, but it's schematically possible, so we should make sure it doesn't break anything.
605
638
func TestPGCoordinator_BidirectionalTunnels (t * testing.T ) {
0 commit comments