[Refactor][Test] Extract ApplyRayJobAndWaitForTerminal helper#4772
Open
1fanwang wants to merge 1 commit intoray-project:masterfrom
Open
[Refactor][Test] Extract ApplyRayJobAndWaitForTerminal helper#47721fanwang wants to merge 1 commit intoray-project:masterfrom
1fanwang wants to merge 1 commit intoray-project:masterfrom
Conversation
8507e64 to
5c1bc73
Compare
The 5-line "Apply RayJob -> wait for IsJobTerminal" pattern was duplicated
at 8 e2e test sites across rayjob_{test,sidecar_mode,lightweight,
cluster_selector,submitter}_test.go. Promote it to support/ray.go so
callers drop the boilerplate and stay consistent on logging and timeout.
Refactors only the tight Apply-immediately-followed-by-IsJobTerminal
pattern; sites that wait on a different deployment status (Running, Failed,
ValidationFailed, ...) or interleave other logic between Apply and the
terminal wait are left untouched. The file-private helpers in
rayjob_deletion_strategy_test.go also stay where they are -- they assert
stricter completion states (Succeeded only / Failed-with-DeadlineExceeded)
than the new shared helper, which intentionally matches IsJobTerminal.
Closes ray-project#4373.
Signed-off-by: 1fanwang <1fannnw@gmail.com>
5c1bc73 to
4084dc7
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The
Apply RayJob->wait for IsJobTerminalblock is duplicated across 8 e2e test sites inray-operator/test/. As @seanlaii noted in #4363 (review), the pattern belongs inray-operator/test/support/.Direction
Extract
ApplyRayJobAndWaitForTerminalintosupport/ray.go, alongside the existingRayJob/GetRayJobaccessors andVerifyContainerAuthTokenEnvVars. Promote only the tight Apply-immediately-followed-by-IsJobTerminalpattern; leave alone sites that wait on a different deployment status (Running,Failed,ValidationFailed, ...) or interleave other logic between Apply and the terminal wait.Scope
e2erayjob/rayjob_test.goe2erayjob/rayjob_sidecar_mode_test.go(x2)e2erayjob/rayjob_lightweight_test.go(x2)e2erayjob/rayjob_cluster_selector_test.go(x2)e2erayjobsubmitter/rayjob_submitter_test.goapplyRayJobAndWaitForCompletionandapplyRayJobAndWaitForJobDeploymentStatusFailedinrayjob_deletion_strategy_test.goare intentionally untouched -- they assert stricter completion states (JobStatusSucceededonly,JobDeploymentStatusFailed+DeadlineExceeded) than the new shared helper, which matches the looserIsJobTerminal.Validation
go build ./test/...cleango vet ./test/...cleangofmt -l ray-operator/test/cleanCloses #4373.