@@ -29,13 +29,14 @@ import (
29
29
30
30
"github.com/google/go-cmp/cmp"
31
31
"github.com/stretchr/testify/assert"
32
- "k8s.io/kubernetes/pkg/scheduler/framework/plugins/interpodaffinity"
33
32
34
33
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
35
34
"k8s.io/apimachinery/pkg/runtime"
36
35
apiserveroptions "k8s.io/apiserver/pkg/server/options"
37
36
componentbaseconfig "k8s.io/component-base/config"
37
+ "k8s.io/component-base/logs"
38
38
kubeschedulerconfig "k8s.io/kubernetes/pkg/scheduler/apis/config"
39
+ "k8s.io/kubernetes/pkg/scheduler/framework/plugins/interpodaffinity"
39
40
)
40
41
41
42
func TestSchedulerOptions (t * testing.T ) {
@@ -293,6 +294,7 @@ profiles:
293
294
RemoteKubeConfigFileOptional : true ,
294
295
AlwaysAllowPaths : []string {"/healthz" }, // note: this does not match /healthz/ or /healthz/*
295
296
},
297
+ Logs : logs .NewOptions (),
296
298
},
297
299
expectedUsername : "config" ,
298
300
expectedConfig : kubeschedulerconfig.KubeSchedulerConfiguration {
@@ -337,18 +339,25 @@ profiles:
337
339
}
338
340
return * cfg
339
341
}(),
342
+ Logs : logs .NewOptions (),
340
343
},
341
344
expectedError : "no kind \" KubeSchedulerConfiguration\" is registered for version \" componentconfig/v1alpha1\" " ,
342
345
},
343
346
344
347
{
345
- name : "unknown version kubescheduler.config.k8s.io/unknown" ,
346
- options : & Options {ConfigFile : unknownVersionConfig },
348
+ name : "unknown version kubescheduler.config.k8s.io/unknown" ,
349
+ options : & Options {
350
+ ConfigFile : unknownVersionConfig ,
351
+ Logs : logs .NewOptions (),
352
+ },
347
353
expectedError : "no kind \" KubeSchedulerConfiguration\" is registered for version \" kubescheduler.config.k8s.io/unknown\" " ,
348
354
},
349
355
{
350
- name : "config file with no version" ,
351
- options : & Options {ConfigFile : noVersionConfig },
356
+ name : "config file with no version" ,
357
+ options : & Options {
358
+ ConfigFile : noVersionConfig ,
359
+ Logs : logs .NewOptions (),
360
+ },
352
361
expectedError : "Object 'apiVersion' is missing" ,
353
362
},
354
363
{
@@ -382,6 +391,7 @@ profiles:
382
391
RemoteKubeConfigFileOptional : true ,
383
392
AlwaysAllowPaths : []string {"/healthz" }, // note: this does not match /healthz/ or /healthz/*
384
393
},
394
+ Logs : logs .NewOptions (),
385
395
},
386
396
expectedUsername : "flag" ,
387
397
expectedConfig : kubeschedulerconfig.KubeSchedulerConfiguration {
@@ -446,6 +456,7 @@ profiles:
446
456
RemoteKubeConfigFileOptional : true ,
447
457
AlwaysAllowPaths : []string {"/healthz" }, // note: this does not match /healthz/ or /healthz/*
448
458
},
459
+ Logs : logs .NewOptions (),
449
460
},
450
461
expectedConfig : kubeschedulerconfig.KubeSchedulerConfiguration {
451
462
AlgorithmSource : kubeschedulerconfig.SchedulerAlgorithmSource {Provider : & defaultSource },
@@ -483,6 +494,7 @@ profiles:
483
494
name : "plugin config" ,
484
495
options : & Options {
485
496
ConfigFile : pluginConfigFile ,
497
+ Logs : logs .NewOptions (),
486
498
},
487
499
expectedUsername : "config" ,
488
500
expectedConfig : kubeschedulerconfig.KubeSchedulerConfiguration {
@@ -556,6 +568,7 @@ profiles:
556
568
name : "multiple profiles" ,
557
569
options : & Options {
558
570
ConfigFile : multiProfilesConfig ,
571
+ Logs : logs .NewOptions (),
559
572
},
560
573
expectedUsername : "config" ,
561
574
expectedConfig : kubeschedulerconfig.KubeSchedulerConfiguration {
@@ -614,8 +627,10 @@ profiles:
614
627
},
615
628
},
616
629
{
617
- name : "no config" ,
618
- options : & Options {},
630
+ name : "no config" ,
631
+ options : & Options {
632
+ Logs : logs .NewOptions (),
633
+ },
619
634
expectedError : "no configuration has been provided" ,
620
635
},
621
636
{
@@ -629,6 +644,7 @@ profiles:
629
644
Deprecated : & DeprecatedOptions {
630
645
HardPodAffinitySymmetricWeight : 5 ,
631
646
},
647
+ Logs : logs .NewOptions (),
632
648
},
633
649
expectedUsername : "flag" ,
634
650
expectedConfig : kubeschedulerconfig.KubeSchedulerConfiguration {
@@ -680,6 +696,7 @@ profiles:
680
696
SchedulerName : "my-nice-scheduler" ,
681
697
HardPodAffinitySymmetricWeight : 1 ,
682
698
},
699
+ Logs : logs .NewOptions (),
683
700
},
684
701
expectedUsername : "flag" ,
685
702
expectedConfig : kubeschedulerconfig.KubeSchedulerConfiguration {
@@ -735,6 +752,7 @@ profiles:
735
752
name : "unknown field" ,
736
753
options : & Options {
737
754
ConfigFile : unknownFieldConfig ,
755
+ Logs : logs .NewOptions (),
738
756
},
739
757
expectedError : "found unknown field: foo" ,
740
758
checkErrFn : runtime .IsStrictDecodingError ,
@@ -743,6 +761,7 @@ profiles:
743
761
name : "duplicate fields" ,
744
762
options : & Options {
745
763
ConfigFile : duplicateFieldConfig ,
764
+ Logs : logs .NewOptions (),
746
765
},
747
766
expectedError : `key "leaderElect" already set` ,
748
767
checkErrFn : runtime .IsStrictDecodingError ,
0 commit comments