volcano.sh/volcano@v1.9.0/test/e2e/schedulingbase/drf.go (about) 1 /* 2 Copyright 2021 The Volcano Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package schedulingbase 18 19 import ( 20 . "github.com/onsi/ginkgo/v2" 21 . "github.com/onsi/gomega" 22 23 e2eutil "volcano.sh/volcano/test/e2e/util" 24 ) 25 26 var _ = Describe("DRF Test", func() { 27 It("drf works", func() { 28 Skip("Failed when add yaml, test case may fail in some condition") 29 ctx := e2eutil.InitTestContext(e2eutil.Options{}) 30 defer e2eutil.CleanupTestContext(ctx) 31 32 slot := e2eutil.OneCPU 33 rep := e2eutil.ClusterSize(ctx, slot) 34 job := &e2eutil.JobSpec{ 35 Tasks: []e2eutil.TaskSpec{ 36 { 37 Img: e2eutil.DefaultNginxImage, 38 Req: slot, 39 Min: rep, 40 Rep: rep, 41 }, 42 }, 43 } 44 // tasks in j1-reference take all the cluster resource 45 // each replicas request 1 CPU 46 job.Name = "j1-reference" 47 referenceJob := e2eutil.CreateJob(ctx, job) 48 err := e2eutil.WaitTasksReady(ctx, referenceJob, int(rep)) 49 Expect(err).NotTo(HaveOccurred()) 50 51 // tasks in j2-drf request half of the cluster resource 52 // each replicas request 0.5 CPU 53 // drf works to make j2-drf preempt the cluster resource 54 job.Name = "j2-drf" 55 job.Tasks[0].Req = e2eutil.HalfCPU 56 backfillJob := e2eutil.CreateJob(ctx, job) 57 err = e2eutil.WaitTasksReady(ctx, backfillJob, int(rep)) 58 Expect(err).NotTo(HaveOccurred()) 59 }) 60 })