Skip to content

Commit

Permalink
Fix sporadic test failure when attaching NetworkInterfaces to `Mach…
Browse files Browse the repository at this point in the history
…ines` (#1223)
  • Loading branch information
Rohit-0505 authored Jan 29, 2025
1 parent 79c881c commit 1bda250
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gstruct"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"sigs.k8s.io/controller-runtime/pkg/client"
)

Expand Down Expand Up @@ -158,6 +159,12 @@ var _ = Describe("AttachNetworkInterface", func() {
By("deleting the network")
Expect(k8sClient.Delete(ctx, network)).To(Succeed())

By("ensuring the network is deleted, before re-attaching the nic")
Eventually(func() bool {
err := k8sClient.Get(ctx, networkKey, network)
return apierrors.IsNotFound(err)
}).Should(BeTrue())

By("re-attaching a network interface")
Expect(srv.AttachNetworkInterface(ctx, &iri.AttachNetworkInterfaceRequest{
MachineId: machineID,
Expand Down

0 comments on commit 1bda250

Please sign in to comment.