Skip to content

Commit

Permalink
Merge pull request #1987 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…1974-to-release-1.7

[release-1.7] 🌱 test/e2e: add check at anti-affinity test to ensure enough hosts exist
  • Loading branch information
k8s-ci-robot authored Jul 11, 2023
2 parents 3bd2187 + 5692048 commit dde0aaa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/e2e/anti_affinity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ var _ = Describe("Cluster creation with anti affined nodes", func() {
})

It("should create a cluster with anti-affined nodes", func() {
// Since the upstream CI has five nodes, worker node count is set to 5
// Since the upstream CI has four nodes, worker node count is set to 4.
VerifyAntiAffinity(ctx, AntiAffinitySpecInput{
WorkerNodeCount: 5,
WorkerNodeCount: 4,
Namespace: namespace,
InfraClients: InfraClients{
Client: vsphereClient,
Expand All @@ -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 the WorkerNodeCount. Expected at least %d but only got %d hosts.", input.WorkerNodeCount, len(hostSystems))

Byf("creating a workload cluster %s", clusterName)
configCluster := defaultConfigCluster(clusterName, namespace.Name, "", 1, input.WorkerNodeCount,
input.Global)
Expand Down

0 comments on commit dde0aaa

Please sign in to comment.