Browse Source

PR fixed

pull/268/head
Sebastian Stehle 8 years ago
parent
commit
d946304f1e
  1. 2
      src/Squidex.Infrastructure/Orleans/Bootstrap.cs
  2. 1
      tests/Squidex.Infrastructure.Tests/EventSourcing/Grains/OrleansEventNotifierTests.cs
  3. 39
      tests/Squidex.Infrastructure.Tests/Orleans/BootstrapTests.cs

2
src/Squidex.Infrastructure/Orleans/Bootstrap.cs

@ -36,7 +36,7 @@ namespace Squidex.Infrastructure.Orleans
return;
}
catch (OrleansMessageRejectionException)
catch (OrleansException)
{
if (i == NumTries)
{

1
tests/Squidex.Infrastructure.Tests/EventSourcing/Grains/OrleansEventNotifierTests.cs

@ -29,7 +29,6 @@ namespace Squidex.Infrastructure.EventSourcing.Grains
[Fact]
public void Should_wakeup_manager_with_stream_name()
{
sut.Initialize();
sut.NotifyEventsStored("my-stream");
A.CallTo(() => manager.ActivateAsync("my-stream"))

39
tests/Squidex.Infrastructure.Tests/Orleans/BootstrapTests.cs

@ -6,10 +6,13 @@
// All rights reserved.
// ==========================================================================
using System;
using System.Threading;
using System.Threading.Tasks;
using FakeItEasy;
using Orleans;
using Orleans.Runtime;
using Squidex.Infrastructure.Tasks;
using Xunit;
namespace Squidex.Infrastructure.Orleans
@ -37,5 +40,41 @@ namespace Squidex.Infrastructure.Orleans
A.CallTo(() => grain.ActivateAsync())
.MustHaveHappened();
}
[Fact]
public async Task Should_fail_on_non_rejection_exception()
{
A.CallTo(() => grain.ActivateAsync())
.Throws(new InvalidOperationException());
await Assert.ThrowsAsync<InvalidOperationException>(() => sut.Execute(CancellationToken.None));
}
[Fact]
public async Task Should_retry_after_rejection_exception()
{
A.CallTo(() => grain.ActivateAsync())
.Returns(TaskHelper.Done);
A.CallTo(() => grain.ActivateAsync())
.Throws(new OrleansException()).Once();
await sut.Execute(CancellationToken.None);
A.CallTo(() => grain.ActivateAsync())
.MustHaveHappened(Repeated.Exactly.Twice);
}
[Fact]
public async Task Should_fail_after_10_rejection_exception()
{
A.CallTo(() => grain.ActivateAsync())
.Throws(new OrleansException());
await Assert.ThrowsAsync<OrleansException>(() => sut.Execute(CancellationToken.None));
A.CallTo(() => grain.ActivateAsync())
.MustHaveHappened(Repeated.Exactly.Times(10));
}
}
}

Loading…
Cancel
Save