Skip to content

Commit

Permalink
e2e: update slot resource
Browse files Browse the repository at this point in the history
    update slot resources

Signed-off-by: alcorj.mizar <[email protected]>
  • Loading branch information
alcorj-mizar committed Jul 2, 2020
1 parent 8d93ba2 commit 7811052
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 3 additions & 5 deletions test/e2e/job_scheduling.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,13 @@ var _ = Describe("Job E2E Test", func() {
ctx := initTestContext(options{
queues: []string{q2},
nodesNumLimit: 3,
nodesResourceLimit: v1.ResourceList{"cpu": resource.MustParse("1500m"), "memory": resource.MustParse("1224Mi")},
nodesResourceLimit: v1.ResourceList{"cpu": resource.MustParse("1500m"), "memory": resource.MustParse("1536Mi")},
})

defer cleanupTestContext(ctx)

slot1 := v1.ResourceList{"cpu": resource.MustParse("1500m"), "memory": resource.MustParse("1224Mi")}
slot2 := v1.ResourceList{"cpu": resource.MustParse("750m"), "memory": resource.MustParse("612Mi")}
slot1 := v1.ResourceList{"cpu": resource.MustParse("1500m"), "memory": resource.MustParse("1536Mi")}
slot2 := v1.ResourceList{"cpu": resource.MustParse("750m"), "memory": resource.MustParse("768Mi")}
jobSpec1 := &jobSpec{
tasks: []taskSpec{
{
Expand Down Expand Up @@ -326,8 +326,6 @@ var _ = Describe("Job E2E Test", func() {
jobSpec2.queue = q3
createJob(ctx, jobSpec2)

time.Sleep(60 * time.Second)

// Ensure job is running in q3
err := waitQueueStatus(func() (bool, error) {
queue, err := ctx.vcclient.SchedulingV1beta1().Queues().Get(context.TODO(), q3, metav1.GetOptions{})
Expand Down
7 changes: 5 additions & 2 deletions test/e2e/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,10 @@ func setPlaceHolderForSchedulerTesting(ctx *testContext, req v1.ResourceList, re
minMemoryValue := float64(minMemory.Value())
currentAllocatable := schedulerapi.NewResource(node.Status.Allocatable)

fmt.Println(node.Name))
fmt.Println(node.Status.Allocatable.Cpu())
fmt.Println(node.Status.Allocatable.Memory())

if res, found := used[node.Name]; found {
currentAllocatable.Sub(res)
}
Expand All @@ -980,7 +984,6 @@ func setPlaceHolderForSchedulerTesting(ctx *testContext, req v1.ResourceList, re
if minCPUMilli <= currentAllocatable.MilliCPU && minMemoryValue <= currentAllocatable.Memory {
resourceRichNode = resourceRichNode + 1
if resourceRichNode <= reqNum {
fmt.Println(resourceRichNode)
phCPU = currentAllocatable.MilliCPU - minCPUMilli
phMemory = currentAllocatable.Memory - minMemoryValue
}
Expand Down Expand Up @@ -1014,7 +1017,7 @@ func createPlaceHolder(ctx *testContext, phr v1.ResourceList, nodeName string) e
},
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
{
Name: "placeholder",
Resources: corev1.ResourceRequirements{
Requests: phr,
Expand Down

0 comments on commit 7811052

Please sign in to comment.