Skip to content

Make DeactivationOnIdle behaviour on POCO grain consistent#173

Closed
rinkeb wants to merge 1 commit intoOrleansContrib:mainfrom
rinkeb:main
Closed

Make DeactivationOnIdle behaviour on POCO grain consistent#173
rinkeb wants to merge 1 commit intoOrleansContrib:mainfrom
rinkeb:main

Conversation

@rinkeb
Copy link
Contributor

@rinkeb rinkeb commented Jun 20, 2025

The current behaviour of a call to DeactivateOnIdle depends on whether the grain is a normal grain (deriving Grain) or a POCO grain (implementing IGrainBase). When called on the first a mocked implementation (noop) is called, while on the latter a NotImplementedException is thrown.

In my opinion the choice for either is an implementation detail and should not result in different grain behaviour.

This pull request proposes a change to make the behaviour of the latter consistent with the former.

@seniorquico
Copy link
Collaborator

I agree that it should be possible to assert for calls to DeactivateOnIdle. This same issue exists for MigrateOnIdle, as well.

I don't think this is an appropriate interface, though. It shouldn't be a requirement for TestKit consumers to have to cast objects to get to the mock object. In the other path, there's a mock object for IGrainRuntime. I also don't think TestKit consumers should have to figure out which of these deactivation mocks to assert on based on their grain implementation pattern.

@rinkeb
Copy link
Contributor Author

rinkeb commented Jun 20, 2025

I agree that it should be possible to assert for calls to DeactivateOnIdle.

Well, for me its not really about asserting. I just want to be able to call DeactivateOnIdle in the SUT without experiencing an exception when the grain happens to be implemented as POCO.

I just mimicked the solution of #9 to have a similar way to validate the behaviour. Not sure about better options, as i'm not that familiar with the code base.

@rinkeb
Copy link
Contributor Author

rinkeb commented Jul 1, 2025

Never mind, i migrated to InProcessTestCluster which seems a better fit for my testing needs.

@rinkeb rinkeb closed this Jul 1, 2025
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.

3 participants