@@ -29,38 +29,29 @@ func TestGetConnection(t *testing.T) {
29
29
g .Expect (nonExistent ).To (Equal (agentgrpc.Connection {}))
30
30
}
31
31
32
- func TestReady (t * testing.T ) {
32
+ func TestConnectionIsReady (t * testing.T ) {
33
33
t .Parallel ()
34
34
g := NewWithT (t )
35
35
36
- tracker := agentgrpc .NewConnectionsTracker ()
37
-
38
36
conn := agentgrpc.Connection {
39
37
PodName : "pod1" ,
40
38
InstanceID : "instance1" ,
41
39
Parent : types.NamespacedName {Namespace : "default" , Name : "parent1" },
42
40
}
43
- tracker .Track ("key1" , conn )
44
41
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 ())
48
43
}
49
44
50
45
func TestConnectionIsNotReady (t * testing.T ) {
51
46
t .Parallel ()
52
47
g := NewWithT (t )
53
48
54
- tracker := agentgrpc .NewConnectionsTracker ()
55
-
56
49
conn := agentgrpc.Connection {
57
50
PodName : "pod1" ,
58
51
Parent : types.NamespacedName {Namespace : "default" , Name : "parent1" },
59
52
}
60
- tracker .Track ("key1" , conn )
61
53
62
- _ , ready := tracker .Ready ("key1" )
63
- g .Expect (ready ).To (BeFalse ())
54
+ g .Expect (conn .Ready ()).To (BeFalse ())
64
55
}
65
56
66
57
func TestSetInstanceID (t * testing.T ) {
@@ -74,13 +65,13 @@ func TestSetInstanceID(t *testing.T) {
74
65
}
75
66
tracker .Track ("key1" , conn )
76
67
77
- _ , ready := tracker .Ready ("key1" )
78
- g .Expect (ready ).To (BeFalse ())
68
+ trackedConn := tracker .GetConnection ("key1" )
69
+ g .Expect (trackedConn . Ready () ).To (BeFalse ())
79
70
80
71
tracker .SetInstanceID ("key1" , "instance1" )
81
72
82
- trackedConn , ready : = tracker .Ready ("key1" )
83
- g .Expect (ready ).To (BeTrue ())
73
+ trackedConn = tracker .GetConnection ("key1" )
74
+ g .Expect (trackedConn . Ready () ).To (BeTrue ())
84
75
g .Expect (trackedConn .InstanceID ).To (Equal ("instance1" ))
85
76
}
86
77
0 commit comments