Skip to content

Commit

Permalink
fix apinet network testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
kasabe28 committed Oct 3, 2024
1 parent da8fdf1 commit 3e049c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions apinetlet/controllers/network_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ var _ = Describe("NetworkController", func() {
By("patching apinet network peering status")
apiNetNetwork2ID, _ := strconv.Atoi(apiNetNetwork2.Spec.ID)
Eventually(UpdateStatus(apiNetNetwork1, func() {
apiNetNetwork1.Status.Peerings = make(map[string][]apinetv1alpha1.NetworkPeeringStatus)
apiNetNetwork1.Status.Peerings["partition1"] = []apinetv1alpha1.NetworkPeeringStatus{{
ID: int32(apiNetNetwork2ID),
State: apinetv1alpha1.NetworkPeeringStateReady,
Expand All @@ -209,6 +210,7 @@ var _ = Describe("NetworkController", func() {

apiNetNetwork1ID, _ := strconv.Atoi(apiNetNetwork1.Spec.ID)
Eventually(UpdateStatus(apiNetNetwork2, func() {
apiNetNetwork2.Status.Peerings = make(map[string][]apinetv1alpha1.NetworkPeeringStatus)
apiNetNetwork2.Status.Peerings["partition1"] = []apinetv1alpha1.NetworkPeeringStatus{{
ID: int32(apiNetNetwork1ID),
State: apinetv1alpha1.NetworkPeeringStateReady,
Expand Down Expand Up @@ -377,6 +379,7 @@ var _ = Describe("NetworkController", func() {
By("patching apinet network peering status")
apiNetNetwork2ID, _ := strconv.Atoi(apiNetNetwork2.Spec.ID)
Eventually(UpdateStatus(apiNetNetwork1, func() {
apiNetNetwork1.Status.Peerings = make(map[string][]apinetv1alpha1.NetworkPeeringStatus)
apiNetNetwork1.Status.Peerings["partition1"] = []apinetv1alpha1.NetworkPeeringStatus{{
ID: int32(apiNetNetwork2ID),
State: apinetv1alpha1.NetworkPeeringStateReady,
Expand All @@ -385,6 +388,7 @@ var _ = Describe("NetworkController", func() {

apiNetNetwork1ID, _ := strconv.Atoi(apiNetNetwork1.Spec.ID)
Eventually(UpdateStatus(apiNetNetwork2, func() {
apiNetNetwork2.Status.Peerings = make(map[string][]apinetv1alpha1.NetworkPeeringStatus)
apiNetNetwork2.Status.Peerings["partition1"] = []apinetv1alpha1.NetworkPeeringStatus{{
ID: int32(apiNetNetwork1ID),
State: apinetv1alpha1.NetworkPeeringStateReady,
Expand Down
2 changes: 1 addition & 1 deletion metalnetlet/controllers/network_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (r *NetworkReconciler) updateApinetNetworkStatus(ctx context.Context, log l
log.V(1).Info("Patching apinet network status", "status", apinetStatusPeerings)
networkBase := network.DeepCopy()
if network.Status.Peerings == nil {
network.Status.Peerings = make(map[string][]apinetv1alpha1.NetworkPeeringStatus, 0)
network.Status.Peerings = make(map[string][]apinetv1alpha1.NetworkPeeringStatus)
}
network.Status.Peerings[r.PartitionName] = apinetStatusPeerings
if err := r.Status().Patch(ctx, network, client.MergeFrom(networkBase)); err != nil {
Expand Down

0 comments on commit 3e049c2

Please sign in to comment.