forked from akkadotnet/akka.net
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Type of LogEvent of UnhandledMessage was changed to INFO in Akka.Test…
…Kit (akkadotnet#6354). (akkadotnet#6360) Co-authored-by: Aaron Stannard <aaron@petabridge.com>
- Loading branch information
1 parent
d43a8d0
commit a447760
Showing
3 changed files
with
87 additions
and
13 deletions.
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 | ||
{ | ||
|
||
} | ||
} |