Skip to content

[History Server] Replace private getter assertions with BuildSnapshot() in history server unit tests#4949

Open
dalaoqi wants to merge 2 commits into
ray-project:masterfrom
dalaoqi:historyserver-snapshot-test-assertions
Open

[History Server] Replace private getter assertions with BuildSnapshot() in history server unit tests#4949
dalaoqi wants to merge 2 commits into
ray-project:masterfrom
dalaoqi:historyserver-snapshot-test-assertions

Conversation

@dalaoqi

@dalaoqi dalaoqi commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Why are these changes needed?

The unit tests asserted on internal state via the private getters getActorsMap, getJobsMap, and getNodeMap, coupling the tests to implementation details. Since BuildSnapshot() is the only exported accessor and is the single source of truth for what we serve, the tests now assert on the snapshot's Actors, Jobs, and Nodes fields instead.

Related issue number

Closes #4937

Checks

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

…() in history server unit tests (ray-project#4937)

Signed-off-by: Tsung-Han Ho (Miles Ho) <mystes3016@gmail.com>
@dalaoqi
dalaoqi marked this pull request as ready for review June 24, 2026 17:34

@JiangJiaWei1103 JiangJiaWei1103 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for contribution!

nit (non-blocking): Could bind snap := h.BuildSnapshot(clusterInfo) once and read snap.Actors[id] / snap.Jobs[id] / snap.Nodes off it?

@chiayi
chiayi self-requested a review June 29, 2026 17:41
…g fields

Signed-off-by: Tsung-Han Ho (Miles Ho) <mystes3016@gmail.com>
@dalaoqi dalaoqi changed the title [History Server] Replace private getter assertions with BuildSnapshot… [History Server] Replace private getter assertions with BuildSnapshot() in history server unit tests Jun 29, 2026
@dalaoqi
dalaoqi requested a review from JiangJiaWei1103 June 29, 2026 17:44
@dalaoqi

dalaoqi commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

@JiangJiaWei1103 Done, bound to snap and read fields off it. Thanks!

@JiangJiaWei1103 JiangJiaWei1103 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[History Server] Replace private getter assertions with BuildSnapshot() in unit tests

3 participants