@@ -17,7 +17,7 @@ func TestReorderNodeGroups(t *testing.T) {
1717 apiNodeGroups []* client.AzureEnvSpecFragment_NodeGroups
1818 expectedOrder []string
1919 expectedLength int
20- validateData bool // Whether to validate specific field values
20+ validateData bool
2121 }{
2222 {
2323 name : "Preserve model order and add new API node groups" ,
@@ -28,7 +28,7 @@ func TestReorderNodeGroups(t *testing.T) {
2828 apiNodeGroups : []* client.AzureEnvSpecFragment_NodeGroups {
2929 {NodeType : "user" , Name : "user-group" , CapacityPerZone : 2 },
3030 {NodeType : "system" , Name : "system-group" , CapacityPerZone : 1 },
31- {NodeType : "monitoring" , Name : "monitoring-group" , CapacityPerZone : 1 }, // New node group not in model
31+ {NodeType : "monitoring" , Name : "monitoring-group" , CapacityPerZone : 1 },
3232 },
3333 expectedOrder : []string {"system" , "user" , "monitoring" },
3434 expectedLength : 3 ,
@@ -51,7 +51,7 @@ func TestReorderNodeGroups(t *testing.T) {
5151 model : []common.NodeGroupsModel {
5252 {NodeType : types .StringValue ("system" )},
5353 {NodeType : types .StringValue ("user" )},
54- {NodeType : types .StringValue ("missing" )}, // Not in API
54+ {NodeType : types .StringValue ("missing" )},
5555 },
5656 apiNodeGroups : []* client.AzureEnvSpecFragment_NodeGroups {
5757 {NodeType : "user" , Name : "user-group" , CapacityPerZone : 2 },
@@ -125,9 +125,8 @@ func TestReorderNodeGroups(t *testing.T) {
125125 }
126126 }
127127
128- // Additional data validation for the "No data loss validation" test case
129128 if tt .validateData {
130- // Verify system is first (from model order)
129+
131130 if result [0 ].NodeType != "system" {
132131 t .Errorf ("Expected first node type to be 'system', got '%s'" , result [0 ].NodeType )
133132 }
@@ -138,7 +137,6 @@ func TestReorderNodeGroups(t *testing.T) {
138137 t .Errorf ("Expected system CapacityPerZone to be 10, got %d" , result [0 ].CapacityPerZone )
139138 }
140139
141- // Verify other node groups are preserved with their data
142140 nodeTypeToGroup := make (map [string ]* client.AzureEnvSpecFragment_NodeGroups )
143141 for _ , group := range result {
144142 nodeTypeToGroup [group .NodeType ] = group
@@ -360,7 +358,7 @@ func TestLoadBalancersToSDK(t *testing.T) {
360358 }
361359
362360 if tt .expected != nil && result != nil {
363- // Compare public load balancer
361+
364362 if (tt .expected .Public == nil ) != (result .Public == nil ) {
365363 t .Errorf ("Public load balancer presence mismatch" )
366364 }
@@ -373,7 +371,6 @@ func TestLoadBalancersToSDK(t *testing.T) {
373371 }
374372 }
375373
376- // Compare internal load balancer
377374 if (tt .expected .Internal == nil ) != (result .Internal == nil ) {
378375 t .Errorf ("Internal load balancer presence mismatch" )
379376 }
@@ -457,7 +454,6 @@ func TestLoadBalancersToModel(t *testing.T) {
457454 return
458455 }
459456
460- // Test public load balancer
461457 if result .Public == nil {
462458 t .Error ("Expected non-nil Public load balancer" )
463459 return
@@ -469,7 +465,6 @@ func TestLoadBalancersToModel(t *testing.T) {
469465 t .Errorf ("Public SourceIPRanges count: expected %d, got %d" , tt .expected .publicSourceIPCount , len (result .Public .SourceIPRanges ))
470466 }
471467
472- // Test internal load balancer
473468 if result .Internal == nil {
474469 t .Error ("Expected non-nil Internal load balancer" )
475470 return
@@ -700,7 +695,6 @@ func TestNodeGroupsToModel(t *testing.T) {
700695 t .Errorf ("Node group %d CapacityPerZone: expected %d, got %d" , i , expected .capacityPerZone , result [i ].CapacityPerZone .ValueInt64 ())
701696 }
702697
703- // Check zones count by converting List to slice
704698 var zones []string
705699 result [i ].Zones .ElementsAs (context .TODO (), & zones , false )
706700 if len (zones ) != expected .zonesCount {
@@ -763,7 +757,7 @@ func TestAzureEnvResourceModel_toSDK(t *testing.T) {
763757 },
764758 },
765759 validate : func (t * testing.T , create client.CreateAzureEnvInput , update client.UpdateAzureEnvInput ) {
766- // Validate create input
760+
767761 if create .Name != "test-azure-env" {
768762 t .Errorf ("Create name: expected 'test-azure-env', got '%s'" , create .Name )
769763 }
@@ -798,7 +792,6 @@ func TestAzureEnvResourceModel_toSDK(t *testing.T) {
798792 t .Errorf ("Create private link allowed subscriptions: expected 2, got %d" , len (create .Spec .PrivateLinkService .AllowedSubscriptions ))
799793 }
800794
801- // Validate update input
802795 if update .Name != "test-azure-env" {
803796 t .Errorf ("Update name: expected 'test-azure-env', got '%s'" , update .Name )
804797 }
@@ -972,38 +965,33 @@ func TestAzureEnvResourceModel_toModel(t *testing.T) {
972965 t .Errorf ("LoadBalancingStrategy: expected 'ROUND_ROBIN', got '%s'" , model .LoadBalancingStrategy .ValueString ())
973966 }
974967
975- // Check zones
976968 var zones []string
977969 model .Zones .ElementsAs (context .TODO (), & zones , false )
978970 if len (zones ) != 3 {
979971 t .Errorf ("Zones count: expected 3, got %d" , len (zones ))
980972 }
981973
982- // Check node groups
983974 if len (model .NodeGroups ) != 2 {
984975 t .Errorf ("NodeGroups count: expected 2, got %d" , len (model .NodeGroups ))
985976 }
986977 if model .NodeGroups [0 ].Name .ValueString () != "system-group" {
987978 t .Errorf ("First node group name: expected 'system-group', got '%s'" , model .NodeGroups [0 ].Name .ValueString ())
988979 }
989980
990- // Check maintenance windows
991981 if len (model .MaintenanceWindows ) != 1 {
992982 t .Errorf ("MaintenanceWindows count: expected 1, got %d" , len (model .MaintenanceWindows ))
993983 }
994984 if model .MaintenanceWindows [0 ].Name .ValueString () != "weekly-maintenance" {
995985 t .Errorf ("Maintenance window name: expected 'weekly-maintenance', got '%s'" , model .MaintenanceWindows [0 ].Name .ValueString ())
996986 }
997987
998- // Check tags
999988 if len (model .Tags ) != 2 {
1000989 t .Errorf ("Tags count: expected 2, got %d" , len (model .Tags ))
1001990 }
1002991 if model .Tags [0 ].Key .ValueString () != "Environment" {
1003992 t .Errorf ("First tag key: expected 'Environment', got '%s'" , model .Tags [0 ].Key .ValueString ())
1004993 }
1005994
1006- // Check load balancers
1007995 if model .LoadBalancers == nil {
1008996 t .Fatal ("LoadBalancers should not be nil" )
1009997 }
@@ -1014,7 +1002,6 @@ func TestAzureEnvResourceModel_toModel(t *testing.T) {
10141002 t .Errorf ("Public load balancer enabled: expected true, got %v" , model .LoadBalancers .Public .Enabled .ValueBool ())
10151003 }
10161004
1017- // Check private link service
10181005 if model .PrivateLinkService == nil {
10191006 t .Fatal ("PrivateLinkService should not be nil" )
10201007 }
@@ -1069,7 +1056,6 @@ func TestAzureEnvResourceModel_toModel(t *testing.T) {
10691056 t .Errorf ("SubscriptionID: expected 'subscription-min', got '%s'" , model .SubscriptionID .ValueString ())
10701057 }
10711058
1072- // Check empty collections
10731059 if len (model .NodeGroups ) != 0 {
10741060 t .Errorf ("NodeGroups: expected empty slice, got %d items" , len (model .NodeGroups ))
10751061 }
@@ -1125,7 +1111,6 @@ func TestAzureEnvResourceModel_toModel(t *testing.T) {
11251111 t .Errorf ("LoadBalancingStrategy: expected 'ROUND_ROBIN', got '%s'" , model .LoadBalancingStrategy .ValueString ())
11261112 }
11271113
1128- // Check zones
11291114 var zones []string
11301115 model .Zones .ElementsAs (context .TODO (), & zones , false )
11311116 if len (zones ) != 2 {
0 commit comments