Files
kuberay/kubectl-plugin/pkg/cmd/create/create_workergroup_test.go
4d53e84325 [release-1.3] v1.3.2 backports (#3264)
* [RayJob][Fix] Use --no-wait for job submission to avoid carrying the error return code to the log tailing (#3216)

* [RayJob][Fix] Use --no-wait for job submission to avoid carrying the error return code to the log tailing

Signed-off-by: Rueian <[email protected]>

* [RayJob][Fix] Use --no-wait for job submission to avoid carrying the error return code to the log tailing

Signed-off-by: Rueian <[email protected]>

* chore: update comments

Signed-off-by: Rueian <[email protected]>

* chore: add a comment about bash -e

Signed-off-by: Rueian <[email protected]>

---------

Signed-off-by: Rueian <[email protected]>

* kubectl ray job submit: provide entrypoint (#3186)

* [kubectl-plugin] Add head/worker node selector option (#3228)

* add node selector option for kubectl plugin create cluster

Signed-off-by: Troy Chiu <[email protected]>

* nit

Signed-off-by: Troy Chiu <[email protected]>

---------

Signed-off-by: Troy Chiu <[email protected]>

* add node selector option for kubectl plugin create worker group (#3235)

* add node selector option for kubectl plugin create work group

Signed-off-by: Troy Chiu <[email protected]>

* nit

Signed-off-by: Troy Chiu <[email protected]>

* code review: fix usage

Signed-off-by: Troy Chiu <[email protected]>

---------

Signed-off-by: Troy Chiu <[email protected]>

* [kubectl-plugin] remove CPU limits by default (#3243)

Signed-off-by: Andrew Sy Kim <[email protected]>

* [Chore][CI] Limit the release-image-build github workflow to only take tag as input (#3117)

* remove all inputs from workflow_dispatch

Signed-off-by: Tina Wu <[email protected]>

* use tag only

Signed-off-by: Tina Wu <[email protected]>

* align case

Signed-off-by: Tina Wu <[email protected]>

* change sha

Signed-off-by: Tina Wu <[email protected]>

* extract tag

* lint fix

Signed-off-by: Tina Wu <[email protected]>

* update github_env

Signed-off-by: Tina Wu <[email protected]>

* directly take tag

Signed-off-by: Tina Wu <[email protected]>

* add env,

Signed-off-by: Tina Wu <[email protected]>

* directly use tag

Signed-off-by: Tina Wu <[email protected]>

* use env. when in script

Signed-off-by: Tina Wu <[email protected]>

* env.tag when with

Signed-off-by: Tina Wu <[email protected]>

* use env.tag for all

Signed-off-by: Tina Wu <[email protected]>

---------

Signed-off-by: Tina Wu <[email protected]>
Co-authored-by: tinaxfwu <[email protected]>

* [CI] Remove create tag step from release (#3249)

Signed-off-by: Chi-Sheng Liu <[email protected]>

---------

Signed-off-by: Rueian <[email protected]>
Signed-off-by: Troy Chiu <[email protected]>
Signed-off-by: Andrew Sy Kim <[email protected]>
Signed-off-by: Tina Wu <[email protected]>
Signed-off-by: Chi-Sheng Liu <[email protected]>
Co-authored-by: Rueian <[email protected]>
Co-authored-by: Spencer Peterson <[email protected]>
Co-authored-by: Troy Chiu <[email protected]>
Co-authored-by: Tina Wu <[email protected]>
Co-authored-by: tinaxfwu <[email protected]>
Co-authored-by: Chi-Sheng Liu <[email protected]>
2025-04-02 15:43:57 -04:00

64 lines
1.7 KiB
Go

package create
import (
"testing"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/utils/ptr"
rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1"
)
func TestCreateWorkerGroupSpec(t *testing.T) {
options := &CreateWorkerGroupOptions{
groupName: "example-group",
image: "DEADBEEF",
workerReplicas: 3,
workerMinReplicas: 1,
workerMaxReplicas: 5,
workerCPU: "2",
workerMemory: "5Gi",
workerGPU: "1",
workerNodeSelectors: map[string]string{
"worker-node-selector": "worker-node-selector-value",
},
}
expected := rayv1.WorkerGroupSpec{
RayStartParams: map[string]string{},
GroupName: "example-group",
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "ray-worker",
Image: "DEADBEEF",
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("2"),
corev1.ResourceMemory: resource.MustParse("5Gi"),
resourceNvidiaGPU: resource.MustParse("1"),
},
Limits: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("2"),
corev1.ResourceMemory: resource.MustParse("5Gi"),
resourceNvidiaGPU: resource.MustParse("1"),
},
},
},
},
NodeSelector: map[string]string{
"worker-node-selector": "worker-node-selector-value",
},
},
},
Replicas: ptr.To[int32](3),
MinReplicas: ptr.To[int32](1),
MaxReplicas: ptr.To[int32](5),
}
assert.Equal(t, expected, createWorkerGroupSpec(options))
}