@@ -35,7 +35,7 @@ func TestSnapshotCacheDeltaWatch(t *testing.T) {
35
35
// Make our initial request as a wildcard to get all resources and make sure the wildcard requesting works as intended
36
36
for _ , typ := range testTypes {
37
37
watches [typ ] = make (chan cache.DeltaResponse , 1 )
38
- state := stream .NewSubscriptionState (true , nil )
38
+ state := stream .NewSubscription (true , nil )
39
39
_ , err := c .CreateDeltaWatch (& discovery.DeltaDiscoveryRequest {
40
40
Node : & core.Node {
41
41
Id : "node" ,
@@ -69,9 +69,9 @@ func TestSnapshotCacheDeltaWatch(t *testing.T) {
69
69
// all resources as well as individual resource removals
70
70
for _ , typ := range testTypes {
71
71
watches [typ ] = make (chan cache.DeltaResponse , 1 )
72
- state := stream .NewSubscriptionState (false , versionMap [typ ])
72
+ state := stream .NewSubscription (false , versionMap [typ ])
73
73
for resource := range versionMap [typ ] {
74
- state .GetSubscribedResources ()[resource ] = struct {}{}
74
+ state .SubscribedResources ()[resource ] = struct {}{}
75
75
}
76
76
_ , err := c .CreateDeltaWatch (& discovery.DeltaDiscoveryRequest {
77
77
Node : & core.Node {
@@ -113,21 +113,21 @@ func TestSnapshotCacheDeltaWatch(t *testing.T) {
113
113
func TestDeltaRemoveResources (t * testing.T ) {
114
114
c := cache .NewSnapshotCache (false , group {}, logger {t : t })
115
115
watches := make (map [string ]chan cache.DeltaResponse )
116
- streams := make (map [string ]* stream.SubscriptionState )
116
+ subs := make (map [string ]* stream.Subscription )
117
117
118
118
// At this stage the cache is empty, so a watch is opened
119
119
for _ , typ := range testTypes {
120
120
watches [typ ] = make (chan cache.DeltaResponse , 1 )
121
- state := stream .NewSubscriptionState (true , make (map [string ]string ))
122
- streams [typ ] = & state
121
+ state := stream .NewSubscription (true , make (map [string ]string ))
122
+ subs [typ ] = & state
123
123
// We don't specify any resource name subscriptions here because we want to make sure we test wildcard
124
124
// functionality. This means we should receive all resources back without requesting a subscription by name.
125
125
_ , err := c .CreateDeltaWatch (& discovery.DeltaDiscoveryRequest {
126
126
Node : & core.Node {
127
127
Id : "node" ,
128
128
},
129
129
TypeUrl : typ ,
130
- }, * streams [typ ], watches [typ ])
130
+ }, * subs [typ ], watches [typ ])
131
131
require .NoError (t , err )
132
132
}
133
133
@@ -144,7 +144,7 @@ func TestDeltaRemoveResources(t *testing.T) {
144
144
case out := <- watches [typ ]:
145
145
assertResourceMapEqual (t , cache .IndexRawResourcesByName (out .(* cache.RawDeltaResponse ).Resources ), snapshot .GetResources (typ ))
146
146
nextVersionMap := out .GetNextVersionMap ()
147
- streams [typ ].SetACKedResources (nextVersionMap )
147
+ subs [typ ].SetReturnedResources (nextVersionMap )
148
148
case <- time .After (time .Second ):
149
149
require .Fail (t , "failed to receive a snapshot response" )
150
150
}
@@ -161,7 +161,7 @@ func TestDeltaRemoveResources(t *testing.T) {
161
161
},
162
162
TypeUrl : typ ,
163
163
ResponseNonce : "nonce" ,
164
- }, * streams [typ ], watches [typ ])
164
+ }, * subs [typ ], watches [typ ])
165
165
require .NoError (t , err )
166
166
}
167
167
@@ -181,7 +181,7 @@ func TestDeltaRemoveResources(t *testing.T) {
181
181
assert .Equal (t , []string {"otherCluster" }, out .(* cache.RawDeltaResponse ).RemovedResources )
182
182
nextVersionMap := out .GetNextVersionMap ()
183
183
// make sure the version maps are different since we no longer are tracking any endpoint resources
184
- assert .NotEqual (t , nextVersionMap , streams [testTypes [0 ]].GetACKedResources (), "versionMap for the endpoint resource type did not change" )
184
+ assert .NotEqual (t , nextVersionMap , subs [testTypes [0 ]].ReturnedResources (), "versionMap for the endpoint resource type did not change" )
185
185
case <- time .After (time .Second ):
186
186
assert .Fail (t , "failed to receive snapshot response" )
187
187
}
@@ -206,7 +206,7 @@ func TestConcurrentSetDeltaWatch(t *testing.T) {
206
206
t .Fatalf ("snapshot failed: %s" , err )
207
207
}
208
208
} else {
209
- state := stream .NewSubscriptionState (false , make (map [string ]string ))
209
+ state := stream .NewSubscription (false , make (map [string ]string ))
210
210
cancel , err := c .CreateDeltaWatch (& discovery.DeltaDiscoveryRequest {
211
211
Node : & core.Node {
212
212
Id : id ,
@@ -230,7 +230,7 @@ func TestSnapshotDeltaCacheWatchTimeout(t *testing.T) {
230
230
231
231
// Create a non-buffered channel that will block sends.
232
232
watchCh := make (chan cache.DeltaResponse )
233
- state := stream .NewSubscriptionState (false , nil )
233
+ state := stream .NewSubscription (false , nil )
234
234
state .SetSubscribedResources (map [string ]struct {}{names [rsrc .EndpointType ][0 ]: {}})
235
235
_ , err := c .CreateDeltaWatch (& discovery.DeltaDiscoveryRequest {
236
236
Node : & core.Node {
@@ -275,7 +275,7 @@ func TestSnapshotCacheDeltaWatchCancel(t *testing.T) {
275
275
c := cache .NewSnapshotCache (true , group {}, logger {t : t })
276
276
for _ , typ := range testTypes {
277
277
responses := make (chan cache.DeltaResponse , 1 )
278
- state := stream .NewSubscriptionState (false , make (map [string ]string ))
278
+ state := stream .NewSubscription (false , make (map [string ]string ))
279
279
cancel , err := c .CreateDeltaWatch (& discovery.DeltaDiscoveryRequest {
280
280
Node : & core.Node {
281
281
Id : key ,
0 commit comments