diff --git a/test/e2e/anti_affinity_test.go b/test/e2e/anti_affinity_test.go index db8c4ab287..ba656e9eca 100644 --- a/test/e2e/anti_affinity_test.go +++ b/test/e2e/anti_affinity_test.go @@ -88,6 +88,11 @@ func VerifyAntiAffinity(ctx context.Context, input AntiAffinitySpecInput) { clusterName := fmt.Sprintf("anti-affinity-%s", util.RandomString(6)) Expect(namespace).NotTo(BeNil()) + By("checking if the target system has enough hosts") + hostSystems, err := input.Finder.HostSystemList(ctx, "*") + Expect(err).ToNot(HaveOccurred()) + Expect(len(hostSystems) > int(input.WorkerNodeCount)).To(BeTrue(), "This test requires more or equal number of hosts compared to WorkerNodeCount") + Byf("creating a workload cluster %s", clusterName) configCluster := defaultConfigCluster(clusterName, namespace.Name, "", 1, input.WorkerNodeCount, input.Global)