Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yangwwei committed Jan 13, 2021
1 parent 7375fb4 commit 4314d00
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pkg/cache/application_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,4 @@ func (re ReleaseAppAllocationEvent) GetArgs() []interface{} {

func (re ReleaseAppAllocationEvent) GetEvent() events.ApplicationEventType {
return re.event
}
}
2 changes: 1 addition & 1 deletion pkg/cache/placeholder.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func newPlaceholder(placeholderName string, app *Application, taskGroup v1alpha1
},
Annotations: map[string]string{
constants.AnnotationPlaceholderFlag: "true",
constants.AnnotationTaskGroupName: taskGroup.Name,
constants.AnnotationTaskGroupName: taskGroup.Name,
},
},
Spec: v1.PodSpec{
Expand Down
7 changes: 0 additions & 7 deletions pkg/cache/placeholder_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,6 @@ func (mgr *PlaceholderManager) CleanUp(app *Application) {
zap.String("appID", app.GetApplicationID()))
}

// this is only used in testing
func (mgr *PlaceholderManager) setMockedClients(mockedClients *client.Clients) {
mgr.Lock()
defer mgr.Unlock()
mgr.clients = mockedClients
}

func (mgr *PlaceholderManager) cleanOrphanPlaceholders() {
mgr.Lock()
defer mgr.Unlock()
Expand Down
16 changes: 8 additions & 8 deletions pkg/cache/placeholder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ func TestNewPlaceholderWithNodeSelectors(t *testing.T) {
"memory": resource.MustParse("1024M"),
},
NodeSelector: map[string]string{
"nodeType": "test",
"nodeType": "test",
"nodeState": "healthy",
},
},
})

holder := newPlaceholder("ph-name", app, app.taskGroups[0])
assert.Equal(t, len(holder.pod.Spec.NodeSelector), 2)
assert.Equal(t, holder.pod.Spec.NodeSelector["nodeType"], "test")
assert.Equal(t, holder.pod.Spec.NodeSelector["nodeState"], "healthy")
assert.Equal(t, holder.pod.Spec.NodeSelector["nodeType"], "test")
assert.Equal(t, holder.pod.Spec.NodeSelector["nodeState"], "healthy")
}

func TestNewPlaceholderWithTolerations(t *testing.T) {
Expand All @@ -115,12 +115,12 @@ func TestNewPlaceholderWithTolerations(t *testing.T) {
"cpu": resource.MustParse("500m"),
"memory": resource.MustParse("1024M"),
},
Tolerations: []v1.Toleration {
Tolerations: []v1.Toleration{
{
Key: "key1",
Key: "key1",
Operator: v1.TolerationOpEqual,
Value: "value1",
Effect: v1.TaintEffectNoSchedule,
Value: "value1",
Effect: v1.TaintEffectNoSchedule,
},
},
},
Expand All @@ -129,7 +129,7 @@ func TestNewPlaceholderWithTolerations(t *testing.T) {
holder := newPlaceholder("ph-name", app, app.taskGroups[0])
assert.Equal(t, len(holder.pod.Spec.Tolerations), 1)
tlr := holder.pod.Spec.Tolerations[0]
assert.Equal(t, tlr.Key, "key1")
assert.Equal(t, tlr.Key, "key1")
assert.Equal(t, tlr.Value, "value1")
assert.Equal(t, tlr.Operator, v1.TolerationOpEqual)
assert.Equal(t, tlr.Effect, v1.TaintEffectNoSchedule)
Expand Down
3 changes: 1 addition & 2 deletions pkg/cache/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
"sync"
"time"

"github.com/apache/incubator-yunikorn-k8shim/pkg/appmgmt/interfaces"
"go.uber.org/zap"

"github.com/apache/incubator-yunikorn-k8shim/pkg/appmgmt/interfaces"
"github.com/apache/incubator-yunikorn-k8shim/pkg/common"
"github.com/apache/incubator-yunikorn-k8shim/pkg/common/events"
"github.com/apache/incubator-yunikorn-k8shim/pkg/common/utils"
Expand Down Expand Up @@ -55,7 +55,6 @@ type Task struct {
lock *sync.RWMutex
}

// TODO to be removed
func NewTask(tid string, app *Application, ctx *Context, pod *v1.Pod) *Task {
taskResource := common.GetPodResource(pod)
return createTaskInternal(tid, app, taskResource, pod, false, "", ctx)
Expand Down
2 changes: 1 addition & 1 deletion pkg/common/si_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func CreateReleaseAskRequestForTask(appID, taskId, partition string) si.UpdateRe
return result
}

func GetTerminationTypeFromString(terminationTypeStr string) si.AllocationRelease_TerminationType{
func GetTerminationTypeFromString(terminationTypeStr string) si.AllocationRelease_TerminationType {
if v, ok := si.AllocationRelease_TerminationType_value[terminationTypeStr]; ok {
return si.AllocationRelease_TerminationType(v)
}
Expand Down

0 comments on commit 4314d00

Please sign in to comment.