Skip to content
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

Akka.TestKit: EventFilter.And does not correctly support typed parameters #6316

Closed
Aaronontheweb opened this issue Dec 20, 2022 · 0 comments · Fixed by #6371
Closed

Akka.TestKit: EventFilter.And does not correctly support typed parameters #6316

Aaronontheweb opened this issue Dec 20, 2022 · 0 comments · Fixed by #6371

Comments

@Aaronontheweb
Copy link
Member

Version Information
Version of Akka.NET? v1.4.47 (and probably most earlier versions)
Which Akka.NET Modules? Akka.TestKit

Describe the bug

Consider the following code sample:

[Fact(DisplayName = "DeadLetterLoggingSpecs: Should log the underlying message, not the IWithTrace wrapper")]
public async Task ShouldLogTheUnderlyingMessage()
{
    // create a new SuspendableActor
    var actor = Sys.ActorOf(Props.Create<SuspendableActor>());
    Watch(actor);

    await EventFilter.DeadLetter<string>().And.DeadLetter<double>().ExpectAsync(2, () =>
    {
        // suspend the actor (via a blocking Task)
        actor.Tell(new SuspendableActor.Suspend());

        using (var newOp = Tracer.StartActiveSpan("startOp"))
        {
            // queue up dead letters (should be descendants of the current span)
            // this should force these messages to be wrapped inside a SpanEnvelope
            actor.Tell("hi");
            actor.Tell(1);
        }
        
        // sends a system message that will cause the actor to shutdown regardless of its mailbox state
        Sys.Stop(actor);
        
        // wait for the actor to shut down
        ExpectTerminated(actor);
    });

}

The DeadLetters that should be received should be of type string, int, but the assertion checked for string, bool.

Worth noting: if I change the expected type on the first assertion away from string to something like SuspendableActor this assertion will fail.

Expected behavior

The EventFilter assertions should type check everything in a composed assertion.

Actual behavior

Only the first message in the EventFilter expression appears to be properly type-checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant