-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP dead letter suppression testing * added `WrappedMessage.IsDeadLetterSuppressedAnywhere` * cleaned up message-handling for `DeadLetterActorRef` * added checks for wrapped messages in DeadLetter handling * fixed issue with recursive dead letter detection * added test cases for `ActorSelection` also * checking in `SuppressedDeadLetter` API changes
- Loading branch information
1 parent
96645a5
commit 0cf567a
Showing
8 changed files
with
136 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="WrappedMessagesSpec.cs" company="Akka.NET Project"> | ||
// Copyright (C) 2009-2024 Lightbend Inc. <http://www.lightbend.com> | ||
// Copyright (C) 2013-2024 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
using Akka.Actor; | ||
using Akka.Event; | ||
using Akka.TestKit; | ||
using Xunit; | ||
|
||
namespace Akka.Tests; | ||
|
||
public class WrappedMessagesSpec | ||
{ | ||
private sealed record WrappedClass(object Message) : IWrappedMessage; | ||
|
||
private sealed record WrappedSuppressedClass(object Message) : IWrappedMessage, IDeadLetterSuppression; | ||
|
||
private sealed class SuppressedMessage : IDeadLetterSuppression | ||
{ | ||
|
||
} | ||
|
||
|
||
[Fact] | ||
public void ShouldUnwrapWrappedMessage() | ||
{ | ||
var message = new WrappedClass("chocolate-beans"); | ||
var unwrapped = WrappedMessage.Unwrap(message); | ||
unwrapped.ShouldBe("chocolate-beans"); | ||
} | ||
|
||
public static readonly TheoryData<object, bool> SuppressedMessages = new() | ||
{ | ||
{new SuppressedMessage(), true}, | ||
{new WrappedClass(new SuppressedMessage()), true}, | ||
{new WrappedClass(new WrappedClass(new SuppressedMessage())), true}, | ||
{new WrappedClass(new WrappedClass("chocolate-beans")), false}, | ||
{new WrappedSuppressedClass("foo"), true}, | ||
{new WrappedClass(new WrappedSuppressedClass("chocolate-beans")), true}, | ||
{new WrappedClass("chocolate-beans"), false}, | ||
{"chocolate-beans", false} | ||
}; | ||
|
||
[Theory] | ||
[MemberData(nameof(SuppressedMessages))] | ||
public void ShouldDetectIfWrappedMessageIsSuppressed(object message, bool shouldBeSuppressed) | ||
{ | ||
var isSuppressed = WrappedMessage.IsDeadLetterSuppressedAnywhere(message); | ||
isSuppressed.ShouldBe(shouldBeSuppressed); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters