diff --git a/testsupport/wait/member.go b/testsupport/wait/member.go index 502477877..4d9b582f9 100644 --- a/testsupport/wait/member.go +++ b/testsupport/wait/member.go @@ -2577,82 +2577,3 @@ containers: } return value } - -// VMWaitCriterion a struct to compare with a given VirtualMachine -// type VMWaitCriterion struct { -// Match func(*vmapiv1.VirtualMachine) bool -// Diff func(*vmapiv1.VirtualMachine) string -// } - -// func matchVMWaitCriterion(actual *vmapiv1.VirtualMachine, criteria ...VMWaitCriterion) bool { -// for _, c := range criteria { -// if !c.Match(actual) { -// return false -// } -// } -// return true -// } - -// func (a *MemberAwaitility) printVMWaitCriterionDiffs(t *testing.T, actual *vmapiv1.VirtualMachine, criteria ...VMWaitCriterion) { -// buf := &strings.Builder{} -// if actual == nil { -// buf.WriteString("failed to find VirtualMachine\n") -// buf.WriteString(a.listAndReturnContent("VirtualMachine", a.Namespace, &vmapiv1.VirtualMachineList{})) -// } else { -// buf.WriteString("failed to find VirtualMachine with matching criteria:\n") -// buf.WriteString("----\n") -// buf.WriteString("actual:\n") -// y, _ := StringifyObject(actual) -// buf.Write(y) -// buf.WriteString("\n----\n") -// buf.WriteString("diffs:\n") -// for _, c := range criteria { -// if !c.Match(actual) && c.Diff != nil { -// buf.WriteString(c.Diff(actual)) -// buf.WriteString("\n") -// } -// } -// } -// t.Log(buf.String()) -// } - -// // UntilVMHasLimits returns a `VMWaitCriterion` which checks that the given -// // VirtualMachine has limits set matching the given resources -// func UntilVMHasLimits(resources v1.ResourceList) VMWaitCriterion { -// return VMWaitCriterion{ -// Match: func(actual *vmapiv1.VirtualMachine) bool { -// return reflect.DeepEqual(actual.Spec.Template.Spec.Domain.Resources.Limits, resources) -// }, -// } -// } - -// // UntilVMHasRequests returns a `VMWaitCriterion` which checks that the given -// // VirtualMachine has requests set matching the given resources -// func UntilVMHasRequests(resources v1.ResourceList) VMWaitCriterion { -// return VMWaitCriterion{ -// Match: func(actual *vmapiv1.VirtualMachine) bool { -// return reflect.DeepEqual(actual.Spec.Template.Spec.Domain.Resources.Requests, resources) -// }, -// } -// } - -// // WaitForVM waits until there is a VirtualMachine available with the given name, expected spec and the set of wait criteria (if any) -// func (a *MemberAwaitility) WaitForVM(t *testing.T, name, namespace string, criteria ...VMWaitCriterion) (*vmapiv1.VirtualMachine, error) { -// var vm *vmapiv1.VirtualMachine -// err := wait.Poll(a.RetryInterval, a.Timeout, func() (done bool, err error) { -// obj := &vmapiv1.VirtualMachine{} -// if err := a.Client.Get(context.TODO(), types.NamespacedName{Namespace: namespace, Name: name}, obj); err != nil { -// if errors.IsNotFound(err) { -// return false, nil -// } -// return false, err -// } -// vm = obj -// return matchVMWaitCriterion(obj, criteria...), nil -// }) -// // no match found, print the diffs -// if err != nil { -// a.printVMWaitCriterionDiffs(t, vm, criteria...) -// } -// return vm, err -// }