mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-13 21:25:09 +00:00
Add testcase covering unknown plugin config
Signed-off-by: kerthcet <kerthcet@gmail.com>
This commit is contained in:
@@ -117,6 +117,9 @@ var pluginConfigs = []configv1.PluginConfig{
|
||||
|
||||
func TestSchedulerDefaults(t *testing.T) {
|
||||
enable := true
|
||||
unknownPluginConfigs := append([]configv1.PluginConfig{}, pluginConfigs...)
|
||||
unknownPluginConfigs[0].Args = runtime.RawExtension{Object: &runtime.Unknown{}}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
config *configv1.KubeSchedulerConfiguration
|
||||
@@ -599,7 +602,49 @@ func TestSchedulerDefaults(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "unknown plugin config",
|
||||
config: &configv1.KubeSchedulerConfiguration{
|
||||
Profiles: []configv1.KubeSchedulerProfile{
|
||||
{
|
||||
PluginConfig: unknownPluginConfigs,
|
||||
},
|
||||
},
|
||||
},
|
||||
expected: &configv1.KubeSchedulerConfiguration{
|
||||
Parallelism: ptr.To[int32](16),
|
||||
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
|
||||
EnableProfiling: &enable,
|
||||
EnableContentionProfiling: &enable,
|
||||
},
|
||||
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||
LeaderElect: ptr.To(true),
|
||||
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
||||
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
||||
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
||||
ResourceLock: "leases",
|
||||
ResourceNamespace: "kube-system",
|
||||
ResourceName: "kube-scheduler",
|
||||
},
|
||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||
QPS: 50,
|
||||
Burst: 100,
|
||||
ContentType: "application/vnd.kubernetes.protobuf",
|
||||
},
|
||||
PercentageOfNodesToScore: ptr.To[int32](config.DefaultPercentageOfNodesToScore),
|
||||
PodInitialBackoffSeconds: ptr.To[int64](1),
|
||||
PodMaxBackoffSeconds: ptr.To[int64](10),
|
||||
Profiles: []configv1.KubeSchedulerProfile{
|
||||
{
|
||||
Plugins: getDefaultPlugins(),
|
||||
PluginConfig: unknownPluginConfigs,
|
||||
SchedulerName: ptr.To("default-scheduler"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
SetDefaults_KubeSchedulerConfiguration(tc.config)
|
||||
|
Reference in New Issue
Block a user