Skip to content

Commit

Permalink
[YUNIKORN-500] fix UT failures
Browse files Browse the repository at this point in the history
  • Loading branch information
yangwwei committed Jan 7, 2021
1 parent 99776be commit 132fdae
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ go 1.12
require (
github.com/GoogleCloudPlatform/spark-on-k8s-operator v0.0.0-20200817155620-c19d2b8660d8
github.com/apache/incubator-yunikorn-core v0.0.0-20210106054125-dcf631d5c6b5
github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20201215141356-df4d86d2197b
github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20210106054514-49c4f33ed27b
github.com/google/uuid v1.1.1
github.com/gorilla/mux v1.7.3
github.com/looplab/fsm v0.1.0
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ github.com/apache/incubator-yunikorn-core v0.0.0-20201218082332-5471d84cd619 h1:
github.com/apache/incubator-yunikorn-core v0.0.0-20201218082332-5471d84cd619/go.mod h1:d/fn47kdGd094NHiysHAY+0d4evpYRFQ6q5b9eaBONo=
github.com/apache/incubator-yunikorn-core v0.0.0-20210106054125-dcf631d5c6b5 h1:1cDvDjyqKce4U+Zvj7bmPSxU2ok1e+ynJsarFcp+JwQ=
github.com/apache/incubator-yunikorn-core v0.0.0-20210106054125-dcf631d5c6b5/go.mod h1:d/fn47kdGd094NHiysHAY+0d4evpYRFQ6q5b9eaBONo=
github.com/apache/incubator-yunikorn-scheduler-interface v0.0.0-20210106054514-49c4f33ed27b/go.mod h1:ObMs03XFbnmpGD81jYvdUDEVZbHvz8W6dWH5nGDCjc0=
github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20200901200728-b9033558f319 h1:I12nCcXdHe6W4oysVejFHfQDy0Ix0r+ZHdfooyEoldo=
github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20200901200728-b9033558f319/go.mod h1:ObMs03XFbnmpGD81jYvdUDEVZbHvz8W6dWH5nGDCjc0=
github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20201215141356-df4d86d2197b h1:dxncLtkTwtqUB6pgsVVw52+Ni3ZXG2BPnLrSrubcRZA=
github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20201215141356-df4d86d2197b/go.mod h1:ObMs03XFbnmpGD81jYvdUDEVZbHvz8W6dWH5nGDCjc0=
github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20210106054514-49c4f33ed27b h1:er61fRzIZuWejT9vUsHvb3ZyilJt6QCY7ZFdlAmVm7w=
github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20210106054514-49c4f33ed27b/go.mod h1:ObMs03XFbnmpGD81jYvdUDEVZbHvz8W6dWH5nGDCjc0=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
Expand Down
4 changes: 3 additions & 1 deletion pkg/cache/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ func TestTryReserve(t *testing.T) {
createdPods.add(pod)
return pod, nil
})
GetPlaceholderManager().setMockedClients(mockedAPIProvider.GetAPIs())
mgr := NewPlaceholderManager(mockedAPIProvider.GetAPIs())
mgr.Start()
defer mgr.Stop()

// create a new app
app := NewApplication("app00001", "root.abc", "test-user",
Expand Down
2 changes: 1 addition & 1 deletion pkg/cache/placeholder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestNewPlaceholder(t *testing.T) {
assert.Equal(t, len(holder.pod.Labels), 2)
assert.Equal(t, holder.pod.Labels[constants.LabelApplicationID], appID)
assert.Equal(t, holder.pod.Labels[constants.LabelQueueName], queue)
assert.Equal(t, len(holder.pod.Annotations), 1)
assert.Equal(t, len(holder.pod.Annotations), 2)
assert.Equal(t, holder.pod.Annotations[constants.AnnotationTaskGroupName], app.taskGroups[0].Name)
assert.Equal(t, common.GetPodResource(holder.pod).Resources[constants.CPU].Value, int64(500))
assert.Equal(t, common.GetPodResource(holder.pod).Resources[constants.Memory].Value, int64(1024))
Expand Down
2 changes: 1 addition & 1 deletion pkg/common/si_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

func TestCreateReleaseAllocationRequest(t *testing.T) {
request := CreateReleaseAllocationRequestForTask("app01", "alloc01", "default")
request := CreateReleaseAllocationRequestForTask("app01", "alloc01", "default", "STOPPED_BY_RM")
assert.Assert(t, request.Releases != nil)
assert.Assert(t, request.Releases.AllocationsToRelease != nil)
assert.Assert(t, request.Releases.AllocationAsksToRelease == nil)
Expand Down
4 changes: 4 additions & 0 deletions pkg/shim/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ func (ss *KubernetesShim) run() {
}

ss.apiFactory.Start()

// run the placeholder manager
placeholderMgr := cache.NewPlaceholderManager(ss.apiFactory.GetAPIs())
placeholderMgr.Start()
}

func (ss *KubernetesShim) enterState(event *fsm.Event) {
Expand Down

0 comments on commit 132fdae

Please sign in to comment.