From 100bbea41d47a9e3c2dc23ec414ec090c3de2b72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ne=C4=8Das?= Date: Wed, 9 Oct 2024 10:16:29 +0200 Subject: [PATCH] Fix VMware scheduler test (#1094) Now we allow migrating with more disks than the MaxInFlight in case there is no VM being migrated at that time. This is done for the user's convenience. Related to: https://github.com/kubev2v/forklift/pull/1087 Signed-off-by: Martin Necas --- pkg/controller/plan/scheduler/vsphere/scheduler.go | 4 ++-- pkg/controller/plan/scheduler/vsphere/scheduler_test.go | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/controller/plan/scheduler/vsphere/scheduler.go b/pkg/controller/plan/scheduler/vsphere/scheduler.go index 6d59be80b..82cb722b8 100644 --- a/pkg/controller/plan/scheduler/vsphere/scheduler.go +++ b/pkg/controller/plan/scheduler/vsphere/scheduler.go @@ -226,9 +226,9 @@ func (r *Scheduler) cost(vm *model.VM, vmStatus *plan.VMStatus) int { func (r *Scheduler) finishedDisks(vmStatus *plan.VMStatus) int { var resp = 0 for _, step := range vmStatus.Pipeline { - if step.Name == "DiskTransfer" { + if step.Name == DiskTransfer { for _, task := range step.Tasks { - if task.Phase == "Completed" { + if task.Phase == Completed { resp += 1 } } diff --git a/pkg/controller/plan/scheduler/vsphere/scheduler_test.go b/pkg/controller/plan/scheduler/vsphere/scheduler_test.go index ffeef6fdc..8cba74b0b 100644 --- a/pkg/controller/plan/scheduler/vsphere/scheduler_test.go +++ b/pkg/controller/plan/scheduler/vsphere/scheduler_test.go @@ -83,6 +83,9 @@ func TestScheduler(t *testing.T) { }, }, hostC: { + { + cost: 11, + }, { cost: 1, },