Skip to content

[refactor] Refactor enable login shell #3704

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

Merged
merged 1 commit into from
May 28, 2025

Conversation

kevin85421
Copy link
Member

@kevin85421 kevin85421 commented May 28, 2025

Why are these changes needed?

A follow up of #3679

Related issue number

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

Signed-off-by: kaihsun <[email protected]>
@@ -202,13 +201,6 @@ func TestGetSubmitterTemplate(t *testing.T) {
envVar, found = utils.EnvVarByName(utils.RAY_JOB_SUBMISSION_ID, submitterTemplate.Spec.Containers[utils.RayContainerIndex].Env)
assert.True(t, found)
assert.Equal(t, "test-job-id", envVar.Value)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestGetContainerCommand already tests the flag, and this test covers the behavior of Command. Therefore, "Test 7" can be removed.

@@ -3007,111 +3008,6 @@ func Test_RedisCleanup(t *testing.T) {
}
}

func Test_RedisCleanupWithLoginShell(t *testing.T) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestGetContainerCommand already tests the flag. It is not worth it to maintain this complex test, so I move the check to Test_RedisCleanup.

We should refactor the interface to make write unit tests easier.

if initContainer.Name == "wait-gcs-ready" {
assert.Equal(t, []string{"/bin/bash", "-lc", "--"}, initContainer.Command)
}
func TestBuildPod_WithLoginBash(t *testing.T) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no test to verify container command in pod_test.go, so I didn't delete this test.

@kevin85421 kevin85421 changed the title [refactor] WIP [refactor] Refactor enable login shell May 28, 2025
@@ -554,9 +554,9 @@ func getSubmitterTemplate(ctx context.Context, rayJobInstance *rayv1.RayJob, ray
if err != nil {
return corev1.PodTemplateSpec{}, err
}
submitterTemplate.Spec.Containers[utils.RayContainerIndex].Command = utils.GetContainerCommand()[:2]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's weird to process utils.GetContainerCommand(). We should unify all command generation related logic into the util function.

@@ -703,9 +703,12 @@ func GetClusterType() bool {
return false
}

func GetContainerCommand() []string {
func GetContainerCommand(additionalOptions []string) []string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Add a comment that additionalOptions only accepts flags with single character.

@kevin85421 kevin85421 merged commit 7080cc0 into ray-project:master May 28, 2025
24 checks passed
@kevin85421
Copy link
Member Author

cc @fscnick

pawelpaszki pushed a commit to opendatahub-io/kuberay that referenced this pull request Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants