-
Notifications
You must be signed in to change notification settings - Fork 1k
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
LogEvent type of UnhandledMessage was changed to INFO in Akka.TestKit (#6354). #6360
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
src/core/Akka.TestKit.Tests/TestEventListenerTests/UnhandledMessageEventFilterTests.cs
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,55 @@ | ||
// //----------------------------------------------------------------------- | ||
// // <copyright file="UnhandledMessageEventFilterTestsBase.cs" company="Akka.NET Project"> | ||
// // Copyright (C) 2009-2023 Lightbend Inc. <http://www.lightbend.com> | ||
// // Copyright (C) 2013-2023 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// // </copyright> | ||
// //----------------------------------------------------------------------- | ||
|
||
using System.Text.RegularExpressions; | ||
using System.Threading.Tasks; | ||
using Akka.Actor; | ||
using Akka.Event; | ||
using Akka.TestKit.TestActors; | ||
using Xunit; | ||
|
||
namespace Akka.TestKit.Tests.TestEventListenerTests | ||
{ | ||
public class UnhandledMessageEventFilterTests : EventFilterTestBase | ||
{ | ||
private readonly IActorRef _unhandledMessageActor; | ||
|
||
public UnhandledMessageEventFilterTests() : base("akka.loglevel=INFO") | ||
{ | ||
_unhandledMessageActor = Sys.ActorOf<UnhandledMessageActor>(); | ||
} | ||
|
||
protected override void SendRawLogEventMessage(object message) | ||
{ | ||
Sys.EventStream.Publish(new Error(null, "UnhandledMessageEventFilterTests", GetType(), message)); | ||
} | ||
|
||
[Fact] | ||
public async Task Unhandled_message_should_produce_info_message() | ||
{ | ||
await EventFilter | ||
.Info(new Regex("^Unhandled message from")) | ||
.ExpectOneAsync(async () => | ||
{ | ||
_unhandledMessageActor.Tell("whatever"); | ||
}); | ||
} | ||
|
||
[Fact] | ||
public async Task Unhandled_message_should_not_produce_warn_and_error_message() | ||
{ | ||
await EventFilter | ||
.Warning() | ||
.And | ||
.Error() | ||
.ExpectAsync(0, async () => | ||
{ | ||
_unhandledMessageActor.Tell("whatever"); | ||
}); | ||
} | ||
} | ||
} |
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,20 @@ | ||
// //----------------------------------------------------------------------- | ||
// // <copyright file="NoMessageHandlingActor.cs" company="Akka.NET Project"> | ||
// // Copyright (C) 2009-2023 Lightbend Inc. <http://www.lightbend.com> | ||
// // Copyright (C) 2013-2023 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// // </copyright> | ||
// //----------------------------------------------------------------------- | ||
|
||
using Akka.Actor; | ||
|
||
namespace Akka.TestKit.TestActors | ||
{ | ||
/// <summary> | ||
/// An <see cref="UnhandledMessageActor"/> is an actor that don't handle any message | ||
/// sent to it. An UnhandledMessage will be generated as result of handling any message | ||
/// </summary> | ||
public class UnhandledMessageActor : ReceiveActor | ||
{ | ||
|
||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this is a
Warning
in the JVM. Are we sure this is the root cause of the issue?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As i see in
Akka.Event.DeadLetterListener
messageUnhandledMessage
is handled as Info message instead ofTestEventListener
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
akka.net/src/core/Akka/Event/DeadLetterListener.cs
Line 192 in 1b96294
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like @F0b0s is right - in the real logging system unhandled messages get logged as Info unless he's not looking in the right place. I did a quick (not complete) look through the code and the
DeadLetterListener
is the only built-in subscriber for it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found solution for #6316 and it's blocked by this PR. When it will be merged i can create MR for it.