Skip to content

Commit

Permalink
add test case for peering id removal and verify status update
Browse files Browse the repository at this point in the history
  • Loading branch information
ushabelgur committed Apr 26, 2024
1 parent 4da0420 commit 6f5d5d7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions controllers/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,18 @@ var _ = Describe("Network Controller", Label("network"), Ordered, func() {
State: metalnetv1alpha1.NetworkPeeringStateReady,
}))))

By("Removing peeredIDs")
// Update the k8s network object
patchNetwork := network.DeepCopy()
patchNetwork.Spec.PeeredIDs = []int32{}
Expect(k8sClient.Patch(ctx, patchNetwork, client.MergeFrom(network))).To(Succeed())

Expect(networkReconcile(ctx, *network)).To(Succeed())

By("Verifying peering information removed from status")
Eventually(Object(network)).Should(SatisfyAll(
HaveField("Status.Peerings", BeEmpty())))

// Deletes the k8s network object after spec is completed
DeferCleanup(func(ctx SpecContext) {
Expect(k8sClient.Delete(ctx, networkInterface)).To(Succeed())
Expand Down

0 comments on commit 6f5d5d7

Please sign in to comment.