Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions ray-operator/test/e2eautoscaler/raycluster_autoscaler_part2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestRayClusterAutoscalerV2IdleTimeout(t *testing.T) {
timeoutBuffer := int32(30) // Additional wait time to allow for scale down operation

// Script for creating detached actors to trigger autoscaling
scriptsAC := newConfigMap(namespace.Name, files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scriptsAC := newConfigMap(namespace.Name, Files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
LogWithTimestamp(test.T(), "Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)
Expand Down Expand Up @@ -64,7 +64,7 @@ func TestRayClusterAutoscalerV2IdleTimeout(t *testing.T) {
WithTemplate(tc.WorkerPodTemplateGetter()),
)
rayClusterAC := rayv1ac.RayCluster("ray-cluster", namespace.Name).
WithSpec(apply(rayClusterSpecAC, mountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))
WithSpec(Apply(rayClusterSpecAC, MountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))

rayCluster, err := test.Client().Ray().RayV1().RayClusters(namespace.Name).Apply(test.Ctx(), rayClusterAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down Expand Up @@ -110,7 +110,7 @@ func TestRayClusterAutoscalerGPUNodesForCPUTasks(t *testing.T) {
namespace := test.NewTestNamespace()

// Scripts for creating and terminating detached actors to trigger autoscaling
scriptsAC := newConfigMap(namespace.Name, files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scriptsAC := newConfigMap(namespace.Name, Files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
LogWithTimestamp(test.T(), "Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)
Expand All @@ -133,7 +133,7 @@ func TestRayClusterAutoscalerGPUNodesForCPUTasks(t *testing.T) {
WithTemplate(tc.WorkerPodTemplateGetter()))

rayClusterAC := rayv1ac.RayCluster("ray-cluster-gpu-for-cpu", namespace.Name).
WithSpec(apply(rayClusterSpecAC, mountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))
WithSpec(Apply(rayClusterSpecAC, MountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))

rayCluster, err := test.Client().Ray().RayV1().RayClusters(namespace.Name).Apply(test.Ctx(), rayClusterAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down Expand Up @@ -183,7 +183,7 @@ func TestRayClusterAutoscalerDoNotRemoveIdlesForPlacementGroup(t *testing.T) {
// Create a namespace
namespace := test.NewTestNamespace()

scriptsAC := newConfigMap(namespace.Name, files(test, "do_not_remove_idles_for_pg.py"))
scriptsAC := newConfigMap(namespace.Name, Files(test, "do_not_remove_idles_for_pg.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
LogWithTimestamp(test.T(), "Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)
Expand Down Expand Up @@ -213,7 +213,7 @@ func TestRayClusterAutoscalerDoNotRemoveIdlesForPlacementGroup(t *testing.T) {
WithTemplate(workerTemplate))

rayClusterAC := rayv1ac.RayCluster("ray-cluster", namespace.Name).
WithSpec(apply(rayClusterSpecAC, mountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))
WithSpec(Apply(rayClusterSpecAC, MountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))

rayCluster, err := test.Client().Ray().RayV1().RayClusters(namespace.Name).Apply(test.Ctx(), rayClusterAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down Expand Up @@ -245,7 +245,7 @@ func TestRayClusterAutoscalerSDKRequestResources(t *testing.T) {
namespace := test.NewTestNamespace()

// Mount the call_request_resources.py script as a ConfigMap
scriptsAC := newConfigMap(namespace.Name, files(test, "call_request_resources.py"))
scriptsAC := newConfigMap(namespace.Name, Files(test, "call_request_resources.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
LogWithTimestamp(test.T(), "Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)
Expand All @@ -266,7 +266,7 @@ func TestRayClusterAutoscalerSDKRequestResources(t *testing.T) {
WithRayStartParams(map[string]string{"num-cpus": "1"}).
WithTemplate(tc.WorkerPodTemplateGetter()))
rayClusterAC := rayv1ac.RayCluster("ray-cluster-sdk", namespace.Name).
WithSpec(apply(rayClusterSpecAC, mountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))
WithSpec(Apply(rayClusterSpecAC, MountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))

rayCluster, err := test.Client().Ray().RayV1().RayClusters(namespace.Name).Apply(test.Ctx(), rayClusterAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down Expand Up @@ -304,7 +304,7 @@ func TestRayClusterAutoscalerAddNewWorkerGroup(t *testing.T) {
namespace := test.NewTestNamespace()

// Mount the create_detached_actor.py and terminate_detached_actor.py scripts as a ConfigMap
scriptsAC := newConfigMap(namespace.Name, files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scriptsAC := newConfigMap(namespace.Name, Files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
LogWithTimestamp(test.T(), "Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)
Expand All @@ -328,7 +328,7 @@ func TestRayClusterAutoscalerAddNewWorkerGroup(t *testing.T) {
WithRayStartParams(map[string]string{"num-cpus": "1"}).
WithTemplate(tc.WorkerPodTemplateGetter()))
rayClusterAC := rayv1ac.RayCluster("ray-cluster", namespace.Name).
WithSpec(apply(rayClusterSpecAC, mountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))
WithSpec(Apply(rayClusterSpecAC, MountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))

rayCluster, err := test.Client().Ray().RayV1().RayClusters(namespace.Name).Apply(test.Ctx(), rayClusterAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down Expand Up @@ -430,7 +430,7 @@ func TestRayClusterAutoscalerPlacementGroup(t *testing.T) {
namespace := test.NewTestNamespace()

// Mount the scripts as a ConfigMap
scriptsAC := newConfigMap(namespace.Name, files(test, "create_detached_placement_group.py", "check_placement_group_ready.py"))
scriptsAC := newConfigMap(namespace.Name, Files(test, "create_detached_placement_group.py", "check_placement_group_ready.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
LogWithTimestamp(test.T(), "Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)
Expand All @@ -451,7 +451,7 @@ func TestRayClusterAutoscalerPlacementGroup(t *testing.T) {
WithRayStartParams(setting.workerGroupRayStartParams).
WithTemplate(tc.WorkerPodTemplateGetter()))
rayClusterAC := rayv1ac.RayCluster("ray-cluster", namespace.Name).
WithSpec(apply(rayClusterSpecAC, mountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))
WithSpec(Apply(rayClusterSpecAC, MountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))

rayCluster, err := test.Client().Ray().RayV1().RayClusters(namespace.Name).Apply(test.Ctx(), rayClusterAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down Expand Up @@ -511,7 +511,7 @@ func TestRayClusterAutoscalerGCSFT(t *testing.T) {
namespace := test.NewTestNamespace()

// Scripts for creating and terminating detached actors to trigger autoscaling
scriptsAC := newConfigMap(namespace.Name, files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scriptsAC := newConfigMap(namespace.Name, Files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
LogWithTimestamp(test.T(), "Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)
Expand Down Expand Up @@ -544,7 +544,7 @@ func TestRayClusterAutoscalerGCSFT(t *testing.T) {
WithTemplate(tc.WorkerPodTemplateGetter()),
)
rayClusterAC := rayv1ac.RayCluster("ray-cluster", namespace.Name).
WithSpec(apply(rayClusterSpecAC, mountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))
WithSpec(Apply(rayClusterSpecAC, MountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))

rayCluster, err := test.Client().Ray().RayV1().RayClusters(namespace.Name).Apply(test.Ctx(), rayClusterAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down
24 changes: 12 additions & 12 deletions ray-operator/test/e2eautoscaler/raycluster_autoscaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestRayClusterAutoscaler(t *testing.T) {
namespace := test.NewTestNamespace()

// Scripts for creating and terminating detached actors to trigger autoscaling
scriptsAC := newConfigMap(namespace.Name, files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scriptsAC := newConfigMap(namespace.Name, Files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
LogWithTimestamp(test.T(), "Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)
Expand All @@ -43,7 +43,7 @@ func TestRayClusterAutoscaler(t *testing.T) {
WithRayStartParams(map[string]string{"num-cpus": "1"}).
WithTemplate(tc.WorkerPodTemplateGetter()))
rayClusterAC := rayv1ac.RayCluster("ray-cluster", namespace.Name).
WithSpec(apply(rayClusterSpecAC, mountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))
WithSpec(Apply(rayClusterSpecAC, MountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))

rayCluster, err := test.Client().Ray().RayV1().RayClusters(namespace.Name).Apply(test.Ctx(), rayClusterAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down Expand Up @@ -91,7 +91,7 @@ func TestRayClusterAutoscalerWithFakeGPU(t *testing.T) {
namespace := test.NewTestNamespace()

// Scripts for creating and terminating detached actors to trigger autoscaling
scriptsAC := newConfigMap(namespace.Name, files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scriptsAC := newConfigMap(namespace.Name, Files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
LogWithTimestamp(test.T(), "Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)
Expand All @@ -110,7 +110,7 @@ func TestRayClusterAutoscalerWithFakeGPU(t *testing.T) {
WithRayStartParams(map[string]string{"num-cpus": "1", "num-gpus": "1"}).
WithTemplate(tc.WorkerPodTemplateGetter()))
rayClusterAC := rayv1ac.RayCluster("ray-cluster", namespace.Name).
WithSpec(apply(rayClusterSpecAC, mountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))
WithSpec(Apply(rayClusterSpecAC, MountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))

rayCluster, err := test.Client().Ray().RayV1().RayClusters(namespace.Name).Apply(test.Ctx(), rayClusterAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down Expand Up @@ -151,7 +151,7 @@ func TestRayClusterAutoscalerWithCustomResource(t *testing.T) {
namespace := test.NewTestNamespace()

// Scripts for creating and terminating detached actors to trigger autoscaling
scriptsAC := newConfigMap(namespace.Name, files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scriptsAC := newConfigMap(namespace.Name, Files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
LogWithTimestamp(test.T(), "Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)
Expand All @@ -172,7 +172,7 @@ func TestRayClusterAutoscalerWithCustomResource(t *testing.T) {
WithRayStartParams(map[string]string{"num-cpus": "1", "resources": `'{"CustomResource": 1}'`}).
WithTemplate(tc.WorkerPodTemplateGetter()))
rayClusterAC := rayv1ac.RayCluster("ray-cluster", namespace.Name).
WithSpec(apply(rayClusterSpecAC, mountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))
WithSpec(Apply(rayClusterSpecAC, MountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))

rayCluster, err := test.Client().Ray().RayV1().RayClusters(namespace.Name).Apply(test.Ctx(), rayClusterAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down Expand Up @@ -214,7 +214,7 @@ func TestRayClusterAutoscalerWithDesiredState(t *testing.T) {
namespace := test.NewTestNamespace()

// Scripts for creating and terminating detached actors to trigger autoscaling
scriptsAC := newConfigMap(namespace.Name, files(test, "create_concurrent_tasks.py"))
scriptsAC := newConfigMap(namespace.Name, Files(test, "create_concurrent_tasks.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
LogWithTimestamp(test.T(), "Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)
Expand All @@ -236,7 +236,7 @@ func TestRayClusterAutoscalerWithDesiredState(t *testing.T) {
WithAutoscalerOptions(rayv1ac.AutoscalerOptions().
WithIdleTimeoutSeconds(scaleDownWaitSec))
rayClusterAC := rayv1ac.RayCluster("ray-cluster", namespace.Name).
WithSpec(apply(rayClusterSpecAC, mountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))
WithSpec(Apply(rayClusterSpecAC, MountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))

rayCluster, err := test.Client().Ray().RayV1().RayClusters(namespace.Name).Apply(test.Ctx(), rayClusterAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down Expand Up @@ -272,7 +272,7 @@ func TestRayClusterAutoscalerMinReplicasUpdate(t *testing.T) {
namespace := test.NewTestNamespace()

// Script for creating detached actors to trigger autoscaling
scriptsAC := newConfigMap(namespace.Name, files(test, "create_detached_actor.py"))
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())
LogWithTimestamp(test.T(), "Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)
Expand All @@ -293,7 +293,7 @@ func TestRayClusterAutoscalerMinReplicasUpdate(t *testing.T) {
WithRayStartParams(map[string]string{"num-cpus": "1"}).
WithTemplate(tc.WorkerPodTemplateGetter()))
rayClusterAC := rayv1ac.RayCluster("ray-cluster", namespace.Name).
WithSpec(apply(rayClusterSpecAC, mountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))
WithSpec(Apply(rayClusterSpecAC, MountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))

rayCluster, err := test.Client().Ray().RayV1().RayClusters(namespace.Name).Apply(test.Ctx(), rayClusterAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down Expand Up @@ -363,7 +363,7 @@ func TestRayClusterAutoscalerMaxReplicasUpdate(t *testing.T) {

namespace := test.NewTestNamespace()

scriptsAC := newConfigMap(namespace.Name, files(test, "create_detached_actor.py"))
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())

Expand All @@ -383,7 +383,7 @@ func TestRayClusterAutoscalerMaxReplicasUpdate(t *testing.T) {
WithRayStartParams(map[string]string{"num-cpus": "1"}).
WithTemplate(tc.WorkerPodTemplateGetter()))
rayClusterAC := rayv1ac.RayCluster("ray-cluster", namespace.Name).
WithSpec(apply(rayClusterSpecAC, mountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))
WithSpec(Apply(rayClusterSpecAC, MountConfigMap[rayv1ac.RayClusterSpecApplyConfiguration](scripts, "/home/ray/test_scripts")))

rayCluster, err := test.Client().Ray().RayV1().RayClusters(namespace.Name).Apply(test.Ctx(), rayClusterAC, TestApplyOptions)
g.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down
Loading
Loading