Skip to content

Commit

Permalink
fixed ordering assertion in AtLeastOnceDelivery_must_warn_about_uncon…
Browse files Browse the repository at this point in the history
…firmed_messages (#6396)

`AtLeastOnceDeliveryActor`s inherently do no guarantee delivery order, especially when messages are sent to multiple destinations - therefore we should not enforce it in the assertions.
  • Loading branch information
Aaronontheweb committed Feb 9, 2023
1 parent 9a55cba commit 74ff4f2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/Akka.Persistence.Tests/AtLeastOnceDeliverySpec.cs
Expand Up @@ -9,12 +9,12 @@
using System.Collections.Generic;
using System.Linq;
using Akka.Actor;
using Akka.Actor.Dsl;
using Akka.Event;
using Akka.TestKit;
using Akka.TestKit.Xunit2.Attributes;
using Xunit;
using Xunit.Abstractions;
using FluentAssertions;

namespace Akka.Persistence.Tests
{
Expand Down Expand Up @@ -574,13 +574,13 @@ public void AtLeastOnceDelivery_must_warn_about_unconfirmed_messages()
ExpectMsg(ReqAck.Instance);

var unconfirmed = ReceiveWhile(TimeSpan.FromSeconds(3), x =>
x is UnconfirmedWarning ? ((UnconfirmedWarning)x).UnconfirmedDeliveries : Enumerable.Empty<UnconfirmedDelivery>())
x is UnconfirmedWarning warning ? warning.UnconfirmedDeliveries : Enumerable.Empty<UnconfirmedDelivery>())
.SelectMany(e => e).ToArray();

var resultDestinations = unconfirmed.Select(x => x.Destination).Distinct().ToArray();
resultDestinations.ShouldOnlyContainInOrder(probeA.Ref.Path, probeB.Ref.Path);
resultDestinations.Should().BeEquivalentTo(probeA.Ref.Path, probeB.Ref.Path);
var resultMessages = unconfirmed.Select(x => x.Message).Distinct().ToArray();
resultMessages.ShouldOnlyContainInOrder(new Action(1, "a-1"), new Action(2, "b-1"), new Action(3, "b-2"));
resultMessages.Should().BeEquivalentTo(new Action(1, "a-1"), new Action(2, "b-1"), new Action(3, "b-2"));

Sys.Stop(sender);
}
Expand Down

0 comments on commit 74ff4f2

Please sign in to comment.