@@ -10,7 +10,7 @@ import (
1010
1111func TestSotwSubscriptions (t * testing.T ) {
1212 t .Run ("legacy mode properly handled" , func (t * testing.T ) {
13- sub := NewSotwSubscription ([]string {}, config . NewOpts (), "" )
13+ sub := NewSotwSubscription ([]string {}, true )
1414 assert .True (t , sub .IsWildcard ())
1515
1616 // Requests always set empty in legacy mode
@@ -37,7 +37,7 @@ func TestSotwSubscriptions(t *testing.T) {
3737
3838 t .Run ("new wildcard mode from start" , func (t * testing.T ) {
3939 // A resource is provided so the subscription was created in wildcard
40- sub := NewSotwSubscription ([]string {"*" }, config . NewOpts (), "" )
40+ sub := NewSotwSubscription ([]string {"*" }, true )
4141 assert .True (t , sub .IsWildcard ())
4242 assert .Empty (t , sub .SubscribedResources ())
4343
@@ -75,7 +75,7 @@ func TestSotwSubscriptions(t *testing.T) {
7575
7676func TestDeltaSubscriptions (t * testing.T ) {
7777 t .Run ("legacy mode properly handled" , func (t * testing.T ) {
78- sub := NewDeltaSubscription ([]string {}, []string {}, map [string ]string {"resource" : "version" }, config . NewOpts (), "" )
78+ sub := NewDeltaSubscription ([]string {}, []string {}, map [string ]string {"resource" : "version" }, true )
7979 assert .True (t , sub .IsWildcard ())
8080 assert .Empty (t , sub .SubscribedResources ())
8181 assert .Equal (t , map [string ]string {"resource" : "version" }, sub .ReturnedResources ())
@@ -104,7 +104,7 @@ func TestDeltaSubscriptions(t *testing.T) {
104104
105105 t .Run ("new wildcard mode" , func (t * testing.T ) {
106106 // A resource is provided so the subscription was created in wildcard
107- sub := NewDeltaSubscription ([]string {"*" }, []string {}, map [string ]string {"resource" : "version" }, config . NewOpts (), "" )
107+ sub := NewDeltaSubscription ([]string {"*" }, []string {}, map [string ]string {"resource" : "version" }, true )
108108 assert .True (t , sub .IsWildcard ())
109109 assert .Empty (t , sub .SubscribedResources ())
110110
@@ -166,8 +166,9 @@ func TestSotwSubscriptionsWithDeactivatedLegacyWildcard(t *testing.T) {
166166 deactivateOpt := config .DeactivateLegacyWildcard ()
167167 deactivateOpt (& opts )
168168
169+ typeURL := "type.googleapis.com/envoy.config.cluster.v3.Cluster"
169170 // Create subscription with empty resource list (would normally be legacy wildcard)
170- sub := NewSotwSubscription ([]string {}, opts , "type.googleapis.com/envoy.config.cluster.v3.Cluster" )
171+ sub := NewSotwSubscription ([]string {}, opts . IsLegacyWildcardActive ( typeURL ) )
171172
172173 // With deactivated legacy wildcard, subscription should NOT be wildcard initially
173174 // because allowLegacyWildcard=false means empty list doesn't trigger legacy behavior
@@ -194,11 +195,11 @@ func TestSotwSubscriptionsWithDeactivatedLegacyWildcardForTypes(t *testing.T) {
194195 deactivateOpt (& opts )
195196
196197 // Both cluster and endpoint should have legacy wildcard deactivated
197- subCluster := NewSotwSubscription ([]string {}, opts , clusterType )
198+ subCluster := NewSotwSubscription ([]string {}, opts . IsLegacyWildcardActive ( clusterType ) )
198199 subCluster .SetResourceSubscription ([]string {})
199200 assert .False (t , subCluster .IsWildcard ())
200201
201- subEndpoint := NewSotwSubscription ([]string {}, opts , endpointType )
202+ subEndpoint := NewSotwSubscription ([]string {}, opts . IsLegacyWildcardActive ( endpointType ) )
202203 subEndpoint .SetResourceSubscription ([]string {})
203204 assert .False (t , subEndpoint .IsWildcard ())
204205
@@ -207,7 +208,7 @@ func TestSotwSubscriptionsWithDeactivatedLegacyWildcardForTypes(t *testing.T) {
207208 assert .True (t , subEndpoint .IsWildcard ())
208209
209210 // Route should still have legacy wildcard enabled
210- subRoute := NewSotwSubscription ([]string {}, opts , routeType )
211+ subRoute := NewSotwSubscription ([]string {}, opts . IsLegacyWildcardActive ( routeType ) )
211212 subRoute .SetResourceSubscription ([]string {})
212213 assert .True (t , subRoute .IsWildcard ())
213214 })
@@ -219,8 +220,9 @@ func TestDeltaSubscriptionsWithDeactivatedLegacyWildcard(t *testing.T) {
219220 deactivateOpt := config .DeactivateLegacyWildcard ()
220221 deactivateOpt (& opts )
221222
223+ typeURL := "type.googleapis.com/envoy.config.cluster.v3.Cluster"
222224 // Create subscription with empty resource list (would normally be legacy wildcard)
223- sub := NewDeltaSubscription ([]string {}, []string {}, map [string ]string {"resource" : "version" }, opts , "type.googleapis.com/envoy.config.cluster.v3.Cluster" )
225+ sub := NewDeltaSubscription ([]string {}, []string {}, map [string ]string {"resource" : "version" }, opts . IsLegacyWildcardActive ( typeURL ) )
224226
225227 // With deactivated legacy wildcard, subscription should NOT be wildcard initially
226228 assert .False (t , sub .IsWildcard ())
@@ -248,11 +250,11 @@ func TestDeltaSubscriptionsWithDeactivatedLegacyWildcardForTypes(t *testing.T) {
248250 deactivateOpt (& opts )
249251
250252 // Both cluster and endpoint should have legacy wildcard deactivated
251- subCluster := NewDeltaSubscription ([]string {}, []string {}, map [string ]string {}, opts , clusterType )
253+ subCluster := NewDeltaSubscription ([]string {}, []string {}, map [string ]string {}, opts . IsLegacyWildcardActive ( clusterType ) )
252254 subCluster .UpdateResourceSubscriptions (nil , nil )
253255 assert .False (t , subCluster .IsWildcard ())
254256
255- subEndpoint := NewDeltaSubscription ([]string {}, []string {}, map [string ]string {}, opts , endpointType )
257+ subEndpoint := NewDeltaSubscription ([]string {}, []string {}, map [string ]string {}, opts . IsLegacyWildcardActive ( endpointType ) )
256258 subEndpoint .UpdateResourceSubscriptions (nil , nil )
257259 assert .False (t , subEndpoint .IsWildcard ())
258260
@@ -261,7 +263,7 @@ func TestDeltaSubscriptionsWithDeactivatedLegacyWildcardForTypes(t *testing.T) {
261263 assert .True (t , subEndpoint .IsWildcard ())
262264
263265 // Route should still have legacy wildcard enabled
264- subRoute := NewDeltaSubscription ([]string {}, []string {}, map [string ]string {}, opts , routeType )
266+ subRoute := NewDeltaSubscription ([]string {}, []string {}, map [string ]string {}, opts . IsLegacyWildcardActive ( routeType ) )
265267 subRoute .UpdateResourceSubscriptions (nil , nil )
266268 assert .True (t , subRoute .IsWildcard ())
267269 })
0 commit comments