This is an automated email from the ASF dual-hosted git repository.

pbacsko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-k8shim.git


The following commit(s) were added to refs/heads/master by this push:
     new 32903ff5 [YUNIKORN-2845] Remove SchedulerConf.TestMode (#923)
32903ff5 is described below

commit 32903ff5804085199001c6fa763fdbbee6e7475e
Author: Peter Bacsko <[email protected]>
AuthorDate: Wed Oct 9 18:55:44 2024 +0200

    [YUNIKORN-2845] Remove SchedulerConf.TestMode (#923)
    
    Closes: #923
    
    Signed-off-by: Peter Bacsko <[email protected]>
---
 pkg/cache/application_test.go                   |  7 -------
 pkg/cache/context_test.go                       |  7 -------
 pkg/cache/metadata_test.go                      |  2 --
 pkg/cache/task_test.go                          |  3 ---
 pkg/conf/schedulerconf.go                       | 15 ---------------
 pkg/plugin/predicates/predicate_manager_test.go |  5 -----
 pkg/shim/scheduler_mock_test.go                 |  1 -
 7 files changed, 40 deletions(-)

diff --git a/pkg/cache/application_test.go b/pkg/cache/application_test.go
index da6f085d..8f52f33d 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 6d7bfafa..b5098872 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 d4760e2d..b5d45e05 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 d1fcc336..864cd7e8 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 2e941213..54a500a8 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 fe17db7a..9e87c91d 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 b67746d7..1c3f3f36 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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to