@@ -32,7 +32,6 @@ import (
3232 configapi "github.com/llm-d/llm-d-router/apix/config/v1alpha1"
3333 "github.com/llm-d/llm-d-router/pkg/common/observability/logging"
3434 "github.com/llm-d/llm-d-router/pkg/epp/config"
35- "github.com/llm-d/llm-d-router/pkg/epp/datalayer"
3635 "github.com/llm-d/llm-d-router/pkg/epp/flowcontrol"
3736 "github.com/llm-d/llm-d-router/pkg/epp/flowcontrol/registry"
3837 fwkdl "github.com/llm-d/llm-d-router/pkg/epp/framework/interface/datalayer"
@@ -67,6 +66,8 @@ const (
6766 testProfileHandler = "test-profile-handler"
6867 testSourceType = "test-source"
6968 testExtractorType = "test-extractor"
69+
70+ testFeatureGate = "test-feature-gate"
7071)
7172
7273// --- Test: Phase 1 (Raw Loading & Static Defaults) ---
@@ -75,19 +76,20 @@ func TestLoadRawConfiguration(t *testing.T) {
7576 t .Parallel ()
7677
7778 // Register known feature gates for validation.
78- RegisterFeatureGate (datalayer . ExperimentalDatalayerFeatureGate )
79- RegisterFeatureGate (flowcontrol .FeatureGate )
79+ RegisterFeatureGate (testFeatureGate , true )
80+ RegisterFeatureGate (flowcontrol .FeatureGate , false )
8081
8182 queueScorerWeight := 2.0
8283 kvCacheUtilizationScorerWeight := 2.0
8384 prefixCacheScorerWeight := 3.0
8485
8586 tests := []struct {
86- name string
87- configText string
88- want * configapi.EndpointPickerConfig
89- wantErr bool
90- deprecated bool
87+ name string
88+ configText string
89+ want * configapi.EndpointPickerConfig
90+ wantFeatures map [string ]bool
91+ wantErr bool
92+ deprecated bool
9193 }{
9294 {
9395 name : "Success - Full Configuration" ,
@@ -114,7 +116,7 @@ func TestLoadRawConfiguration(t *testing.T) {
114116 },
115117 },
116118 FeatureGates : configapi.FeatureGates {
117- datalayer . ExperimentalDatalayerFeatureGate ,
119+ testFeatureGate ,
118120 flowcontrol .FeatureGate ,
119121 },
120122 FlowControl : & configapi.FlowControlConfig {
@@ -123,6 +125,10 @@ func TestLoadRawConfiguration(t *testing.T) {
123125 },
124126 },
125127 },
128+ wantFeatures : map [string ]bool {
129+ testFeatureGate : true ,
130+ flowcontrol .FeatureGate : true ,
131+ },
126132 wantErr : false ,
127133 deprecated : false ,
128134 },
@@ -151,7 +157,7 @@ func TestLoadRawConfiguration(t *testing.T) {
151157 },
152158 },
153159 FeatureGates : configapi.FeatureGates {
154- datalayer . ExperimentalDatalayerFeatureGate ,
160+ testFeatureGate ,
155161 flowcontrol .FeatureGate ,
156162 },
157163 FlowControl : & configapi.FlowControlConfig {
@@ -174,7 +180,13 @@ func TestLoadRawConfiguration(t *testing.T) {
174180 Plugins : []configapi.PluginSpec {
175181 {Name : "test1" , Type : testPluginType , Parameters : json .RawMessage (`{"threshold":10}` )},
176182 },
177- FeatureGates : configapi.FeatureGates {},
183+ FeatureGates : configapi.FeatureGates {
184+ testFeatureGate + "=false" ,
185+ },
186+ },
187+ wantFeatures : map [string ]bool {
188+ testFeatureGate : false ,
189+ flowcontrol .FeatureGate : false ,
178190 },
179191 wantErr : false ,
180192 deprecated : false ,
@@ -240,6 +252,10 @@ func TestLoadRawConfiguration(t *testing.T) {
240252 },
241253 },
242254 },
255+ wantFeatures : map [string ]bool {
256+ testFeatureGate : true ,
257+ flowcontrol .FeatureGate : false ,
258+ },
243259 wantErr : false ,
244260 deprecated : false ,
245261 },
@@ -322,6 +338,12 @@ func TestLoadRawConfiguration(t *testing.T) {
322338 wantErr : true ,
323339 deprecated : false ,
324340 },
341+ {
342+ name : "Error - Bad Feature Gate" ,
343+ configText : errorBadFeatureGateText ,
344+ wantErr : true ,
345+ deprecated : false ,
346+ },
325347 }
326348
327349 for _ , tc := range tests {
@@ -330,7 +352,7 @@ func TestLoadRawConfiguration(t *testing.T) {
330352 writer := & strings.Builder {}
331353 logger := logging .NewTestLoggerWithWriter (writer )
332354
333- got , _ , err := LoadRawConfig ([]byte (tc .configText ), logger )
355+ got , featureGates , err := LoadRawConfig ([]byte (tc .configText ), logger )
334356
335357 if tc .wantErr {
336358 require .Error (t , err , "Expected LoadRawConfig to fail" )
@@ -340,6 +362,11 @@ func TestLoadRawConfiguration(t *testing.T) {
340362 diff := cmp .Diff (tc .want , got )
341363 require .Empty (t , diff , "Config mismatch (-want +got):\n %s" , diff )
342364
365+ if tc .wantFeatures != nil {
366+ diff = cmp .Diff (tc .wantFeatures , featureGates )
367+ require .Empty (t , diff , "Config feature gates mismatch (-want +got):\n %s" , diff )
368+ }
369+
343370 if strings .Contains (writer .String (), "deprecated" ) {
344371 require .True (t , tc .deprecated , "Deprecated configuration wasn't marked as deprecated" )
345372 } else {
@@ -355,8 +382,8 @@ func TestInstantiateAndConfigure(t *testing.T) {
355382 // Not parallel because it modifies global plugin registry.
356383 registerTestPlugins (t )
357384
358- RegisterFeatureGate (datalayer . ExperimentalDatalayerFeatureGate )
359- RegisterFeatureGate (flowcontrol .FeatureGate )
385+ RegisterFeatureGate (testFeatureGate , true )
386+ RegisterFeatureGate (flowcontrol .FeatureGate , false )
360387
361388 tests := []struct {
362389 name string
0 commit comments