@@ -193,3 +193,36 @@ func TestListNodePools_EmptyList(t *testing.T) {
193
193
t .Errorf ("expected empty nodepools list, got %d" , len (nodePools ))
194
194
}
195
195
}
196
+
197
+ func TestUpdateNodeGroup_EmptyNodePools (t * testing.T ) {
198
+ // Create a nodepool with autoscaling disabled - this will result in empty list after filtering
199
+ obj := map [string ]interface {}{
200
+ "apiVersion" : coreWeaveGroup + "/" + coreWeaveVersion ,
201
+ "kind" : coreWeaveResource ,
202
+ "metadata" : map [string ]interface {}{
203
+ "name" : "np1" ,
204
+ "namespace" : "default" ,
205
+ "uid" : "uid1" ,
206
+ },
207
+ "spec" : map [string ]interface {}{
208
+ "minNodes" : int64 (1 ),
209
+ "maxNodes" : int64 (5 ),
210
+ "targetNodes" : int64 (3 ),
211
+ "autoscaling" : false , // Autoscaling disabled - will be filtered out
212
+ },
213
+ }
214
+ item := unstructured.Unstructured {Object : obj }
215
+ manager := makeTestManagerWithNodePools (nil , item )
216
+
217
+ // UpdateNodeGroup should return empty slice when all nodepools have autoscaling disabled
218
+ nodeGroups , err := manager .UpdateNodeGroup ()
219
+ if err != nil {
220
+ t .Errorf ("unexpected error: %v" , err )
221
+ }
222
+ if nodeGroups == nil {
223
+ t .Error ("expected empty slice, got nil" )
224
+ }
225
+ if len (nodeGroups ) != 0 {
226
+ t .Errorf ("expected empty node groups, got %d" , len (nodeGroups ))
227
+ }
228
+ }
0 commit comments