Skip to content

Commit

Permalink
[test/integration] Adapt to new preemption scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
trasc committed Sep 15, 2023
1 parent 040acf5 commit fdc606b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ var _ = ginkgo.Describe("Job controller interacting with scheduler", ginkgo.Orde
highPriorityClass := testing.MakePriorityClass("high").PriorityValue(100).Obj()
gomega.Expect(k8sClient.Create(ctx, highPriorityClass))
ginkgo.DeferCleanup(func() {
gomega.Expect(k8sClient.Delete(ctx, highPriorityClass)).To(gomega.Succeed())
gomega.Eventually(func() error { return k8sClient.Delete(ctx, highPriorityClass) }, util.Timeout, util.Interval).Should(gomega.Succeed())
})

lowJobKey := types.NamespacedName{Name: "low", Namespace: ns.Name}
Expand Down
13 changes: 1 addition & 12 deletions test/integration/scheduler/preemption_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,18 +337,7 @@ var _ = ginkgo.Describe("Preemption", func() {
gomega.Expect(k8sClient.Create(ctx, alphaMidWl)).To(gomega.Succeed())
gomega.Expect(k8sClient.Create(ctx, gammaMidWl)).To(gomega.Succeed())

// since the two pending workloads are not aware of each other both of them
// will request the eviction of betaMidWl only
util.FinishEvictionForWorkloads(ctx, k8sClient, betaMidWl)

// one of alpha-mid and gamma-mid should be admitted
gomega.Eventually(func() []*kueue.Workload { return util.FilterAdmittedWorkloads(ctx, k8sClient, alphaMidWl, gammaMidWl) }, util.Interval*4, util.Interval).Should(gomega.HaveLen(1))

// betaHighWl remains admitted
util.ExpectWorkloadsToHaveQuotaReservation(ctx, k8sClient, betaCQ.Name, betaHighWl)

// the last one should request the preemption of betaHighWl
util.FinishEvictionForWorkloads(ctx, k8sClient, betaHighWl)
util.FinishEvictionForWorkloads(ctx, k8sClient, betaMidWl, betaHighWl)

util.ExpectWorkloadsToHaveQuotaReservation(ctx, k8sClient, alphaCQ.Name, alphaMidWl)
util.ExpectWorkloadsToHaveQuotaReservation(ctx, k8sClient, gammaCQ.Name, gammaMidWl)
Expand Down
12 changes: 0 additions & 12 deletions test/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,6 @@ func ExpectWorkloadsToHaveQuotaReservation(ctx context.Context, k8sClient client
}, Timeout, Interval).Should(gomega.Equal(len(wls)), "Not enough workloads were admitted")
}

func FilterAdmittedWorkloads(ctx context.Context, k8sClient client.Client, wls ...*kueue.Workload) []*kueue.Workload {
ret := make([]*kueue.Workload, 0, len(wls))
var updatedWorkload kueue.Workload
for _, wl := range wls {
err := k8sClient.Get(ctx, client.ObjectKeyFromObject(wl), &updatedWorkload)
if err == nil && workload.HasQuotaReservation(&updatedWorkload) {
ret = append(ret, wl)
}
}
return ret
}

func ExpectWorkloadsToBePending(ctx context.Context, k8sClient client.Client, wls ...*kueue.Workload) {
gomega.EventuallyWithOffset(1, func() int {
pending := 0
Expand Down

0 comments on commit fdc606b

Please sign in to comment.