-
Notifications
You must be signed in to change notification settings - Fork 442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite detached actor test with go #2722
base: master
Are you sure you want to change the base?
Rewrite detached actor test with go #2722
Conversation
@rueian would you mind taking the first pass as you are also working on GCS FT API? |
Hi @owenowenisme, This generally looks good to me, but unfortunately, we use Would you mind migrating the current approach to the kuberay/ray-operator/test/e2e/raycluster_test.go Lines 128 to 152 in 5db3012
And the configmap for scripts can be created with the |
5451939
to
4a952cb
Compare
@@ -0,0 +1,267 @@ | |||
apiVersion: ray.io/v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ray-cluster.ray-ft.yaml can be deleted.
@rueian kuberay/ray-operator/test/e2e/support.go Lines 44 to 50 in fffe778
|
I think there is no special reason for that. It just a name. |
redisCM := corev1ac.ConfigMap("redis-config", namespace.Name).WithLabels(map[string]string{"app": "redis"}). | ||
WithData(map[string]string{ | ||
"redis.conf": `dir /data | ||
port 6379 | ||
bind 0.0.0.0 | ||
appendonly yes | ||
protected-mode no | ||
requirepass 5241590000000000 | ||
pidfile /data/redis-6379.pid`, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentions make the configuration hard to read, but I think we should have better started the Redis without this configuration map. It is quite irrelevant to the test, but it takes too many lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
). | ||
WithWorkerGroupSpecs(rayv1ac.WorkerGroupSpec(). | ||
WithRayStartParams(map[string]string{ | ||
"redis-password": "5241590000000000", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worker group doesn't need to set redis-password
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, but it seems that somewhere else doesn't accept nil RayStartParams?
Message: "RayCluster.ray.io \"raycluster-gcsft\" is invalid: [spec.workerGroupSpecs[1].rayStartParams: Required value, <nil>: Invalid value: \"null\": some validation rules were not checked because the object was invalid; correct the existing errors to complete validation]",
Reason: "Invalid",
Details: {
Name: "raycluster-gcsft",
Group: "ray.io",
Kind: "RayCluster",
UID: "",
Causes: [
{
Type: "FieldValueRequired",
Message: "Required value",
Field: "spec.workerGroupSpecs[1].rayStartParams",
},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use "num-cpus": "1"
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
WithRayVersion(rayVersion). | ||
WithHeadGroupSpec(rayv1ac.HeadGroupSpec(). | ||
WithRayStartParams(map[string]string{ | ||
"dashboard-host": "0.0.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"dashboard-host": "0.0.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
testScriptCM, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), testScriptAC, TestApplyOptions) | ||
g.Expect(err).NotTo(HaveOccurred()) | ||
|
||
redisDM := appsv1ac.Deployment("redis", namespace.Name). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks similar to
appsv1ac.Deployment("redis", namespace.Name). |
Can you add a util for it instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
_, err = test.Client().Core().AppsV1().Deployments(namespace.Name).Apply(test.Ctx(), redisDM, TestApplyOptions) | ||
g.Expect(err).NotTo(HaveOccurred()) | ||
|
||
_, err = test.Client().Core().CoreV1().Services(namespace.Name).Apply( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also add a util function
corev1ac.Service("redis", namespace.Name). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
WithContainers(corev1ac.Container(). | ||
WithName("ray-head"). | ||
WithImage(rayImage). | ||
WithEnv(corev1ac.EnvVar().WithName("RAY_REDIS_ADDRESS").WithValue("redis:6379")). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have already set GcsFaultToleranceOptions
, so this environment variable is not required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
WithReplicas(1). | ||
WithMinReplicas(1). | ||
WithMaxReplicas(2). | ||
WithTemplate(corev1ac.PodTemplateSpec(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use workerPodTemplateApplyConfiguration
instead?
WithPorts(corev1ac.ContainerPort().WithContainerPort(6379).WithName("redis")). | ||
WithPorts(corev1ac.ContainerPort().WithContainerPort(8265).WithName("dashboard")). | ||
WithPorts(corev1ac.ContainerPort().WithContainerPort(10001).WithName("client")). | ||
WithVolumeMounts(corev1ac.VolumeMount(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use mountConfigMap
?
g.Expect(err).NotTo(HaveOccurred()) | ||
test.T().Logf("Created RayCluster %s/%s successfully", rayCluster.Namespace, rayCluster.Name) | ||
|
||
// Make sure the RAY_REDIS_ADDRESS env is set on the Head Pod. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to check this. It is the responsibility of the tests for GcsFaultToleranceOptions
to verify this behavior.
g.Eventually(func(g Gomega) bool {
rayCluster, err := test.Client().Ray().RayV1().RayClusters(namespace.Name).Apply(test.Ctx(), rayClusterAC, TestApplyOptions)
g.Expect(err).NotTo(HaveOccurred())
if rayCluster.Status.Head.PodName != "" {
headPod, err := test.Client().Core().CoreV1().Pods(namespace.Name).Get(test.Ctx(), rayCluster.Status.Head.PodName, metav1.GetOptions{})
g.Expect(err).NotTo(HaveOccurred())
return utils.EnvVarExists(utils.RAY_REDIS_ADDRESS, headPod.Spec.Containers[utils.RayContainerIndex].Env)
}
return false
}, TestTimeoutMedium).Should(BeTrue())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
), | ||
), | ||
) | ||
rayCluster, err := test.Client().Ray().RayV1().RayClusters(namespace.Name).Apply(test.Ctx(), rayClusterAC, TestApplyOptions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create the RayCluster inside "Test Detached Actor"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure, only the rayCluster needs to be create inside or all the resources?
Cause maybe there will be some resources reused by multiple subtest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only move RayCluster inside "Test Detached Actor".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
By the way, it would be better not to resolve comments if you haven’t pushed the related changes or are not entirely sure about the reviewers’ requests. |
925349d
to
e81f179
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind rebasing with the master branch?
- Reading https://github.com/ray-project/kuberay/blob/master/ray-operator/test/e2e/raycluster_gcsft_test.go may be helpful.
- Keep the code clean and reuse functions if possible.
- Use
deployRedis
function to deploy Redis.
Then, ping me for another review.
Signed-off-by: owenowenisme <[email protected]>
Signed-off-by: owenowenisme <[email protected]>
Signed-off-by: owenowenisme <[email protected]>
Signed-off-by: owenowenisme <[email protected]>
Signed-off-by: owenowenisme <[email protected]>
Signed-off-by: owenowenisme <[email protected]>
Signed-off-by: owenowenisme <[email protected]>
Signed-off-by: owenowenisme <[email protected]>
Signed-off-by: owenowenisme <[email protected]>
Signed-off-by: owenowenisme <[email protected]>
Signed-off-by: owenowenisme <[email protected]>
Signed-off-by: owenowenisme <[email protected]>
Signed-off-by: owenowenisme <[email protected]>
Signed-off-by: owenowenisme <[email protected]>
Signed-off-by: owenowenisme <[email protected]>
e81f179
to
0708c68
Compare
Signed-off-by: owenowenisme <[email protected]>
572270a
to
d07b95a
Compare
…ndReadyFirstTime to Long Signed-off-by: owenowenisme <[email protected]>
@kevin85421 |
Why are these changes needed?
Gradually moving test from python to go for better k8s support.
Related issue number
Closes #2510
Checks