@@ -425,91 +425,3 @@ func TestRayClusterAutoscalerMaxReplicasUpdate(t *testing.T) {
425425 }
426426 }
427427}
428-
429- func TestRayClusterAutoscalerIdleTimeout (t * testing.T ) {
430- tc := tests [1 ] // V2 autoscaler test case only
431- t .Run (tc .name , func (t * testing.T ) {
432- test := With (t )
433- g := gomega .NewWithT (t )
434-
435- // Create a namespace
436- namespace := test .NewTestNamespace ()
437-
438- // RayCluster with mixed idleTimeoutSeconds values
439- rayClusterSpecAC := rayv1ac .RayClusterSpec ().
440- WithEnableInTreeAutoscaling (true ).
441- WithRayVersion (GetRayVersion ()).
442- WithAutoscalerOptions (rayv1ac .AutoscalerOptions ().
443- WithIdleTimeoutSeconds (60 ). // Global default
444- WithVersion (rayv1 .AutoscalerVersionV2 )).
445- WithHeadGroupSpec (rayv1ac .HeadGroupSpec ().
446- WithRayStartParams (map [string ]string {"num-cpus" : "0" }).
447- WithTemplate (tc .HeadPodTemplateGetter ())).
448- WithWorkerGroupSpecs (
449- rayv1ac .WorkerGroupSpec ().
450- WithReplicas (0 ).
451- WithMinReplicas (0 ).
452- WithMaxReplicas (1 ).
453- WithIdleTimeoutSeconds (30 ). // Faster than global
454- WithGroupName ("fast-idle-group" ).
455- WithRayStartParams (map [string ]string {"num-cpus" : "1" }).
456- WithTemplate (tc .WorkerPodTemplateGetter ()),
457- rayv1ac .WorkerGroupSpec ().
458- WithReplicas (0 ).
459- WithMinReplicas (0 ).
460- WithMaxReplicas (1 ).
461- WithIdleTimeoutSeconds (0 ). // Zero idle timeout
462- WithGroupName ("zero-idle-group" ).
463- WithRayStartParams (map [string ]string {"num-cpus" : "1" }).
464- WithTemplate (tc .WorkerPodTemplateGetter ()),
465- rayv1ac .WorkerGroupSpec ().
466- WithReplicas (0 ).
467- WithMinReplicas (0 ).
468- WithMaxReplicas (1 ).
469- // No IdleTimeoutSeconds - uses global default of 60
470- WithGroupName ("default-idle-group" ).
471- WithRayStartParams (map [string ]string {"num-cpus" : "1" }).
472- WithTemplate (tc .WorkerPodTemplateGetter ()),
473- )
474-
475- rayClusterAC := rayv1ac .RayCluster ("ray-cluster" , namespace .Name ).
476- WithSpec (rayClusterSpecAC )
477-
478- rayCluster , err := test .Client ().Ray ().RayV1 ().RayClusters (namespace .Name ).Apply (test .Ctx (), rayClusterAC , TestApplyOptions )
479- g .Expect (err ).NotTo (gomega .HaveOccurred ())
480- LogWithTimestamp (test .T (), "Created RayCluster %s/%s successfully" , rayCluster .Namespace , rayCluster .Name )
481-
482- // Wait for RayCluster to become ready and verify the configuration is accepted
483- g .Eventually (RayCluster (test , rayCluster .Namespace , rayCluster .Name ), TestTimeoutMedium ).
484- Should (gomega .WithTransform (RayClusterState , gomega .Equal (rayv1 .Ready )))
485- LogWithTimestamp (test .T (), "RayCluster %s/%s is ready" , rayCluster .Namespace , rayCluster .Name )
486-
487- // Test validation - create a RayCluster with invalid negative idleTimeoutSeconds (should fail)
488- invalidRayClusterSpecAC := rayv1ac .RayClusterSpec ().
489- WithEnableInTreeAutoscaling (true ).
490- WithRayVersion (GetRayVersion ()).
491- WithAutoscalerOptions (rayv1ac .AutoscalerOptions ().
492- WithIdleTimeoutSeconds (60 ).
493- WithVersion (rayv1 .AutoscalerVersionV2 )).
494- WithHeadGroupSpec (rayv1ac .HeadGroupSpec ().
495- WithRayStartParams (map [string ]string {"num-cpus" : "0" }).
496- WithTemplate (tc .HeadPodTemplateGetter ())).
497- WithWorkerGroupSpecs (
498- rayv1ac .WorkerGroupSpec ().
499- WithReplicas (0 ).
500- WithMinReplicas (0 ).
501- WithMaxReplicas (1 ).
502- WithIdleTimeoutSeconds (- 10 ). // Invalid negative value
503- WithGroupName ("invalid-group" ).
504- WithRayStartParams (map [string ]string {"num-cpus" : "1" }).
505- WithTemplate (tc .WorkerPodTemplateGetter ()),
506- )
507-
508- invalidRayClusterAC := rayv1ac .RayCluster ("invalid-ray-cluster" , namespace .Name ).
509- WithSpec (invalidRayClusterSpecAC )
510-
511- _ , err = test .Client ().Ray ().RayV1 ().RayClusters (namespace .Name ).Apply (test .Ctx (), invalidRayClusterAC , TestApplyOptions )
512- g .Expect (err ).To (gomega .HaveOccurred ())
513- LogWithTimestamp (test .T (), "Successfully rejected RayCluster with negative idleTimeoutSeconds: %v" , err )
514- })
515- }
0 commit comments