Skip to content

Commit

Permalink
[SpecFix] working on fixing AtLeastOnceDeliveryCrashSpec (#3806)
Browse files Browse the repository at this point in the history
* #3786 - working on fixing AtLeastOnceDeliveryCrashSpec

* fixed issue with SnapshotDirectoryFailureSpec.LocalSnapshotStore_configured_with_a_failing_directory

* fixed Akka.Persistence.Tests.Actor_PipeTo_should_not_be_delayed_by_async_receive

* looks like issue might be related to parallel execution and thread blocking

* added logging for AtLeastOnceDelivery_must_tolerate_and_recover_from_random_failures
  • Loading branch information
Aaronontheweb authored May 26, 2019
1 parent 2ad84ee commit a3963cd
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Akka.Event;
using Akka.TestKit;
using Xunit;
using Xunit.Abstractions;

namespace Akka.Persistence.Tests
{
Expand Down Expand Up @@ -116,8 +117,8 @@ private void Send()

#endregion

public AtLeastOnceDeliveryCrashSpec()
: base(PersistenceSpec.Configuration("AtLeastOnceDeliveryCrashSpec", serialization: "off"))
public AtLeastOnceDeliveryCrashSpec(ITestOutputHelper output)
: base(PersistenceSpec.Configuration("AtLeastOnceDeliveryCrashSpec", serialization: "off"), output)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Akka.Event;
using Akka.TestKit;
using Xunit;
using Xunit.Abstractions;

namespace Akka.Persistence.Tests
{
Expand Down Expand Up @@ -331,8 +332,8 @@ private IActorRef CreateSender()

internal const int NumberOfMessages = 10;

public AtLeastOnceDeliveryFailureSpec()
: base(FailureSpecConfig.WithFallback(Persistence.DefaultConfig()))
public AtLeastOnceDeliveryFailureSpec(ITestOutputHelper output)
: base(FailureSpecConfig.WithFallback(Persistence.DefaultConfig()), output)
{
}

Expand Down
5 changes: 3 additions & 2 deletions src/core/Akka.Persistence.Tests/AtLeastOnceDeliverySpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Akka.Event;
using Akka.TestKit;
using Xunit;
using Xunit.Abstractions;

namespace Akka.Persistence.Tests
{
Expand Down Expand Up @@ -365,8 +366,8 @@ protected override bool ReceiveRecover(object message)

#endregion

public AtLeastOnceDeliverySpec()
: base(Configuration("AtLeastOnceDeliverySpec"))
public AtLeastOnceDeliverySpec(ITestOutputHelper output)
: base(Configuration("AtLeastOnceDeliverySpec"), output)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,13 +574,15 @@ public AsyncPipeToDelayActor(string persistenceId)

CommandAsync<string>(async msg =>
{
var sender = Sender;
var self = Self;
Task.Run(() =>
{
Thread.Sleep(10);
return msg;
}).PipeTo(Sender, Self); //LogicalContext is lost?!?
}).PipeTo(sender, self);

Thread.Sleep(3000);
await Task.Delay(3000);
});
}
}
Expand Down
11 changes: 8 additions & 3 deletions src/core/Akka.Persistence.Tests/SnapshotDirectoryFailureSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected override bool ReceiveCommand(object message)
}
}

FileInfo file = new FileInfo(InUseSnapshotPath);
private readonly FileInfo _file = new FileInfo(InUseSnapshotPath);

public SnapshotDirectoryFailureSpec() : base(Configuration("SnapshotDirectoryFailureSpec",
extraConfig: "akka.persistence.snapshot-store.local.dir = \"" + InUseSnapshotPath + "\""))
Expand All @@ -58,12 +58,17 @@ public SnapshotDirectoryFailureSpec() : base(Configuration("SnapshotDirectoryFai
protected override void AtStartup()
{
base.AtStartup();
using (file.Create()) {}
try // try to create the directory first.d
{
_file.Directory.Create();
}
catch { }
using (_file.Create()) {}
}

protected override void AfterTermination()
{
file.Delete();
_file.Delete();
base.AfterTermination();
}

Expand Down

0 comments on commit a3963cd

Please sign in to comment.