Skip to content

Commit

Permalink
1. move to and rename it to 2.remove used in
Browse files Browse the repository at this point in the history
Signed-off-by: LeoLiao123 <[email protected]>
  • Loading branch information
LeoLiao123 committed Dec 11, 2024
1 parent b1a6c30 commit 40de42e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
6 changes: 3 additions & 3 deletions ray-operator/test/e2eautoscaler/raycluster_autoscaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ func TestRayClusterAutoscalerMinReplicasUpdate(t *testing.T) {
namespace := test.NewTestNamespace()
test.StreamKubeRayOperatorLogs()

// Scripts for creating and terminating detached actors to trigger autoscaling
scriptsAC := newConfigMap(namespace.Name, files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
// Script for creating detached actors to trigger autoscaling
scriptsAC := newConfigMap(namespace.Name, files(test, "create_detached_actor.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
test.T().Logf("Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)
Expand Down Expand Up @@ -326,6 +326,6 @@ func TestRayClusterAutoscalerMinReplicasUpdate(t *testing.T) {
Should(gomega.WithTransform(RayClusterDesiredWorkerReplicas, gomega.Equal(int32(5))))

// Check that replicas is set to 5
g.Expect(GetRayCluster(test, rayCluster.Namespace, rayCluster.Name)).To(gomega.WithTransform(getRayClusterWorkerReplicas, gomega.Equal(int32(5))))
g.Expect(GetRayCluster(test, rayCluster.Namespace, rayCluster.Name)).To(gomega.WithTransform(GetRayClusterWorkerGroupReplicaSum, gomega.Equal(int32(5))))
})
}
9 changes: 0 additions & 9 deletions ray-operator/test/e2eautoscaler/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
corev1ac "k8s.io/client-go/applyconfigurations/core/v1"

rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1"
rayv1ac "github.com/ray-project/kuberay/ray-operator/pkg/client/applyconfiguration/ray/v1"
. "github.com/ray-project/kuberay/ray-operator/test/support"
)
Expand Down Expand Up @@ -131,11 +130,3 @@ func workerPodTemplateApplyConfiguration() *corev1ac.PodTemplateSpecApplyConfigu
corev1.ResourceMemory: resource.MustParse("1G"),
}))))
}

func getRayClusterWorkerReplicas(cluster *rayv1.RayCluster) int32 {
var replicas int32
for _, workerGroup := range cluster.Spec.WorkerGroupSpecs {
replicas += *workerGroup.Replicas
}
return replicas
}
8 changes: 8 additions & 0 deletions ray-operator/test/support/ray.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,11 @@ func RayService(t Test, namespace, name string) func() (*rayv1.RayService, error
func RayServiceStatus(service *rayv1.RayService) rayv1.ServiceStatus {
return service.Status.ServiceStatus
}

func GetRayClusterWorkerGroupReplicaSum(cluster *rayv1.RayCluster) int32 {
var replicas int32
for _, workerGroup := range cluster.Spec.WorkerGroupSpecs {
replicas += *workerGroup.Replicas
}
return replicas
}

0 comments on commit 40de42e

Please sign in to comment.