@@ -117,6 +117,9 @@ var pluginConfigs = []configv1.PluginConfig{
117
117
118
118
func TestSchedulerDefaults (t * testing.T ) {
119
119
enable := true
120
+ unknownPluginConfigs := append ([]configv1.PluginConfig {}, pluginConfigs ... )
121
+ unknownPluginConfigs [0 ].Args = runtime.RawExtension {Object : & runtime.Unknown {}}
122
+
120
123
tests := []struct {
121
124
name string
122
125
config * configv1.KubeSchedulerConfiguration
@@ -599,7 +602,49 @@ func TestSchedulerDefaults(t *testing.T) {
599
602
},
600
603
},
601
604
},
605
+ {
606
+ name : "unknown plugin config" ,
607
+ config : & configv1.KubeSchedulerConfiguration {
608
+ Profiles : []configv1.KubeSchedulerProfile {
609
+ {
610
+ PluginConfig : unknownPluginConfigs ,
611
+ },
612
+ },
613
+ },
614
+ expected : & configv1.KubeSchedulerConfiguration {
615
+ Parallelism : ptr.To [int32 ](16 ),
616
+ DebuggingConfiguration : componentbaseconfig.DebuggingConfiguration {
617
+ EnableProfiling : & enable ,
618
+ EnableContentionProfiling : & enable ,
619
+ },
620
+ LeaderElection : componentbaseconfig.LeaderElectionConfiguration {
621
+ LeaderElect : ptr .To (true ),
622
+ LeaseDuration : metav1.Duration {Duration : 15 * time .Second },
623
+ RenewDeadline : metav1.Duration {Duration : 10 * time .Second },
624
+ RetryPeriod : metav1.Duration {Duration : 2 * time .Second },
625
+ ResourceLock : "leases" ,
626
+ ResourceNamespace : "kube-system" ,
627
+ ResourceName : "kube-scheduler" ,
628
+ },
629
+ ClientConnection : componentbaseconfig.ClientConnectionConfiguration {
630
+ QPS : 50 ,
631
+ Burst : 100 ,
632
+ ContentType : "application/vnd.kubernetes.protobuf" ,
633
+ },
634
+ PercentageOfNodesToScore : ptr.To [int32 ](config .DefaultPercentageOfNodesToScore ),
635
+ PodInitialBackoffSeconds : ptr.To [int64 ](1 ),
636
+ PodMaxBackoffSeconds : ptr.To [int64 ](10 ),
637
+ Profiles : []configv1.KubeSchedulerProfile {
638
+ {
639
+ Plugins : getDefaultPlugins (),
640
+ PluginConfig : unknownPluginConfigs ,
641
+ SchedulerName : ptr .To ("default-scheduler" ),
642
+ },
643
+ },
644
+ },
645
+ },
602
646
}
647
+
603
648
for _ , tc := range tests {
604
649
t .Run (tc .name , func (t * testing.T ) {
605
650
SetDefaults_KubeSchedulerConfiguration (tc .config )
@@ -800,7 +845,7 @@ func TestPluginArgsDefaults(t *testing.T) {
800
845
defer featuregatetesting .SetFeatureGateDuringTest (t , feature .DefaultFeatureGate , k , v )()
801
846
}
802
847
scheme .Default (tc .in )
803
- if diff := cmp .Diff (tc .in , tc .want ); diff != "" {
848
+ if diff := cmp .Diff (tc .want , tc .in ); diff != "" {
804
849
t .Errorf ("Got unexpected defaults (-want, +got):\n %s" , diff )
805
850
}
806
851
})
0 commit comments