|
|
@ -7,6 +7,7 @@ |
|
|
|
|
|
|
|
|
using FakeItEasy; |
|
|
using FakeItEasy; |
|
|
using FluentAssertions; |
|
|
using FluentAssertions; |
|
|
|
|
|
using Orleans.Storage; |
|
|
using Squidex.Infrastructure.Orleans; |
|
|
using Squidex.Infrastructure.Orleans; |
|
|
using Squidex.Infrastructure.TestHelpers; |
|
|
using Squidex.Infrastructure.TestHelpers; |
|
|
using Squidex.Log; |
|
|
using Squidex.Log; |
|
|
@ -479,10 +480,10 @@ namespace Squidex.Infrastructure.EventSourcing.Grains |
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_start_after_stop_if_handling_failed() |
|
|
public async Task Should_start_after_stop_if_handling_failed() |
|
|
{ |
|
|
{ |
|
|
var exception = new InvalidOperationException(); |
|
|
var ex = new InvalidOperationException(); |
|
|
|
|
|
|
|
|
A.CallTo(() => eventConsumer.On(envelope)) |
|
|
A.CallTo(() => eventConsumer.On(envelope)) |
|
|
.Throws(exception); |
|
|
.Throws(ex); |
|
|
|
|
|
|
|
|
await sut.ActivateAsync(consumerName); |
|
|
await sut.ActivateAsync(consumerName); |
|
|
await sut.ActivateAsync(); |
|
|
await sut.ActivateAsync(); |
|
|
@ -510,6 +511,24 @@ namespace Squidex.Infrastructure.EventSourcing.Grains |
|
|
.MustHaveHappened(2, Times.Exactly); |
|
|
.MustHaveHappened(2, Times.Exactly); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Fact] |
|
|
|
|
|
public async Task Should_fail_if_writing_failed() |
|
|
|
|
|
{ |
|
|
|
|
|
var ex = new InconsistentStateException(); |
|
|
|
|
|
|
|
|
|
|
|
A.CallTo(() => grainState.WriteAsync()) |
|
|
|
|
|
.Throws(ex); |
|
|
|
|
|
|
|
|
|
|
|
await sut.ActivateAsync(consumerName); |
|
|
|
|
|
await sut.ActivateAsync(); |
|
|
|
|
|
|
|
|
|
|
|
await OnEventAsync(eventSubscription, storedEvent); |
|
|
|
|
|
|
|
|
|
|
|
await sut.CompleteAsync(); |
|
|
|
|
|
|
|
|
|
|
|
AssetGrainState(isStopped: true, position: storedEvent.EventPosition, error: ex.ToString(), 1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private Task OnErrorAsync(IEventSubscription subscription, Exception exception) |
|
|
private Task OnErrorAsync(IEventSubscription subscription, Exception exception) |
|
|
{ |
|
|
{ |
|
|
return sut.OnErrorAsync(subscription, exception); |
|
|
return sut.OnErrorAsync(subscription, exception); |
|
|
|