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-core.git
The following commit(s) were added to refs/heads/master by this push:
new 03c3ccce [YUNIKORN-2051] fix staticcheck errors (#680)
03c3ccce is described below
commit 03c3ccce0d618ba163e726515d0a3185f213a695
Author: PoAn Yang <[email protected]>
AuthorDate: Tue Oct 24 14:34:34 2023 +0200
[YUNIKORN-2051] fix staticcheck errors (#680)
Signed-off-by: PoAn Yang <[email protected]>
Closes: #680
Signed-off-by: Peter Bacsko <[email protected]>
---
pkg/common/configs/configvalidator.go | 9 ---------
pkg/rmproxy/rmproxy.go | 20 --------------------
pkg/scheduler/context_test.go | 6 ------
pkg/scheduler/health_checker.go | 2 --
pkg/scheduler/objects/sorters_test.go | 9 ---------
pkg/scheduler/partition.go | 4 ----
pkg/scheduler/partition_test.go | 1 +
pkg/scheduler/tests/operation_test.go | 4 ++--
pkg/scheduler/tests/recovery_test.go | 2 +-
pkg/webservice/handlers_test.go | 1 -
pkg/webservice/webservice.go | 2 --
11 files changed, 4 insertions(+), 56 deletions(-)
diff --git a/pkg/common/configs/configvalidator.go
b/pkg/common/configs/configvalidator.go
index 571e37b4..4065cf86 100644
--- a/pkg/common/configs/configvalidator.go
+++ b/pkg/common/configs/configvalidator.go
@@ -21,8 +21,6 @@ package configs
import (
"fmt"
"math"
- "os"
- "path/filepath"
"regexp"
"strings"
"time"
@@ -725,13 +723,6 @@ func checkDeprecatedStateDumpFilePath(partition
*PartitionConfig) error {
return nil
}
-func ensureDir(fileName string) error {
- if err := os.MkdirAll(filepath.Dir(fileName), os.ModePerm); err != nil {
- return err
- }
- return nil
-}
-
// Check the partition configuration. Any parsing issues will return an error
which means that the
// configuration is invalid. This *must* be called before the configuration is
activated. Any
// configuration that does not pass must be rejected.
diff --git a/pkg/rmproxy/rmproxy.go b/pkg/rmproxy/rmproxy.go
index 6a7501e2..97c4042c 100644
--- a/pkg/rmproxy/rmproxy.go
+++ b/pkg/rmproxy/rmproxy.go
@@ -407,23 +407,3 @@ func (rmp *RMProxy) UpdateConfiguration(request
*si.UpdateConfigurationRequest)
}
return nil
}
-
-// actual configuration reloader
-type configurationReloader struct {
- rmID string
- rmProxy *RMProxy
-}
-
-func (cr configurationReloader) DoReloadConfiguration() error {
- c := make(chan *rmevent.Result)
- cr.rmProxy.EventHandlers.SchedulerEventHandler.HandleEvent(
- &rmevent.RMConfigUpdateEvent{
- RmID: cr.rmID,
- Channel: c,
- })
- result := <-c
- if !result.Succeeded {
- return fmt.Errorf("failed to update configuration for RM %s,
result: %v", cr.rmID, result)
- }
- return nil
-}
diff --git a/pkg/scheduler/context_test.go b/pkg/scheduler/context_test.go
index e603bd9d..9023525b 100644
--- a/pkg/scheduler/context_test.go
+++ b/pkg/scheduler/context_test.go
@@ -51,12 +51,6 @@ func newMockEventHandler() *mockEventHandler {
}
}
-func (m *mockEventHandler) reset() {
- m.eventHandled = false
- m.rejectedNodes = make([]*si.RejectedNode, 0)
- m.acceptedNodes = make([]*si.AcceptedNode, 0)
-}
-
func (m *mockEventHandler) HandleEvent(ev interface{}) {
if nodeEvent, ok := ev.(*rmevent.RMNodeUpdateEvent); ok {
m.eventHandled = true
diff --git a/pkg/scheduler/health_checker.go b/pkg/scheduler/health_checker.go
index 0794adcb..4019a89c 100644
--- a/pkg/scheduler/health_checker.go
+++ b/pkg/scheduler/health_checker.go
@@ -33,8 +33,6 @@ import (
"github.com/apache/yunikorn-core/pkg/webservice/dao"
)
-const defaultPeriod = 30 * time.Second
-
type HealthChecker struct {
context *ClusterContext
confWatcherId string
diff --git a/pkg/scheduler/objects/sorters_test.go
b/pkg/scheduler/objects/sorters_test.go
index 3474f0a8..10ed5a6c 100644
--- a/pkg/scheduler/objects/sorters_test.go
+++ b/pkg/scheduler/objects/sorters_test.go
@@ -404,15 +404,6 @@ func assertAppList(t *testing.T, list []*Application,
place []int, name string)
assert.Equal(t, "app-3", list[place[3]].ApplicationID, "test name: %s",
name)
}
-// list of application and the location of the named applications inside that
list
-// place[0] defines the location of the app-0 in the list of applications
-func assertAskList(t *testing.T, list []*AllocationAsk, place []int, name
string) {
- assert.Equal(t, "ask-0", list[place[0]].GetAllocationKey(), "test name:
%s", name)
- assert.Equal(t, "ask-1", list[place[1]].GetAllocationKey(), "test name:
%s", name)
- assert.Equal(t, "ask-2", list[place[2]].GetAllocationKey(), "test name:
%s", name)
- assert.Equal(t, "ask-3", list[place[3]].GetAllocationKey(), "test name:
%s", name)
-}
-
func assertAppListLength(t *testing.T, list []*Application, apps []string,
name string) {
assert.Equal(t, len(apps), len(list), "length of list differs, test:
%s", name)
for i, app := range list {
diff --git a/pkg/scheduler/partition.go b/pkg/scheduler/partition.go
index e6d2cad7..81d09fc5 100644
--- a/pkg/scheduler/partition.go
+++ b/pkg/scheduler/partition.go
@@ -254,10 +254,6 @@ func (pc *PartitionContext) isDraining() bool {
return pc.stateMachine.Current() == objects.Draining.String()
}
-func (pc *PartitionContext) isRunning() bool {
- return pc.stateMachine.Current() == objects.Active.String()
-}
-
func (pc *PartitionContext) isStopped() bool {
return pc.stateMachine.Current() == objects.Stopped.String()
}
diff --git a/pkg/scheduler/partition_test.go b/pkg/scheduler/partition_test.go
index bc3f411d..186fa315 100644
--- a/pkg/scheduler/partition_test.go
+++ b/pkg/scheduler/partition_test.go
@@ -1168,6 +1168,7 @@ func TestRemoveAppAllocs(t *testing.T) {
ask := newAllocationAsk("alloc-nr", appNotRemoved, appRes)
alloc := objects.NewAllocation("alloc-nr-uuid", nodeID1, ask)
err = partition.addAllocation(alloc)
+ assert.NilError(t, err, "add allocation to partition should not have
failed")
assertLimits(t, getTestUserGroup(), appRes)
ask = newAllocationAsk("alloc-1", appNotRemoved, appRes)
diff --git a/pkg/scheduler/tests/operation_test.go
b/pkg/scheduler/tests/operation_test.go
index f2be70e1..1e7f94c7 100644
--- a/pkg/scheduler/tests/operation_test.go
+++ b/pkg/scheduler/tests/operation_test.go
@@ -68,7 +68,7 @@ partitions:
// Check scheduling queue a
queueA := part.GetQueue("root.a")
- assert.Assert(t, 150000000 ==
queueA.GetMaxResource().Resources[common.Memory])
+ assert.Equal(t, resources.Quantity(150000000),
queueA.GetMaxResource().Resources[common.Memory])
// Add one application
err = ms.proxy.UpdateApplication(&si.ApplicationRequest{
@@ -196,7 +196,7 @@ partitions:
// Check scheduling queue a
queueA := part.GetQueue("root.a")
- assert.Assert(t, 150000000 ==
queueA.GetMaxResource().Resources[common.Memory])
+ assert.Equal(t, resources.Quantity(150000000),
queueA.GetMaxResource().Resources[common.Memory])
// Add one application
err = ms.proxy.UpdateApplication(&si.ApplicationRequest{
diff --git a/pkg/scheduler/tests/recovery_test.go
b/pkg/scheduler/tests/recovery_test.go
index 81415a63..94aba2f1 100644
--- a/pkg/scheduler/tests/recovery_test.go
+++ b/pkg/scheduler/tests/recovery_test.go
@@ -71,7 +71,7 @@ func TestSchedulerRecovery(t *testing.T) {
// Check scheduling queue a
queue := part.GetQueue("root.a")
- assert.Assert(t, 150 == queue.GetMaxResource().Resources[common.Memory])
+ assert.Equal(t, resources.Quantity(150),
queue.GetMaxResource().Resources[common.Memory])
// Register nodes, and add apps
err = ms.proxy.UpdateNode(&si.NodeRequest{
diff --git a/pkg/webservice/handlers_test.go b/pkg/webservice/handlers_test.go
index e4e50bfd..be4166ff 100644
--- a/pkg/webservice/handlers_test.go
+++ b/pkg/webservice/handlers_test.go
@@ -255,7 +255,6 @@ const rmID = "rm-123"
const policyGroup = "default-policy-group"
const queueName = "root.default"
const nodeID = "node-1"
-const instType = "itype-1"
var (
updatedExtraConf = map[string]string{
diff --git a/pkg/webservice/webservice.go b/pkg/webservice/webservice.go
index 05e56eca..ed5cef87 100644
--- a/pkg/webservice/webservice.go
+++ b/pkg/webservice/webservice.go
@@ -21,7 +21,6 @@ package webservice
import (
"context"
"net/http"
- "sync"
"time"
"github.com/julienschmidt/httprouter"
@@ -34,7 +33,6 @@ import (
)
var imHistory *history.InternalMetricsHistory
-var lock sync.RWMutex
var schedulerContext *scheduler.ClusterContext
type WebService struct {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]