Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions test/e2e/azure_lb.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build e2e
// +build e2e

/*
Expand Down Expand Up @@ -32,6 +33,7 @@ import (

"github.com/hashicorp/go-retryablehttp"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/cluster-api/test/framework"
Expand Down Expand Up @@ -173,15 +175,20 @@ func AzureLBSpec(ctx context.Context, inputGetter func() AzureLBSpecInput) {

if !input.SkipCleanup {
By("deleting the ilb test resources")
Logf("deleting the ilb service: %s", ilbService.Name)
Logf("starting to delete the ilb service: %s", ilbService.Name)
Eventually(func() error {
err := servicesClient.Delete(ctx, ilbService.Name, metav1.DeleteOptions{})
if err != nil {
LogWarningf("failed deleting service (%s):%s\n", ilbService.Name, err.Error())
return err
}
return nil
}, deleteOperationTimeout, retryableOperationSleepBetweenRetries).Should(Succeed())
}, retryableOperationTimeout, retryableOperationSleepBetweenRetries).Should(Succeed())
Logf("waiting for the ilb service to be deleted: %s", ilbService.Name)
Eventually(func() bool {
_, err := servicesClient.Get(ctx, ilbService.GetName(), metav1.GetOptions{})
return apierrors.IsNotFound(err)
}, deleteOperationTimeout, retryableOperationSleepBetweenRetries).Should(BeTrue())
Logf("deleting the ilb job: %s", ilbJob.Name)
Eventually(func() error {
err := jobsClient.Delete(ctx, ilbJob.Name, metav1.DeleteOptions{})
Expand Down Expand Up @@ -267,7 +274,12 @@ func AzureLBSpec(ctx context.Context, inputGetter func() AzureLBSpecInput) {
return err
}
return nil
}, deleteOperationTimeout, retryableOperationSleepBetweenRetries).Should(Succeed())
}, retryableOperationTimeout, retryableOperationSleepBetweenRetries).Should(Succeed())
Logf("waiting for the external LB service to be deleted: %s", elbService.Name)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did this to be consistent but need to check if it adds a lot of time to e2e duration since we don't strictly need to wait on this one (it's the last service to be reconciled)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, so we have actually not been validating ELB delete (ILBs and ELBs are ultimately the same Azure LoadBalancer type, so not super critical, but I agree it's best-practice to not make an exception here)

Eventually(func() bool {
_, err := servicesClient.Get(ctx, elbService.GetName(), metav1.GetOptions{})
return apierrors.IsNotFound(err)
}, deleteOperationTimeout, retryableOperationSleepBetweenRetries).Should(BeTrue())
Logf("starting to delete deployment %s", deployment.Name)
Eventually(func() error {
err := webDeployment.Client(clientset).Delete(ctx, deployment.Name, metav1.DeleteOptions{})
Expand Down