Skip to content

[core] Remove dead plasma client code and create mock - #53205

Merged
edoakes merged 3 commits into
ray-project:masterfrom
dayshah:dead-plasma-evict
May 22, 2025
Merged

edoakes merged 3 commits into
ray-project:masterfrom
dayshah:dead-plasma-evict

Conversation

@dayshah

@dayshah dayshah commented May 21, 2025

Copy link
Copy Markdown
Contributor

Why are these changes needed?

There's some dead plasma eviction code that's not used anywhere. Removing the dead code and creating a mock for the PlasmaClient here.

This is split up from #53120 to make reviewing that less intimidating.

Related issue number

Checks

@dayshah
dayshah requested a review from a team May 21, 2025 16:29
@dayshah dayshah added the go add ONLY when ready to merge, run all tests label May 21, 2025
Comment thread src/ray/object_manager/plasma/client.h Resolved

class MockPlasmaClient : public PlasmaClientInterface {
public:
MOCK_METHOD(Status,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In general I'd recommend we avoid mocking and prefer to write fake implementations instead. These implementations can/should be reused across multiple test cases and should mirror the behaviors of the real implementation where possible.

(In an ideal world, IMO, we wouldn't even need the gmock dependency)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So concretely in this PR I'd prefer we write a basic fake that does not use gmock and instead implements the minimal functionality required for the dependent unit tests

Over time, we can build out the functionality here and reuse it across multiple tests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

By basic fake, something that just returns the ok status? The mocks do that by default. Or something that will actually call the reply callbacks and do something?

I was thinking kind of the opposite where unit tests can override if they want some functionality out of it, but most times they'll just want the default return value and can invoke something specific with the mock in the test if the test requires something out of it. This is generally how all the unit testing happens now.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes something that just returns the ok status. In an ideal world we'd have a fake that can be reused across multiple test cases.

This is an OK place to start, let's see how it goes.


class MockPlasmaClient : public PlasmaClientInterface {
public:
MOCK_METHOD(Status,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes something that just returns the ok status. In an ideal world we'd have a fake that can be reused across multiple test cases.

This is an OK place to start, let's see how it goes.

@edoakes
edoakes merged commit e84833a into ray-project:master May 22, 2025
@dayshah
dayshah deleted the dead-plasma-evict branch May 22, 2025 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants