-
Notifications
You must be signed in to change notification settings - Fork 665
[RayService] auth token mode e2e test #4225
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
rueian
merged 15 commits into
ray-project:master
from
ryankert01:e2e/ray-service-runtime-env-update
Dec 9, 2025
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5a563b8
add ray service auth test
ryankert01 4884683
try to fix the error
ryankert01 3145953
Merge remote-tracking branch 'origin/master' into e2e/ray-service-run…
ryankert01 7a49958
add worker group
ryankert01 08d7f08
Adjust resource requests and limits in tests
ryankert01 f35a3b6
Simplify RayService auth test by removing worker group
ryankert01 6060d52
Update rayservice_auth_test.go
ryankert01 757634b
Refactor TestRayServiceAuthToken for clarity
ryankert01 ea3b1cf
Update ray-operator/test/e2erayservice/rayservice_auth_test.go
ryankert01 f85180b
Update ray-operator/test/e2erayservice/rayservice_auth_test.go
ryankert01 58f1493
address comments
ryankert01 5625613
pre-commit check
ryankert01 8d62b1e
Merge branch 'master' into e2e/ray-service-runtime-env-update
Future-Outlier b680b99
update test
Future-Outlier 7f4d085
revert my update
Future-Outlier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| package e2erayservice | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| . "github.com/onsi/gomega" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
|
||
| rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1" | ||
| "github.com/ray-project/kuberay/ray-operator/controllers/ray/utils" | ||
| rayv1ac "github.com/ray-project/kuberay/ray-operator/pkg/client/applyconfiguration/ray/v1" | ||
| . "github.com/ray-project/kuberay/ray-operator/test/support" | ||
| ) | ||
|
|
||
| func TestRayServiceAuthToken(t *testing.T) { | ||
| test := With(t) | ||
| g := NewWithT(t) | ||
|
|
||
| namespace := test.NewTestNamespace() | ||
|
|
||
| rayServiceName := "rayservice-auth" | ||
| rayServiceSpec := RayServiceSampleYamlApplyConfiguration() | ||
| rayServiceSpec.RayClusterSpec.WithAuthOptions(rayv1ac.AuthOptions().WithMode(rayv1.AuthModeToken)) | ||
|
|
||
| rayServiceAC := rayv1ac.RayService(rayServiceName, namespace.Name).WithSpec(rayServiceSpec) | ||
|
|
||
| rayService, err := test.Client().Ray().RayV1().RayServices(namespace.Name).Apply(test.Ctx(), rayServiceAC, TestApplyOptions) | ||
| g.Expect(err).NotTo(HaveOccurred()) | ||
| g.Expect(rayService).NotTo(BeNil()) | ||
| LogWithTimestamp(test.T(), "Created RayService %s/%s successfully with AuthModeToken", rayService.Namespace, rayService.Name) | ||
|
|
||
| defer func() { | ||
| err := test.Client().Ray().RayV1().RayServices(namespace.Name).Delete(test.Ctx(), rayService.Name, metav1.DeleteOptions{}) | ||
| if err != nil { | ||
| LogWithTimestamp(test.T(), "WARNING: Failed to delete RayService %s: %v", rayService.Name, err) | ||
| } else { | ||
| LogWithTimestamp(test.T(), "Deleted RayService %s/%s successfully", rayService.Namespace, rayService.Name) | ||
| } | ||
| }() | ||
|
|
||
| LogWithTimestamp(test.T(), "Waiting for RayService %s/%s to be ready", rayService.Namespace, rayService.Name) | ||
| g.Eventually(RayService(test, rayService.Namespace, rayService.Name), TestTimeoutMedium). | ||
| Should(WithTransform(IsRayServiceReady, BeTrue())) | ||
|
|
||
| rayService, err = GetRayService(test, namespace.Name, rayServiceName) | ||
| g.Expect(err).NotTo(HaveOccurred()) | ||
| LogWithTimestamp(test.T(), "RayService %s/%s is ready", rayService.Namespace, rayService.Name) | ||
|
|
||
| rayClusterName := rayService.Status.ActiveServiceStatus.RayClusterName | ||
| g.Expect(rayClusterName).NotTo(BeEmpty(), "RayCluster name should be populated in status") | ||
| LogWithTimestamp(test.T(), "RayService %s/%s has active RayCluster %s", rayService.Namespace, rayService.Name, rayClusterName) | ||
|
|
||
| rayCluster, err := GetRayCluster(test, namespace.Name, rayClusterName) | ||
| g.Expect(err).NotTo(HaveOccurred()) | ||
|
|
||
| headPod, err := GetHeadPod(test, rayCluster) | ||
| g.Expect(err).NotTo(HaveOccurred()) | ||
| g.Expect(headPod).NotTo(BeNil()) | ||
| LogWithTimestamp(test.T(), "Found head pod %s/%s", headPod.Namespace, headPod.Name) | ||
|
|
||
| // Verify Ray container has auth token env vars | ||
| VerifyContainerAuthTokenEnvVars(test, rayCluster, &headPod.Spec.Containers[utils.RayContainerIndex]) | ||
|
|
||
| g.Expect(rayService.Status.NumServeEndpoints).To(BeNumerically(">", 0), | ||
| "RayService should have at least one serve endpoint") | ||
|
|
||
| LogWithTimestamp(test.T(), "RayService %s/%s completed successfully with auth token", rayService.Namespace, rayService.Name) | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How about adding a container bounds checking?
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.
I think current implementation is good enough, thank you for the review!