Skip to content
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

TestKit support for JournaledGrains #104

Open
marcosikkens opened this issue Jan 9, 2021 · 2 comments
Open

TestKit support for JournaledGrains #104

marcosikkens opened this issue Jan 9, 2021 · 2 comments

Comments

@marcosikkens
Copy link

I was looking at the different examples but I couldn't find an example of a journaled grain that is being tested. Is this supported? I just want to call a method an verify that the "Raise event" is being called.

My grain is a journaled grain with a [LogConsistencyProvider(ProviderName = "EventStorage")] and when activating this grain it would just crash with the following exception:

   at Orleans.EventSourcing.JournaledGrain`2.OnActivateAsync()
   at Orleans.Grain.<Participate>b__31_0(CancellationToken ct)
   at Orleans.LifecycleExtensions.Observer.OnStart(CancellationToken ct)
   at Orleans.TestKit.TestGrainLifecycle.<>c.<TriggerStartAsync>b__2_1(ValueTuple`2 x)
   at System.Linq.Enumerable.SelectIPartitionIterator`2.PreallocatingToArray(Int32 count)
   at System.Linq.Enumerable.SelectIPartitionIterator`2.ToArray()
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Orleans.TestKit.TestGrainLifecycle.TriggerStartAsync()
   at Orleans.TestKit.TestKitSilo.<CreateGrainAsync>d__31`1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Translink.Vbn.Aggregates.Tests.CompanyAggregateRootContext.<Execute>d__6.MoveNext() 

So something doesnt work in the OnActivate. This exception occurs when calling the CreateGrainAsync method

        Grain = await Silo.CreateGrainAsync<CompanyAggregateRoot>(CompanyId);

When I directly use the grain factory i do not get any DI which this grain needs (and the version property is not set). Are there better ways to test journaled grains? Or do I just not test them (which feels kinda strange).

@seniorquico
Copy link
Collaborator

I think the TestKit simply lacks support for JournaledGrain.

I previously implemented ICustomStorageInterface in a project, and iirc the JournaledGrain hooks into several pieces of the Orleans activation/context/internals. I would expect us needing some new mocking/infrastructure to support JournaledGrain.

@ebeuker
Copy link

ebeuker commented Mar 13, 2021

I have been starting to use Orleans Journaled grains at work and I would like to help contribute to this feature.

I do not have a lot of knowledge about the inner workings of Orleans, could you point me in the right direction? What interfaces do you expect to need a mock implementation?

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

No branches or pull requests

3 participants