@@ -29,38 +29,29 @@ func TestGetConnection(t *testing.T) {
2929 g .Expect (nonExistent ).To (Equal (agentgrpc.Connection {}))
3030}
3131
32- func TestReady (t * testing.T ) {
32+ func TestConnectionIsReady (t * testing.T ) {
3333 t .Parallel ()
3434 g := NewWithT (t )
3535
36- tracker := agentgrpc .NewConnectionsTracker ()
37-
3836 conn := agentgrpc.Connection {
3937 PodName : "pod1" ,
4038 InstanceID : "instance1" ,
4139 Parent : types.NamespacedName {Namespace : "default" , Name : "parent1" },
4240 }
43- tracker .Track ("key1" , conn )
4441
45- trackedConn , ready := tracker .Ready ("key1" )
46- g .Expect (ready ).To (BeTrue ())
47- g .Expect (trackedConn ).To (Equal (conn ))
42+ g .Expect (conn .Ready ()).To (BeTrue ())
4843}
4944
5045func TestConnectionIsNotReady (t * testing.T ) {
5146 t .Parallel ()
5247 g := NewWithT (t )
5348
54- tracker := agentgrpc .NewConnectionsTracker ()
55-
5649 conn := agentgrpc.Connection {
5750 PodName : "pod1" ,
5851 Parent : types.NamespacedName {Namespace : "default" , Name : "parent1" },
5952 }
60- tracker .Track ("key1" , conn )
6153
62- _ , ready := tracker .Ready ("key1" )
63- g .Expect (ready ).To (BeFalse ())
54+ g .Expect (conn .Ready ()).To (BeFalse ())
6455}
6556
6657func TestSetInstanceID (t * testing.T ) {
@@ -74,13 +65,13 @@ func TestSetInstanceID(t *testing.T) {
7465 }
7566 tracker .Track ("key1" , conn )
7667
77- _ , ready := tracker .Ready ("key1" )
78- g .Expect (ready ).To (BeFalse ())
68+ trackedConn := tracker .GetConnection ("key1" )
69+ g .Expect (trackedConn . Ready () ).To (BeFalse ())
7970
8071 tracker .SetInstanceID ("key1" , "instance1" )
8172
82- trackedConn , ready : = tracker .Ready ("key1" )
83- g .Expect (ready ).To (BeTrue ())
73+ trackedConn = tracker .GetConnection ("key1" )
74+ g .Expect (trackedConn . Ready () ).To (BeTrue ())
8475 g .Expect (trackedConn .InstanceID ).To (Equal ("instance1" ))
8576}
8677
0 commit comments