diff --git a/pkg/cache/application_test.go b/pkg/cache/application_test.go index da6f085dc..8f52f33de 100644 --- a/pkg/cache/application_test.go +++ b/pkg/cache/application_test.go @@ -38,7 +38,6 @@ import ( "github.com/apache/yunikorn-k8shim/pkg/common/constants" "github.com/apache/yunikorn-k8shim/pkg/common/events" "github.com/apache/yunikorn-k8shim/pkg/common/utils" - "github.com/apache/yunikorn-k8shim/pkg/conf" "github.com/apache/yunikorn-k8shim/pkg/dispatcher" "github.com/apache/yunikorn-k8shim/pkg/locking" "github.com/apache/yunikorn-scheduler-interface/lib/go/api" @@ -132,8 +131,6 @@ func TestFailApplication(t *testing.T) { lock: &locking.RWMutex{}, } ms := &mockSchedulerAPI{} - // set test mode - conf.GetSchedulerConf().SetTestMode(true) // set Recorder to mocked type mr := events.NewMockedRecorder() mr.OnEventf = func() { @@ -228,8 +225,6 @@ func TestSetUnallocatedPodsToFailedWhenFailApplication(t *testing.T) { context.apiProvider.GetAPIs().KubeClient = mockClient ms := &mockSchedulerAPI{} - // set test mode - conf.GetSchedulerConf().SetTestMode(true) // set Recorder to mocked type mr := events.NewMockedRecorder() events.SetRecorder(mr) @@ -336,8 +331,6 @@ func TestSetUnallocatedPodsToFailedWhenRejectApplication(t *testing.T) { defer mgr.Stop() ms := &mockSchedulerAPI{} - // set test mode - conf.GetSchedulerConf().SetTestMode(true) // set Recorder to mocked type mr := events.NewMockedRecorder() events.SetRecorder(mr) diff --git a/pkg/cache/context_test.go b/pkg/cache/context_test.go index 6d7bfafa4..b50988720 100644 --- a/pkg/cache/context_test.go +++ b/pkg/cache/context_test.go @@ -42,7 +42,6 @@ import ( "github.com/apache/yunikorn-k8shim/pkg/common/events" "github.com/apache/yunikorn-k8shim/pkg/common/test" "github.com/apache/yunikorn-k8shim/pkg/common/utils" - "github.com/apache/yunikorn-k8shim/pkg/conf" "github.com/apache/yunikorn-k8shim/pkg/dispatcher" "github.com/apache/yunikorn-k8shim/pkg/log" siCommon "github.com/apache/yunikorn-scheduler-interface/lib/go/common" @@ -103,7 +102,6 @@ func initContextForTest() *Context { } func initContextAndAPIProviderForTest() (*Context, *client.MockedAPIProvider) { - conf.GetSchedulerConf().SetTestMode(true) apis := client.NewMockedAPIProvider(false) context := NewContext(apis) return context, apis @@ -1160,7 +1158,6 @@ func TestGetTask(t *testing.T) { } func TestNodeEventFailsPublishingWithoutNode(t *testing.T) { - conf.GetSchedulerConf().SetTestMode(true) recorder, ok := events.GetRecorder().(*k8sEvents.FakeRecorder) if !ok { t.Fatal("the EventRecorder is expected to be of type FakeRecorder") @@ -1189,7 +1186,6 @@ func TestNodeEventFailsPublishingWithoutNode(t *testing.T) { } func TestNodeEventPublishedCorrectly(t *testing.T) { - conf.GetSchedulerConf().SetTestMode(true) recorder, ok := events.GetRecorder().(*k8sEvents.FakeRecorder) if !ok { t.Fatal("the EventRecorder is expected to be of type FakeRecorder") @@ -1250,7 +1246,6 @@ func TestNodeEventPublishedCorrectly(t *testing.T) { } func TestFilteredEventsNotPublished(t *testing.T) { - conf.GetSchedulerConf().SetTestMode(true) recorder, ok := events.GetRecorder().(*k8sEvents.FakeRecorder) if !ok { t.Fatal("the EventRecorder is expected to be of type FakeRecorder") @@ -1335,7 +1330,6 @@ func TestFilteredEventsNotPublished(t *testing.T) { } func TestPublishEventsWithNotExistingAsk(t *testing.T) { - conf.GetSchedulerConf().SetTestMode(true) recorder, ok := events.GetRecorder().(*k8sEvents.FakeRecorder) if !ok { t.Fatal("the EventRecorder is expected to be of type FakeRecorder") @@ -1376,7 +1370,6 @@ func TestPublishEventsWithNotExistingAsk(t *testing.T) { } func TestPublishEventsCorrectly(t *testing.T) { - conf.GetSchedulerConf().SetTestMode(true) recorder, ok := events.GetRecorder().(*k8sEvents.FakeRecorder) if !ok { t.Fatal("the EventRecorder is expected to be of type FakeRecorder") diff --git a/pkg/cache/metadata_test.go b/pkg/cache/metadata_test.go index d4760e2d1..b5d45e050 100644 --- a/pkg/cache/metadata_test.go +++ b/pkg/cache/metadata_test.go @@ -107,8 +107,6 @@ func TestGetTaskMetadata(t *testing.T) { } func TestGetAppMetadata(t *testing.T) { //nolint:funlen - conf.GetSchedulerConf().SetTestMode(true) - defer utils.SetPluginMode(false) defer func() { conf.GetSchedulerConf().GenerateUniqueAppIds = false }() utils.SetPluginMode(false) diff --git a/pkg/cache/task_test.go b/pkg/cache/task_test.go index d1fcc3369..864cd7e87 100644 --- a/pkg/cache/task_test.go +++ b/pkg/cache/task_test.go @@ -34,7 +34,6 @@ import ( "github.com/apache/yunikorn-k8shim/pkg/common/constants" "github.com/apache/yunikorn-k8shim/pkg/common/events" "github.com/apache/yunikorn-k8shim/pkg/common/utils" - "github.com/apache/yunikorn-k8shim/pkg/conf" "github.com/apache/yunikorn-k8shim/pkg/locking" "github.com/apache/yunikorn-scheduler-interface/lib/go/si" @@ -521,7 +520,6 @@ func TestHandleSubmitTaskEvent(t *testing.T) { time: int64(0), lock: &locking.RWMutex{}, } - conf.GetSchedulerConf().SetTestMode(true) mr := events.NewMockedRecorder() mr.OnEventf = func() { rt.lock.Lock() @@ -621,7 +619,6 @@ func TestSimultaneousTaskCompleteAndAllocate(t *testing.T) { mockedAPIProvider, ok := mockedContext.apiProvider.(*client.MockedAPIProvider) assert.Equal(t, ok, true) - conf.GetSchedulerConf().SetTestMode(true) resources := make(map[v1.ResourceName]resource.Quantity) containers := make([]v1.Container, 0) containers = append(containers, v1.Container{ diff --git a/pkg/conf/schedulerconf.go b/pkg/conf/schedulerconf.go index 2e941213c..54a500a89 100644 --- a/pkg/conf/schedulerconf.go +++ b/pkg/conf/schedulerconf.go @@ -117,7 +117,6 @@ type SchedulerConf struct { Interval time.Duration `json:"schedulingIntervalSecond"` KubeConfig string `json:"absoluteKubeConfigFilePath"` VolumeBindTimeout time.Duration `json:"volumeBindTimeout"` - TestMode bool `json:"testMode"` EventChannelCapacity int `json:"eventChannelCapacity"` DispatchTimeout time.Duration `json:"dispatchTimeout"` KubeQPS int `json:"kubeQPS"` @@ -145,7 +144,6 @@ func (conf *SchedulerConf) Clone() *SchedulerConf { Interval: conf.Interval, KubeConfig: conf.KubeConfig, VolumeBindTimeout: conf.VolumeBindTimeout, - TestMode: conf.TestMode, EventChannelCapacity: conf.EventChannelCapacity, DispatchTimeout: conf.DispatchTimeout, KubeQPS: conf.KubeQPS, @@ -257,18 +255,6 @@ func SetSchedulerConf(conf *SchedulerConf) { confHolder.Store(conf) } -func (conf *SchedulerConf) SetTestMode(testMode bool) { - conf.Lock() - defer conf.Unlock() - conf.TestMode = testMode -} - -func (conf *SchedulerConf) IsTestMode() bool { - conf.RLock() - defer conf.RUnlock() - return conf.TestMode -} - func (conf *SchedulerConf) IsConfigReloadable() bool { conf.RLock() defer conf.RUnlock() @@ -321,7 +307,6 @@ func CreateDefaultConfig() *SchedulerConf { Interval: DefaultSchedulingInterval, KubeConfig: GetDefaultKubeConfigPath(), VolumeBindTimeout: DefaultVolumeBindTimeout, - TestMode: false, EventChannelCapacity: DefaultEventChannelCapacity, DispatchTimeout: DefaultDispatchTimeout, KubeQPS: DefaultKubeQPS, diff --git a/pkg/plugin/predicates/predicate_manager_test.go b/pkg/plugin/predicates/predicate_manager_test.go index fe17db7a8..9e87c91d4 100644 --- a/pkg/plugin/predicates/predicate_manager_test.go +++ b/pkg/plugin/predicates/predicate_manager_test.go @@ -45,7 +45,6 @@ import ( "k8s.io/kubernetes/pkg/util/taints" "github.com/apache/yunikorn-k8shim/pkg/client" - "github.com/apache/yunikorn-k8shim/pkg/conf" "github.com/apache/yunikorn-k8shim/pkg/log" "github.com/apache/yunikorn-k8shim/pkg/plugin/support" ) @@ -56,7 +55,6 @@ var ( ) func TestPreemptionPredicatesEmpty(t *testing.T) { - conf.GetSchedulerConf().SetTestMode(true) clientSet := clientSet() informerFactory := informerFactory(clientSet) lister := lister() @@ -74,7 +72,6 @@ func TestPreemptionPredicatesEmpty(t *testing.T) { } func TestPreemptionPredicates(t *testing.T) { - conf.GetSchedulerConf().SetTestMode(true) clientSet := clientSet() informerFactory := informerFactory(clientSet) lister := lister() @@ -127,7 +124,6 @@ func TestPreemptionPredicates(t *testing.T) { } func TestEventsToRegister(t *testing.T) { - conf.GetSchedulerConf().SetTestMode(true) clientSet := clientSet() informerFactory := informerFactory(clientSet) lister := lister() @@ -154,7 +150,6 @@ func TestEventsToRegister(t *testing.T) { } func TestPodFitsHost(t *testing.T) { - conf.GetSchedulerConf().SetTestMode(true) clientSet := clientSet() informerFactory := informerFactory(clientSet) lister := lister() diff --git a/pkg/shim/scheduler_mock_test.go b/pkg/shim/scheduler_mock_test.go index b67746d72..1c3f3f36f 100644 --- a/pkg/shim/scheduler_mock_test.go +++ b/pkg/shim/scheduler_mock_test.go @@ -59,7 +59,6 @@ type MockScheduler struct { } func (fc *MockScheduler) init() { - conf.GetSchedulerConf().SetTestMode(true) fc.stopChan = make(chan struct{}) serviceContext := entrypoint.StartAllServices() fc.rmProxy = serviceContext.RMProxy