Skip to content

Commit 040406e

Browse files
authored
Merge pull request #1789 from gab-satchi/e2e-fix
🐛 Restricts AZ limit to 1 in e2e tests
2 parents 5bb849d + 0271970 commit 040406e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

test/e2e/aws_test.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import (
5858
"sigs.k8s.io/cluster-api/util"
5959
"sigs.k8s.io/cluster-api/util/kubeconfig"
6060
crclient "sigs.k8s.io/controller-runtime/pkg/client"
61+
"github.com/gophercloud/gophercloud"
6162

6263
infrav1 "sigs.k8s.io/cluster-api-provider-aws/api/v1alpha3"
6364
)
@@ -1458,15 +1459,14 @@ func waitForAWSMachineRunning(namespace, name string) {
14581459
func waitForClusterInfrastructureReady(namespace, name string) bool {
14591460
fmt.Fprintf(GinkgoWriter, "Ensuring infrastructure is ready for cluster %s/%s\n", namespace, name)
14601461
polls := 0
1461-
polls0 := 0
14621462
var err error
14631463
endTime := time.Now().Add(20 * time.Minute)
14641464
for time.Now().Before(endTime) {
1465-
polls0 = polls + 1
1465+
polls = polls + 1
14661466
cluster := &clusterv1.Cluster{}
14671467

14681468
logit := func() {
1469-
fmt.Fprintf(GinkgoWriter, "POLLING ( # %v ) (waitForClusterInfrastructureReady) --> Ensuring infrastructure is ready for cluster %s/%s : Status = %+v , Err = %v \n", polls0, namespace, name, cluster.Status, err)
1469+
fmt.Fprintf(GinkgoWriter, "POLLING ( # %v ) (waitForClusterInfrastructureReady) --> Ensuring infrastructure is ready for cluster %s/%s : Status = %+v , Err = %v \n", polls, namespace, name, cluster.Status, err)
14701470
}
14711471

14721472
if err = kindClient.Get(context.TODO(), apimachinerytypes.NamespacedName{Namespace: namespace, Name: name}, cluster); nil == err {
@@ -1475,7 +1475,7 @@ func waitForClusterInfrastructureReady(namespace, name string) bool {
14751475
return true
14761476
}
14771477
}
1478-
if polls0 == 1 || polls0%5 == 0 {
1478+
if polls == 1 || polls%5 == 0 {
14791479
logit()
14801480
}
14811481
time.Sleep(15 * time.Second)
@@ -1660,6 +1660,11 @@ func makeAWSCluster(namespace, name string, multipleAZ bool) {
16601660
Spec: infrav1.AWSClusterSpec{
16611661
Region: region,
16621662
SSHKeyName: pointer.StringPtr(keyPairName),
1663+
NetworkSpec: infrav1.NetworkSpec{
1664+
VPC: infrav1.VPCSpec{
1665+
AvailabilityZoneUsageLimit: gophercloud.IntToPointer(1),
1666+
},
1667+
},
16631668
},
16641669
}
16651670
if multipleAZ {

test/e2e/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.13
55
require (
66
github.com/aws/aws-sdk-go v1.31.6
77
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
8+
github.com/gophercloud/gophercloud v0.2.0
89
github.com/onsi/ginkgo v1.12.2
910
github.com/onsi/gomega v1.10.1
1011
github.com/pkg/errors v0.9.1

0 commit comments

Comments
 (0)