@@ -1316,3 +1316,43 @@ func TestExperimentalPluginsFeatureGate(t *testing.T) {
13161316 _ , err = InstantiateAndConfigure (rawConfigWithGate , testutils .NewTestHandle (context .Background ()), logger )
13171317 require .NoError (t , err )
13181318}
1319+
1320+ func TestPluginRefStabilityDegradation (t * testing.T ) {
1321+ parentType := "test-beta-parent-plugin"
1322+ childType := "test-alpha-child-plugin"
1323+
1324+ fwkplugin .RegisterWithPluginDependencies (parentType , fwkplugin .StabilityBeta ,
1325+ func (name string , _ * json.Decoder , _ fwkplugin.Handle ) (fwkplugin.Plugin , error ) {
1326+ return & mockPlugin {t : fwkplugin.TypedName {Name : name , Type : parentType }}, nil
1327+ },
1328+ func (dec * json.Decoder , _ fwkplugin.Handle ) (any , error ) {
1329+ type config struct {
1330+ ChildRef string `json:"childRef" pluginRef:"true"`
1331+ }
1332+ var cfg config
1333+ if dec != nil {
1334+ if err := dec .Decode (& cfg ); err != nil {
1335+ return nil , err
1336+ }
1337+ }
1338+ return cfg , nil
1339+ },
1340+ )
1341+ fwkplugin .Register (childType , fwkplugin .StabilityAlpha , func (name string , _ * json.Decoder , _ fwkplugin.Handle ) (fwkplugin.Plugin , error ) {
1342+ return & mockPlugin {t : fwkplugin.TypedName {Name : name , Type : childType }}, nil
1343+ })
1344+
1345+ rawConfig := & configapi.EndpointPickerConfig {
1346+ FeatureGates : configapi.FeatureGates {fwkplugin .ExperimentalPluginsFeatureGate },
1347+ Plugins : []configapi.PluginSpec {
1348+ {Name : "child" , Type : childType },
1349+ {Name : "parent" , Type : parentType , Parameters : json .RawMessage (`{"childRef":"child"}` )},
1350+ },
1351+ }
1352+
1353+ logger := logging .NewTestLogger ()
1354+ handle := testutils .NewTestHandle (context .Background ())
1355+ _ , err := InstantiateAndConfigure (rawConfig , handle , logger )
1356+ require .Error (t , err )
1357+ require .Contains (t , err .Error (), "stability degradation detected" )
1358+ }
0 commit comments