Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
Signed-off-by: Zhang Kang <kang.zhang@intel.com>
  • Loading branch information
kangclzjc committed Jul 3, 2024
1 parent 40f1cf6 commit 8235621
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pkg/koordlet/runtimehooks/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package runtimehooks

import (
"flag"
"github.com/koordinator-sh/koordinator/pkg/koordlet/runtimehooks/hooks/resctrl"
"math"
"time"

Expand All @@ -33,6 +32,7 @@ import (
"github.com/koordinator-sh/koordinator/pkg/koordlet/runtimehooks/hooks/cpuset"
"github.com/koordinator-sh/koordinator/pkg/koordlet/runtimehooks/hooks/gpu"
"github.com/koordinator-sh/koordinator/pkg/koordlet/runtimehooks/hooks/groupidentity"
"github.com/koordinator-sh/koordinator/pkg/koordlet/runtimehooks/hooks/resctrl"
"github.com/koordinator-sh/koordinator/pkg/koordlet/runtimehooks/hooks/terwayqos"
"github.com/koordinator-sh/koordinator/pkg/koordlet/util/system"
)
Expand Down
24 changes: 7 additions & 17 deletions pkg/koordlet/util/resctrl/ctrl_mgr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ package resctrl

import (
"fmt"
"github.com/koordinator-sh/koordinator/pkg/koordlet/runtimehooks/protocol"
"github.com/koordinator-sh/koordinator/pkg/koordlet/util/system"
gocache "github.com/patrickmn/go-cache"
"github.com/stretchr/testify/assert"
"os"
"path/filepath"
"reflect"
"sync"
"testing"
"time"

gocache "github.com/patrickmn/go-cache"
"github.com/stretchr/testify/assert"

"github.com/koordinator-sh/koordinator/pkg/koordlet/runtimehooks/protocol"
"github.com/koordinator-sh/koordinator/pkg/koordlet/util/system"
)

type UpdateFunc func(resource ResctrlUpdater) error
Expand Down Expand Up @@ -102,7 +103,6 @@ func TestControlGroupManager_AddPod(t *testing.T) {
type fields struct {
rdtcgs *gocache.Cache
reconcileInterval int64
Mutex sync.Mutex
groupExist bool
}
type args struct {
Expand All @@ -122,7 +122,6 @@ func TestControlGroupManager_AddPod(t *testing.T) {
fields: fields{
rdtcgs: gocache.New(time.Duration(ExpirationTime), CleanupInterval),
reconcileInterval: 0,
Mutex: sync.Mutex{},
groupExist: false,
},
args: args{
Expand All @@ -138,7 +137,6 @@ func TestControlGroupManager_AddPod(t *testing.T) {
fields: fields{
rdtcgs: gocache.New(time.Duration(ExpirationTime), CleanupInterval),
reconcileInterval: 0,
Mutex: sync.Mutex{},
groupExist: true,
},
args: args{
Expand All @@ -154,7 +152,6 @@ func TestControlGroupManager_AddPod(t *testing.T) {
fields: fields{
rdtcgs: gocache.New(time.Duration(ExpirationTime), CleanupInterval),
reconcileInterval: 0,
Mutex: sync.Mutex{},
groupExist: false,
},
args: args{
Expand All @@ -170,7 +167,6 @@ func TestControlGroupManager_AddPod(t *testing.T) {
fields: fields{
rdtcgs: gocache.New(time.Duration(ExpirationTime), CleanupInterval),
reconcileInterval: 0,
Mutex: sync.Mutex{},
groupExist: true,
},
args: args{
Expand All @@ -187,7 +183,6 @@ func TestControlGroupManager_AddPod(t *testing.T) {
c := &ControlGroupManager{
rdtcgs: tt.fields.rdtcgs,
reconcileInterval: tt.fields.reconcileInterval,
Mutex: tt.fields.Mutex,
}
// prepare ctrl group if group exist
if tt.fields.groupExist {
Expand Down Expand Up @@ -262,7 +257,6 @@ func TestControlGroupManager_Init(t *testing.T) {
type fields struct {
rdtcgs *gocache.Cache
reconcileInterval int64
Mutex sync.Mutex
schemataData []string
mockSchemata string
}
Expand All @@ -275,7 +269,6 @@ func TestControlGroupManager_Init(t *testing.T) {
fields: fields{
rdtcgs: gocache.New(time.Duration(ExpirationTime), CleanupInterval),
reconcileInterval: 0,
Mutex: sync.Mutex{},
schemataData: []string{"L3:0=f0\nMB:0=100", "L3:0=fc\nMB:0=100"},
mockSchemata: "L3:0=ff\nMB:0=100\n",
},
Expand All @@ -293,7 +286,6 @@ func TestControlGroupManager_Init(t *testing.T) {
c := &ControlGroupManager{
rdtcgs: tt.fields.rdtcgs,
reconcileInterval: tt.fields.reconcileInterval,
Mutex: tt.fields.Mutex,
}
c.Init()
p, ok := c.rdtcgs.Get("pod1")
Expand All @@ -315,7 +307,6 @@ func TestControlGroupManager_RemovePod(t *testing.T) {
type fields struct {
rdtcgs *gocache.Cache
reconcileInterval int64
Mutex sync.Mutex
}
type args struct {
podid string
Expand All @@ -333,16 +324,15 @@ func TestControlGroupManager_RemovePod(t *testing.T) {
fields: fields{
rdtcgs: gocache.New(time.Duration(ExpirationTime), CleanupInterval),
reconcileInterval: 0,
Mutex: sync.Mutex{},
},
want: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
c := &ControlGroupManager{
rdtcgs: tt.fields.rdtcgs,
reconcileInterval: tt.fields.reconcileInterval,
Mutex: tt.fields.Mutex,
}
if got := c.RemovePod(tt.args.podid, tt.args.fromNRI, tt.args.removeUpdater); got != tt.want {
t.Errorf("RemovePod() = %v, want %v", got, tt.want)
Expand Down

0 comments on commit 8235621

Please sign in to comment.