Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.4] 馃尡 assert E2E error responses when waiting for MD nodes #8516

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 10 additions & 18 deletions test/framework/machinedeployment_helpers.go
Expand Up @@ -104,35 +104,27 @@ func WaitForMachineDeploymentNodesToExist(ctx context.Context, input WaitForMach
Expect(input.MachineDeployment).ToNot(BeNil(), "Invalid argument. input.MachineDeployment can't be nil when calling WaitForMachineDeploymentNodesToExist")

By("Waiting for the workload nodes to exist")
Eventually(func() (int, error) {
Eventually(func(g Gomega) {
selectorMap, err := metav1.LabelSelectorAsMap(&input.MachineDeployment.Spec.Selector)
if err != nil {
return 0, err
}
g.Expect(err).NotTo(HaveOccurred())
ms := &clusterv1.MachineSetList{}
if err := input.Lister.List(ctx, ms, client.InNamespace(input.Cluster.Namespace), client.MatchingLabels(selectorMap)); err != nil {
return 0, err
}
if len(ms.Items) == 0 {
return 0, errors.New("no machinesets were found")
}
err = input.Lister.List(ctx, ms, client.InNamespace(input.Cluster.Namespace), client.MatchingLabels(selectorMap))
g.Expect(err).NotTo(HaveOccurred())
g.Expect(ms.Items).NotTo(BeEmpty())
machineSet := ms.Items[0]
selectorMap, err = metav1.LabelSelectorAsMap(&machineSet.Spec.Selector)
if err != nil {
return 0, err
}
g.Expect(err).NotTo(HaveOccurred())
machines := &clusterv1.MachineList{}
if err := input.Lister.List(ctx, machines, client.InNamespace(machineSet.Namespace), client.MatchingLabels(selectorMap)); err != nil {
return 0, err
}
err = input.Lister.List(ctx, machines, client.InNamespace(machineSet.Namespace), client.MatchingLabels(selectorMap))
g.Expect(err).NotTo(HaveOccurred())
count := 0
for _, machine := range machines.Items {
if machine.Status.NodeRef != nil {
count++
}
}
return count, nil
}, intervals...).Should(Equal(int(*input.MachineDeployment.Spec.Replicas)), "Timed out waiting for %d nodes to be created for MachineDeployment %s", int(*input.MachineDeployment.Spec.Replicas), klog.KObj(input.MachineDeployment))
g.Expect(count).To(Equal(int(*input.MachineDeployment.Spec.Replicas)))
}, intervals...).Should(Succeed(), "Timed out waiting for %d nodes to be created for MachineDeployment %s", int(*input.MachineDeployment.Spec.Replicas), klog.KObj(input.MachineDeployment))
}

// AssertMachineDeploymentFailureDomainsInput is the input for AssertMachineDeploymentFailureDomains.
Expand Down